ITL submodule

ITL submodule#

ITL generic reader module.

majis.itl.reader.read_itl(fname: str | Path, refs: dict | str | list | None = None, flat: bool = False) EventsDict | EventsList[source]

Read any ITL file.

Both, EPS/text (.itl or .txt) or JSON (.json) format are supported.

In the case of EPS format, relative datetime input is supported with references value(s) or file (.evf).

The result can be return as a nested dict of events (default) or as a flat list of events.

ITL export module.

majis.itl.export.save_itl(fout: str | Path | None, *events: EventsList | EventsDict, ref: str | dict | None = None, overlap: bool = False, **kwargs) Path[source]

Save ITL events to a new ITL file.

Note

By default, ITL blocks must not overlap each other. This can be disable with overlap=True.

MAJIS ITL timeline sub-module.

majis.itl.timeline.ChangeLog

alias of Log

class majis.itl.timeline.Timeline(observations: str | Path | EventsList | EventsDict | None = None, timeline: str | Path | None = None, ca_ref: str | dict | None = None, refs: dict | str | list | None = None)[source]

MAJIS timeline from template.

You can either append an existing timeline template or use the default one.

Warning

Some extensions (Data Validation) are not included into the exported file. This is a openpyxl limitation.

append(observations: str | Path | EventsList | EventsDict, refs: dict | str | list | None = None) None[source]

Append ITL observations blocks.

property ca_ref: datetime

C/A reference for relative time.

property header

Timeline header size.

save(fout: str | Path | None = None) Path[source]

Save MAJIS timeline.

property science: TimelineChangeLog

Science change log.

Raises:

ValueError: – Only available for template â‰Ĩ 2.0

property version

Template version from changelog.

class majis.itl.timeline.TimelineChangeLog(template: Workbook, sheet_name='change log')[source]

MAJIS timeline change log.

read_changelog(rows: list) -> (<class 'list'>, <class 'list'>)[source]

Read changelog changes grouped by version, date and author.

Majis ITL in EPS format sub-module.

majis.itl.eps.reader.read_itl_eps(fname: str | Path, refs: dict | str | list | None = None) list[EventWindow][source]

Read ITL file in EPS (text) format.

Note

  • The blocks can be prefixed with additional instrument parameters.

  • Blocks must be continuous, ie. consecutive OBS_START and OBS_END lines should have the same instrument observation name. If not an ValueError will be raised

ITL EPS export module.

majis.itl.eps.export.fmt_eps_comments(event: dict | EventWindow, max_length: int = 90) list[str][source]

Format EPS comments.

Majis ITL in JSON format sub-module.

majis.itl.json.reader.read_itl_json(fname: str | Path) list[EventWindow][source]

Read ITL file in JSON format.

ITL are validated against Juice SOC and Majis schema.

ITL JSON export module.

majis.itl.json.export.fmt_json(event: EventsList | EventsDict) dict[source]

Format event to JSON timeline.

majis.itl.json.export.get_header(fout: str | Path | None = None) dict[source]

Get JSON header.

ITL schema sub-module.

class majis.itl.json.schema.ItlJsonSchema(fname: str | Path)[source]

ITL JSON schema object.

property name: str

Schema file name.

property title: str

Schema title description.

validate(itl: dict) None[source]

Validate ITL JSON content.

property version: int

Schema version.

At the moment this value is extracted from the title property.

ITL CSV export module.

majis.itl.csv.export.fmt_csv(blocks: dict | EventsList | EventsDict, ref: str | None = None, sep: str = ';') str[source]

Format CSV format.

majis.itl.csv.export.get_header(blocks: list[list | dict] | EventsList | EventsDict, ref: str | dict | None = None) list[source]

Get CSV header.

The keys are unique and ordered with the following rules:

  • If OBS_NAME is present, it will be placed first.

  • t_start and t_end are required and replaced by OBS_START

    and OBS_END and placed after OBS_NAME (if present).

  • if ref time is provided OBS_START_REL and OBS_END_REL

    are appended after OBS_START and OBS_END.

  • COMMENTS is present, it will always put last.

majis.itl.csv.export.get_value(block: dict | Event | EventWindow, key: str, ref: str | None = None) str[source]

Format block value.

This method extract the block value for a given property and re-format the datetime if necessary.

Comments values are escaped with double quotes (”â€Ļ”).

ITL CLI module.

majis.itl.cli.cli(argv: list | None = None)[source]

ITL command line interface.