人工衛星のデータを、
一瞬で読めるかたちに。
Satellite telemetry,
parsed in a blink.
fast-ccsds-parser は、宇宙業界の通信規格「CCSDSスペースパケット」を Pythonで高速に解析するライブラリです。衛星から届いたバイナリデータを パケットごとに切り分け、ヘッダとペイロードをすぐ扱えるかたちにします。
fast-ccsds-parser is a Python library for CCSDS Space Packets, the telemetry standard used across the space industry. It splits raw binary dumps into packets and hands you clean headers and payloads.
pip install fast-ccsds-parser
何をしてくれるの?
What does it do?
人工衛星は、温度や電池の残量、撮影した画像などの情報を小さな「小包(パケット)」に 分けて、次々と地上へ送ってきます。届いたままのデータは数字が並んでいるだけで、 どこが1つの小包の区切りなのか人には読めません。このライブラリは郵便局の仕分け係のように、 小包の区切りを見つけ、荷札を読み、中身を取り出します。
Satellites send their data (temperatures, battery levels, images) as a stream of small "parcels" called packets. As received, it is just a wall of bytes. This library works like a mail sorter: it finds where each parcel starts and ends, reads its label, and unpacks the contents.
衛星から届いたままのデータ(実データの先頭)
Raw bytes from a spacecraft (start of a real dump)
| APID | 番号Seq | 長さBytes | 中身Payload |
|---|---|---|---|
| 1418 | 0 | 28 | 00000001 3e88… |
| 1418 | 1 | 28 | 00000001 520f… |
| 1418 | 2 | 28 | … |
特長
Features
小型衛星スタートアップ、大学の研究室、衛星データを扱うエンジニアのために。
Built for small-satellite startups, university labs, and data engineers.
ヘッダ解析
Header parsing
6バイトのプライマリヘッダから、バージョン、APID、シーケンス番号、パケット長などを取り出します。
Decodes the 6-byte primary header: version, APID, sequence flags and count, packet length.
ペイロード分離
Payload extraction
ヘッダの長さ情報をもとに、データ本体を正確に切り出します。間違えやすい「長さ − 1」の扱いも内部で処理します。
Slices each data field exactly, handling the error-prone "length minus one" rule for you.
巨大ファイルもOK
Huge files welcome
ファイルを1パケットずつ読むため、ギガバイト級のダンプでもメモリ使用量は一定です。
Streams files packet by packet with constant memory, so gigabyte-scale dumps are fine.
インストールが簡単
Installs anywhere
Python標準ライブラリだけで動きます。pip install ですぐに使えます。
Pure standard library. One pip install and you are done.
DataFrameにそのまま
Straight to DataFrames
Arrow・Polars・pandasへの出力とParquet保存に対応。パケットごとにオブジェクトを作らない列形式で、少ないメモリでさばけます。
Exports to Arrow, Polars, pandas, and Parquet. Columnar storage keeps memory close to the input size.
使い方
Usage
数行で、ダンプファイルのパケットを順番に取り出せます。
A few lines walk every packet in a dump file.
from fast_ccsds_parser import iter_file, parse_primary_header # ヘッダだけを dict で / Just one header, as a dict parse_primary_header(raw_bytes) # {'version': 0, 'type': 0, 'secondary_header_flag': 1, 'apid': 42, # 'sequence_flags': 3, 'sequence_count': 1337, 'packet_length': 255} # ダンプファイルを1パケットずつ / Stream a whole dump, packet by packet for pkt in iter_file("groundstation_dump.bin"): print(pkt.header.apid, pkt.header.sequence_count, len(pkt.payload)) # 時刻コード(CUC/CDS)も1行で / The packet's time code in one call print(pkt.timecode().timestamp) # DataFrameやParquetに一発変換 / Straight to a DataFrame or Parquet from fast_ccsds_parser import scan_file, write_parquet df = scan_file("groundstation_dump.bin").to_pandas() write_parquet("groundstation_dump.bin", "packets.parquet")
本物の衛星データで検証済み
Tested on real spacecraft data
NASAの探査機エウロパ・クリッパーに搭載されたダスト分析装置(SUDA)の実テレメトリを使ってテストしています。 すべてのパケットを1バイトのずれもなく切り分けられることを、CIで毎回確認しています。
The test suite parses real telemetry from the SUDA dust analyzer on NASA's Europa Clipper mission, checking on every CI run that each packet is framed byte for byte.
テストデータは CCSDSPy プロジェクトの SPaC-Kit(Apache-2.0)で公開されているものを、テスト時にダウンロードして使っています。
The dump is published by the CCSDSPy project in SPaC-Kit (Apache-2.0) and downloaded at test time.
ロードマップ
Roadmap
Python APIはそのままに、段階的に機能と速度を高めていきます。
The Python API stays stable while features and speed grow.
-
✓ Phase 1
Pure Python プロトタイプ(v0.1.0、公開済み)
ヘッダ解析、パケット分割、ペイロード分離、ファイルのストリーム処理。Pure-Python prototype (v0.1.0, released)
Header parsing, packet splitting, payload extraction, streaming file parsing. -
✓ Phase 2a
表形式での出力(v0.2.0、公開済み)
scan_file()・to_arrow()・to_polars()・to_pandas()・write_parquet()。データを列ごとにまとめて持ち、メモリ使用量を入力ファイルの大きさに近く保ちます。Columnar output (v0.2.0, released)
scan_file(),to_arrow(),to_polars(),to_pandas(),write_parquet(), keeping memory close to the input size. -
✓ Phase 2b
時刻の解析(v0.3.0、公開済み)
セカンダリヘッダに入っているCCSDS時刻コード(CUC・CDS)をparse_timecode()やpkt.timecode()でタイムスタンプに変換します。Time codes (v0.3.0, released)
Decode CCSDS time codes (CUC / CDS) in secondary headers into timestamps viaparse_timecode()andpkt.timecode(). -
→ Phase 2c
リアルタイム受信
TCPソケットやWebSocketから届くデータを、非同期(asyncio)で届いたそばから解析します。Live streams
asyncio parsing of live TCP socket and WebSocket streams. -
⚡ Phase 3
高速化
ベンチマークで遅いと分かった処理をRust(PyO3)に置き換えます。Pythonからの使い方は変わりません。Speed
Move the hot loops that benchmarks show are slow to Rust (PyO3), keeping the Python API unchanged.