Implement JSON ITL reader and writer

Added

  • Add new ITL JSON reader with validator on SOC and MAJIS schema:
from majis import read_itl

read_itl('ITL_majis.json')
  • Add generic save_itl method for all export. The output format is based on the file extension:
from majis import save_itl

save_itl('majis.itl', events)   # ITL-EPS output
save_itl('majis.json', events)  # ITL-JSON output
save_itl('majis.csv', events)   # CSV output
save_itl('majis.xlsm', events)  # XLSM timeline output
  • The CLI can read and export ITL-JSON:
majis-itl ITL_absolute_time.json
# MAJIS - OBS_KEY=MAJ_JUP_DISK_SCAN OBS_NAME=MAJ_JUP_DISK_SCAN_001 TYPE=OBSERVATION
# MAJIS - OBSERVATION_TYPE=PRIME TARGET=JUPITER SCENARIO=S007_01 CU_TREP=500 CU_FRAME=300
# MAJIS - BINNING=1 PPE=400 START_ROW_VIS=100 MIRROR_FLAG=ENABLE START_ANGLE=-1.31051
# MAJIS - STOP_ANGLE=0.10202 SYNCHRONOUS=0 START_SCAN_SPEED=0.0022421078
# MAJIS - STOP_SCAN_SPEED=0.0022421078
# MAJIS - COMMENT: This comment will be included in the exported ITL file.
2032-09-23T05:15:45.000Z  MAJIS  OBS_START  MAJ_JUP_DISK_SCAN (PRIME=TRUE)
2032-09-23T05:26:15.000Z  MAJIS  OBS_END    MAJ_JUP_DISK_SCAN
majis-itl absolute_time.itl --json
{
  "header": {
    "filename": "ITL_.json",
    "creation_date": "2025-10-28T18:46:00.122Z",
    "author": "username"
  },
  "timeline": [
    {
      "name": "MAJ_JUP_DISK_SCAN",
      "unique_id": "MAJ_JUP_DISK_SCAN_001",
      "instrument": "MAJIS",
      "type": "OBSERVATION",
      "observation_type": "PRIME",
      "target": "JUPITER",
      "start_time": "2032-09-23T05:15:45.000Z",
      "end_time": "2032-09-23T05:26:15.000Z",
      "parameters": {
        "scenario_id": "S007_01",
        "cu_trep_ms": 500,
        "nb_cu_frames_tot": 300,
        "spatial_binning": 1,
        "ppe": 400,
        "start_row_vi": 100,
        "mirror_flag": "ENABLE",
        "start_angle": -1.31051,
        "stop_angle": 0.10202,
        "scanner_step_per_frame": 0,
        "start_scan_speed": 0.0022421078,
        "stop_scan_speed": 0.0022421078
      },
      "comment": "This comment will be included in the exported ITL file."
    }
  ]
}

Important

ITL JSON reader and export always perform a validation against the SOC and MAJIS JSON schemas.

Changes

  • Isolate ITL reader in EPS and JSON formats in their own sub-modules (read_itl_eps, read_itl_json). No changes to the public API (from majis import read_itl) that support both EPS and JSON input files.
  • Isolate export to ITL EPS, CSV, XLS in their own sub-modules.
  • ITL-EPS comments are now reformatted rather than copy-pasted.

Removes

  • Remove .comments properties from parsed EventWindow objects

Closes #12 (closed) and bump to version 1.1.0.


Notes

  • At the moment only JSON ITL with absolute times are supported. Relative time is out of the scope for this MR.
  • Export to relative time in ITL EPS is still possible (even for ITL JSON).
  • Concatenation of different format of ITL is already possible.

Open questions?

  • At the moment only the MAJIS block are extracted (and exported). Do we need to keep the other instrument blocks? Should we need to add a filter default value on MAJIS only?
  • [IAS] ITL schema should be hosted by the MAJIS team somewhere to provide a valid urn (+ how to track updates?)
Edited by Benoît SEIGNOVERT

Merge request reports

Loading