majis-ops 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
majis/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ """MAJIS operations toolbox"""
2
+
3
+ from .__version__ import __version__
4
+ from .itl import Timeline, read_itl
5
+
6
+ __all__ = [
7
+ 'read_itl',
8
+ 'Timeline',
9
+ '__version__',
10
+ ]
majis/__version__.py ADDED
@@ -0,0 +1,3 @@
1
+ """MAJIS operations toolbox version."""
2
+
3
+ __version__ = '1.0.0'
majis/itl/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ """MAJIS ITL submodule."""
2
+
3
+ from .export import save_csv, save_itl, save_xlsm
4
+ from .reader import read_itl
5
+ from .timeline import Timeline
6
+
7
+ __all__ = [
8
+ 'read_itl',
9
+ 'save_itl',
10
+ 'save_csv',
11
+ 'save_xlsm',
12
+ 'Timeline',
13
+ ]
majis/itl/cli.py ADDED
@@ -0,0 +1,148 @@
1
+ """ITL CLI module."""
2
+
3
+ import sys
4
+ from argparse import ArgumentParser
5
+ from pathlib import Path
6
+
7
+ from ..misc import read_evf
8
+ from .export import save_csv, save_itl, save_xlsm
9
+ from .reader import read_itl
10
+
11
+
12
+ def cli(argv: list | None = None):
13
+ """ITL command line interface."""
14
+ parser = ArgumentParser(description='MAJIS ITL toolbox')
15
+ parser.add_argument(
16
+ 'itl',
17
+ help='Input ITL filename(s). If multiple files are provided '
18
+ 'they will be concatenated.',
19
+ nargs='*',
20
+ metavar='input.itl',
21
+ )
22
+ parser.add_argument(
23
+ '-o',
24
+ '--output',
25
+ help='Output filename, it could be either ITL, CSV or XLSM. '
26
+ 'If none provided, the results will be displayed (only for ITL and CSV).',
27
+ metavar='output.[itl|csv|xlsm]',
28
+ default='',
29
+ )
30
+ parser.add_argument(
31
+ '-f',
32
+ '--force',
33
+ action='store_true',
34
+ help='Overwrite the output file if already exists.',
35
+ )
36
+ parser.add_argument(
37
+ '-t',
38
+ '--time-ref',
39
+ help='Input events time reference(s). '
40
+ 'If multiple values are required use an `events.evf` file.',
41
+ metavar='"YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"',
42
+ )
43
+ parser.add_argument(
44
+ '-r',
45
+ '--relative-to',
46
+ help='Reference time to be used for relative time output.',
47
+ metavar='"YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"',
48
+ )
49
+ parser.add_argument(
50
+ '--timeline',
51
+ help='Original timeline to append. '
52
+ 'If no explicit `--output` is provided new observations '
53
+ 'will be append in this file.',
54
+ metavar='timeline.xlsm',
55
+ )
56
+ parser.add_argument(
57
+ '--header',
58
+ help='ITL custom file header.',
59
+ metavar='"# my-custom-header"',
60
+ )
61
+ parser.add_argument(
62
+ '--overlap',
63
+ action='store_true',
64
+ help='Allow blocks overlap.',
65
+ )
66
+ parser.add_argument(
67
+ '--csv',
68
+ action='store_true',
69
+ help='Display the ITL as CSV.',
70
+ )
71
+ parser.add_argument(
72
+ '--csv-sep',
73
+ help='CSV separator (default: ";")',
74
+ default=';',
75
+ metavar='separator',
76
+ )
77
+
78
+ args, _ = parser.parse_known_args(argv)
79
+
80
+ refs = read_evf(args.time_ref)
81
+
82
+ events = [read_itl(itl, refs=refs, flat=True) for itl in args.itl]
83
+
84
+ if args.output:
85
+ if not args.force and Path(args.output).exists():
86
+ raise FileExistsError(args.output)
87
+
88
+ if args.output.endswith('.itl'):
89
+ save_itl(
90
+ args.output,
91
+ *events,
92
+ ref=args.relative_to,
93
+ header=args.header,
94
+ overlap=args.overlap,
95
+ )
96
+ elif args.output.endswith('.csv'):
97
+ save_csv(
98
+ args.output,
99
+ *events,
100
+ ref=args.relative_to,
101
+ sep=args.csv_sep,
102
+ overlap=args.overlap,
103
+ )
104
+ elif args.output.endswith('.xlsm'):
105
+ save_xlsm(
106
+ args.output,
107
+ *events,
108
+ timeline=args.timeline,
109
+ ca_ref=args.relative_to,
110
+ overlap=args.overlap,
111
+ )
112
+ else:
113
+ raise ValueError(
114
+ 'Only `.itl`|`.csv`|`.xlsm` extension are accepted '
115
+ f'(not `{Path(args.output).suffix}`)'
116
+ )
117
+
118
+ sys.stdout.write(f'ITL saved in: {args.output}\n')
119
+
120
+ elif args.timeline:
121
+ save_xlsm(
122
+ None,
123
+ *events,
124
+ timeline=args.timeline,
125
+ ca_ref=args.relative_to,
126
+ overlap=args.overlap,
127
+ )
128
+ sys.stdout.write(f'ITL appended to: {args.timeline}\n')
129
+
130
+ elif args.csv:
131
+ sys.stdout.write(
132
+ '\n'.join(save_csv(None, *events, sep=args.csv_sep, overlap=args.overlap))
133
+ + '\n'
134
+ )
135
+
136
+ else:
137
+ sys.stdout.write(
138
+ '\n'.join(
139
+ save_itl(
140
+ None,
141
+ *events,
142
+ ref=args.relative_to,
143
+ header=args.header,
144
+ overlap=args.overlap,
145
+ )
146
+ )
147
+ + '\n'
148
+ )
majis/itl/export.py ADDED
@@ -0,0 +1,110 @@
1
+ """ITL export module."""
2
+
3
+ from pathlib import Path
4
+
5
+ from planetary_coverage.events import EventsDict, EventsList
6
+
7
+ from ..misc import fmt_datetime
8
+ from ..misc.csv import fmt_csv
9
+ from ..misc.events import concatenate
10
+ from ..misc.evf import ref_key
11
+ from .timeline import Timeline
12
+
13
+
14
+ def _save(fout: str | Path, content: list, suffix: str | None = None) -> Path:
15
+ """Save content to file."""
16
+ fout = Path(fout)
17
+
18
+ if suffix and fout.suffix != suffix:
19
+ raise ValueError(
20
+ f'Output file name should ends with `{suffix}`: `{fout.name}` provided.'
21
+ )
22
+
23
+ fout.write_text('\n'.join(content))
24
+
25
+ return fout
26
+
27
+
28
+ def save_itl(
29
+ fout: str | Path | None,
30
+ *events: EventsList | EventsDict,
31
+ ref: str | None = None,
32
+ header: str = None,
33
+ overlap: bool = False,
34
+ ) -> Path:
35
+ """Save ITL events to a new ITL file.
36
+
37
+ Note
38
+ ----
39
+ By default, ITL blocks must not overlap each other.
40
+ This can be disable with `overlap=True`.
41
+
42
+ """
43
+ blocks = concatenate(*events, flat=True, overlap=overlap)
44
+
45
+ content = [header] if header else []
46
+
47
+ if ref:
48
+ ref = ref_key(ref)
49
+
50
+ content += [
51
+ '# Relative time reference:',
52
+ f'# {ref[1]} {ref[0]}',
53
+ '',
54
+ ]
55
+
56
+ for block in blocks:
57
+ content.extend(block.comments)
58
+
59
+ start, end = fmt_datetime(block.start, block.stop, ref=ref)
60
+
61
+ inst = block['INSTRUMENT']
62
+ prime = ' (PRIME=TRUE)' if block['PRIME'] else ''
63
+
64
+ content.append(f'{start} {inst} OBS_START {block.key}{prime}')
65
+ content.append(f'{end} {inst} OBS_END {block.key}')
66
+ content.append('') # empty line
67
+
68
+ return _save(fout, content, suffix='.itl') if fout else content
69
+
70
+
71
+ def save_csv(
72
+ fout: str | Path | None,
73
+ *events: EventsList | EventsDict,
74
+ ref: str | None = None,
75
+ sep: str = ';',
76
+ overlap: bool = False,
77
+ ) -> Path:
78
+ """Save ITL events to CSV.
79
+
80
+ Note
81
+ ----
82
+ By default, ITL blocks must not overlap each other.
83
+ This can be disable with `overlap=True`.
84
+
85
+ """
86
+ blocks = concatenate(*events, flat=True, overlap=overlap)
87
+
88
+ content = fmt_csv(blocks, ref=ref, sep=sep)
89
+
90
+ return _save(fout, content, suffix='.csv') if fout else content
91
+
92
+
93
+ def save_xlsm(
94
+ fout: str | Path | None,
95
+ *events: EventsList | EventsDict,
96
+ timeline: str | Path | None = None,
97
+ ca_ref: str | dict | None = None,
98
+ overlap: bool = False,
99
+ ) -> Path:
100
+ """Save ITL events to XLSM timeline.
101
+
102
+ If a timeline is provided but no explicit output file
103
+ the output file will be same in the original timeline.
104
+
105
+ """
106
+ blocks = concatenate(*events, flat=True, overlap=overlap)
107
+
108
+ timeline = Timeline(blocks, timeline=timeline, ca_ref=ca_ref)
109
+
110
+ return timeline.save(fout)
majis/itl/reader.py ADDED
@@ -0,0 +1,92 @@
1
+ """ITL reader module."""
2
+
3
+ import re
4
+ from pathlib import Path
5
+
6
+ from planetary_coverage.events import EventsDict, EventWindow
7
+
8
+ from ..misc import get_datetime
9
+ from ..misc.events import flatten, group
10
+
11
+ # ITL prefix pattern: # INST - KEY=VALUE ... or # INST - COMMENTS : VALUE
12
+ ATTRIBUTES = re.compile(r'^#\s+\w+\s+-\s+(?P<values>.*)')
13
+ COMMENTS = re.compile(r'^#\s+\w+\s+-\s+COMMENTS\s*:\s*(?P<value>.*)')
14
+ OBS_START = re.compile(r'(?P<inst>\w+)\s+OBS_START\s+(?P<key>\w*[a-zA-Z])(?:_\d+)?\s*')
15
+ OBS_END = re.compile(r'(?P<inst>\w+)\s+OBS_END\s+(?P<key>\w*[a-zA-Z])(?:_\d+)?$')
16
+
17
+
18
+ def read_itl(
19
+ fname: str | Path,
20
+ refs: dict | str | list | None = None,
21
+ flat: bool = False,
22
+ ) -> EventsDict | list:
23
+ """Read ITL file.
24
+
25
+ Note
26
+ ----
27
+ - The blocks can be prefixed with additional instrument parameters.
28
+
29
+ - Blocks must be continuous, ie. consecutive OBS_START and OBS_END lines
30
+ should have the same instrument observation name.
31
+ If not an ValueError will be raised
32
+
33
+ """
34
+ lines = Path(fname).read_text().splitlines()
35
+
36
+ events = _parse_itl(lines, refs=refs, filename=fname)
37
+
38
+ return flatten(events) if flat else group(events)
39
+
40
+
41
+ def _parse_itl(
42
+ lines: list[str],
43
+ refs: dict | str | list | None = None,
44
+ filename: str | Path | None = None,
45
+ ) -> list[EventWindow]:
46
+ """Parse ITL content as EventWindows list."""
47
+ events = []
48
+ attrs, header, comments, inst, key = {}, [], [], None, None
49
+
50
+ for line in lines:
51
+ if line.startswith('#'):
52
+ header.append(line)
53
+
54
+ if match := COMMENTS.match(line):
55
+ comments.append(match.group('value').strip())
56
+ elif match := ATTRIBUTES.match(line):
57
+ attrs |= dict(
58
+ field.split('=', 1) for field in match.group('values').split(' ')
59
+ )
60
+ continue
61
+
62
+ if match := OBS_START.search(line):
63
+ start = get_datetime(line, refs=refs)
64
+ inst = match.group('inst')
65
+ key = match.group('key')
66
+
67
+ attrs['PRIME'] = '(PRIME=TRUE)' in line
68
+ continue
69
+
70
+ if match := OBS_END.search(line):
71
+ end = get_datetime(line, refs=refs)
72
+
73
+ if inst != match.group('inst'):
74
+ raise ValueError(
75
+ f"Instrument block mismatch: `{inst}` / `{match.group('inst')}`"
76
+ )
77
+
78
+ if key != match.group('key'):
79
+ raise ValueError(
80
+ f"Obs name block mismatch: `{key}` / `{match.group('key')}`"
81
+ )
82
+
83
+ attrs['COMMENTS'] = ' / '.join(comments) if comments else None
84
+ attrs['ITL'] = Path(filename) if filename else None
85
+
86
+ event = EventWindow(key, t_start=start, t_end=end, INSTRUMENT=inst, **attrs)
87
+ event.comments = header
88
+ events.append(event)
89
+
90
+ attrs, header, comments, inst, key = {}, [], [], None, None
91
+
92
+ return events
majis/itl/timeline.py ADDED
@@ -0,0 +1,300 @@
1
+ """MAJIS ITL timeline sub-module."""
2
+
3
+ import warnings
4
+ from collections import defaultdict, namedtuple
5
+ from pathlib import Path
6
+
7
+ from numpy import datetime64
8
+ from openpyxl import Workbook, load_workbook
9
+ from packaging.version import Version
10
+
11
+ from planetary_coverage import datetime
12
+ from planetary_coverage.events import EventsDict, EventsList
13
+ from planetary_coverage.html import table
14
+
15
+ from ..misc import fmt_datetime
16
+ from ..misc.events import flatten
17
+ from ..misc.evf import ref_key
18
+ from ..misc.time import fmt_timedelta
19
+ from .reader import read_itl
20
+
21
+ DEFAULT_TEMPLATE = Path(__file__).parent / 'timeline.xltm'
22
+
23
+ BINNING = {
24
+ '1': 'No Binning',
25
+ '2': 'Binning x2',
26
+ '4': 'Binning x4',
27
+ }
28
+
29
+ ITL_MAPPING = {
30
+ 'OBS_NAME': ('OBS_NAME', str),
31
+ 'start_angle': ('START_ANGLE', float), # °
32
+ 'start_scan_speed': ('START_SCAN_SPEED', float), # °/s
33
+ 'stop_scan_speed': ('STOP_SCAN_SPEED', float), # °/s
34
+ 'Scanner step per frame': ('SYNCHRONOUS', float), # (-3, 0, 3)
35
+ 'stop_angle': ('STOP_ANGLE', float), # °
36
+ 'First CU_frame start (UTC)': ('t_start', fmt_datetime), # YYYY-MM-DDThh:mm:ss.ms
37
+ 'Last CU_frame stop (UTC)': ('t_end', fmt_datetime), # YYYY-MM-DDThh:mm:ss.ms
38
+ 'cu_trep_ms': ('CU_TREP', lambda s: int(s.replace('ms', ''))), # ms
39
+ 'spatial_binning': ('BINNING', lambda i: BINNING[i]),
40
+ 'nb_cu_frames_tot': ('CU_FRAME', int),
41
+ 'ppe': ('PPE', int),
42
+ 'Start Row VI': ('START_ROW_VIS', int),
43
+ 'prime': ('PRIME', lambda b: 'MAJIS' if b else 'other'),
44
+ 'Comments': ('COMMENTS', lambda s: s if s else None),
45
+ 'ITL name': ('ITL', lambda p: Path(p).name if p else None),
46
+ }
47
+
48
+ ChangeLog = namedtuple('Log', 'version,date,author,change')
49
+
50
+
51
+ class TimelineChangeLog:
52
+ """MAJIS timeline change log."""
53
+
54
+ def __init__(self, template: Workbook, sheet_name='change log'):
55
+ self.log = self.read_changelog(list(template[sheet_name])[1:])
56
+
57
+ def __str__(self):
58
+ return '\n\n'.join(
59
+ f'>>> {str(log.version):>6} | {log.date} | {log.author}\n{log.change}'
60
+ for log in self.log
61
+ )
62
+
63
+ def __repr__(self):
64
+ return str(self)
65
+
66
+ def __getitem__(self, i):
67
+ return self.log[i]
68
+
69
+ def __iter__(self):
70
+ return iter(self.log)
71
+
72
+ def _repr_html_(self):
73
+ return table(self.log, header=['Version', 'Date', 'Author', 'Changes'])
74
+
75
+ def read_changelog(self, rows: list) -> (list, list):
76
+ """Read changelog changes grouped by version, date and author."""
77
+ log = defaultdict(list)
78
+
79
+ # Group release changes
80
+ key = None, None, None
81
+ for row in rows:
82
+ version, date, change, author = (cell.value for cell in row[:4])
83
+
84
+ if change and change != '…':
85
+ key = (
86
+ Version(str(version)) if version else key[0],
87
+ str(date.date()) if date else key[1],
88
+ str(author) if author else key[2],
89
+ )
90
+
91
+ log[key].extend(change.splitlines())
92
+
93
+ # Reverse changes order (latest first) and add line returns between changes
94
+ return [ChangeLog(*key, '\n'.join(log[key])) for key in reversed(log)]
95
+
96
+
97
+ class Timeline:
98
+ """MAJIS timeline from template.
99
+
100
+ You can either append an existing timeline template
101
+ or use the default one.
102
+
103
+ Warning
104
+ -------
105
+ Some extensions (`Data Validation`) are not included
106
+ into the exported file. This is a openpyxl limitation.
107
+
108
+ """
109
+
110
+ sheet_name = 'Timeline'
111
+
112
+ def __init__(
113
+ self,
114
+ observations: str | Path | EventsList | EventsDict | None = None,
115
+ timeline: str | Path | None = None,
116
+ ca_ref: str | dict | None = None,
117
+ refs: dict | str | list | None = None,
118
+ ):
119
+ self.fname = Path(timeline) if timeline else DEFAULT_TEMPLATE
120
+ self._load_data()
121
+
122
+ # Set global reference time w.r.t. C/A
123
+ self.ca_ref = ca_ref
124
+
125
+ if observations:
126
+ self.append(observations, refs=refs)
127
+
128
+ def __repr__(self):
129
+ return f"{self.__class__.__name__}('{self.fname}')"
130
+
131
+ def __len__(self) -> int:
132
+ return len(
133
+ [
134
+ obs
135
+ for obs in self._timeline[self.fields['OBS_NAME']][self.header :]
136
+ if obs.value
137
+ ]
138
+ )
139
+
140
+ def __getitem__(self, item: str | int | tuple) -> list | dict | str | int | float:
141
+ if isinstance(item, str):
142
+ if item in self.fields:
143
+ return [
144
+ col.value
145
+ for col in self._timeline[self.fields[item]][
146
+ self.header : self.header + len(self)
147
+ ]
148
+ ]
149
+ raise KeyError(f'Unknown `{item}` key')
150
+
151
+ if isinstance(item, int):
152
+ if 1 <= item <= len(self):
153
+ return {
154
+ key: cell.value
155
+ for key, cell in zip(
156
+ self.fields, self._timeline[self.header + item], strict=True
157
+ )
158
+ if cell.value and not str(cell.value).startswith('=')
159
+ }
160
+ raise IndexError(f'Invalid index: {item} not between 1 and {len(self)}')
161
+
162
+ if isinstance(item, tuple):
163
+ name, i = item
164
+ return self[name][i - 1]
165
+
166
+ raise TypeError(
167
+ f'Only `str`, `int` or `str, int` are accepted (`{type(item).__name__}` provided)'
168
+ )
169
+
170
+ def __setitem__(self, item: (str, int), value: str | int | float) -> None:
171
+ name, i = item
172
+ self._timeline[self.fields[name] + str(i + self.header)] = value
173
+
174
+ def _repr_html_(self):
175
+ return table(
176
+ [
177
+ [cell.value for cell in row]
178
+ for row in self._timeline[f'{self.header + 1}:{self.header + len(self)}']
179
+ ],
180
+ header=list(self.fields),
181
+ )
182
+
183
+ def _load_data(self) -> None:
184
+ """Load timeline data."""
185
+ # Disable openpyxl warning about unsupported extension (`Data validation`)
186
+ with warnings.catch_warnings():
187
+ warnings.simplefilter('ignore')
188
+ self._template = load_workbook(self.fname, keep_vba=True)
189
+
190
+ # Load Timeline spreadsheet
191
+ self._timeline = self._template[self.sheet_name]
192
+
193
+ # Load Timeline header fields mapping
194
+ self.fields = {cell.value: cell.column_letter for cell in self._timeline[1]}
195
+
196
+ # Load template changelog
197
+ if 'template change log' in self._template.sheetnames:
198
+ sheet_name = 'template change log'
199
+ else:
200
+ sheet_name = 'change log'
201
+
202
+ self.log = TimelineChangeLog(self._template, sheet_name=sheet_name)
203
+
204
+ @property
205
+ def version(self):
206
+ """Template version from changelog."""
207
+ return self.log[0].version
208
+
209
+ @property
210
+ def header(self):
211
+ """Timeline header size."""
212
+ return 2 if self.version < Version('2.0') else 3
213
+
214
+ def append(
215
+ self,
216
+ observations: str | Path | EventsList | EventsDict,
217
+ refs: dict | str | list | None = None,
218
+ ) -> None:
219
+ """Append ITL observations blocks."""
220
+ if isinstance(observations, str | Path):
221
+ observations = read_itl(observations, refs=refs)
222
+
223
+ for i, obs in enumerate(flatten(observations), start=len(self) + 1):
224
+ # Required fields
225
+ for field, (key, fmt) in ITL_MAPPING.items():
226
+ self[field, i] = fmt(obs[key])
227
+
228
+ # Additional fields
229
+ self['Mirror Flag', i] = (
230
+ 'ENABLE'
231
+ if float(obs['START_SCAN_SPEED']) or float(obs['STOP_SCAN_SPEED'])
232
+ else 'DISABLE'
233
+ )
234
+
235
+ self['First CU_frame start wrt C/A', i] = self._fmt_timedelta(obs.start)
236
+ self['Last CU_frame stop wrt C/A', i] = self._fmt_timedelta(obs.stop)
237
+
238
+ @property
239
+ def ca_ref(self) -> datetime:
240
+ """C/A reference for relative time."""
241
+ return self._ca_ref
242
+
243
+ @ca_ref.setter
244
+ def ca_ref(self, ca_ref):
245
+ """Set relative time w.r.t. C/A reference.
246
+
247
+ Warning
248
+ -------
249
+ All the previous relative values will be recomputed if this value is changed.
250
+
251
+ """
252
+ if ca_ref:
253
+ _, self._ca_ref = ref_key(ca_ref)
254
+
255
+ # Recompute relative values for all observation w.r.t. C/A reference
256
+ for i in range(1, len(self) + 1):
257
+ self['First CU_frame start wrt C/A', i] = self._fmt_timedelta(
258
+ self['First CU_frame start (UTC)', i]
259
+ )
260
+ self['Last CU_frame stop wrt C/A', i] = self._fmt_timedelta(
261
+ self['Last CU_frame stop (UTC)', i]
262
+ )
263
+ else:
264
+ self._ca_ref = None
265
+
266
+ def _fmt_timedelta(self, t: str | datetime64) -> str | None:
267
+ """Compute relative time w.r.t. C/A reference."""
268
+ return fmt_timedelta(datetime(t) - self.ca_ref) if self.ca_ref else None
269
+
270
+ def save(self, fout: str | Path | None = None) -> Path:
271
+ """Save MAJIS timeline."""
272
+ if fout:
273
+ fout = Path(fout)
274
+ elif self.fname != DEFAULT_TEMPLATE:
275
+ fout = self.fname
276
+ else:
277
+ raise FileExistsError(
278
+ 'Can not overwrite default template. Please provide and export filename.'
279
+ )
280
+
281
+ self._template.save(fout)
282
+
283
+ return fout
284
+
285
+ @property
286
+ def science(self) -> TimelineChangeLog:
287
+ """Science change log.
288
+
289
+ Raises
290
+ ------
291
+ ValueError:
292
+ Only available for template ≥ 2.0
293
+
294
+ """
295
+ if self.version < Version('2.0'):
296
+ raise ValueError(
297
+ f'Science changelog is only available in template ≥ 2.0 (current: `{self.version}`)'
298
+ )
299
+
300
+ return TimelineChangeLog(self._template, sheet_name='science change log')
Binary file
majis/misc/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ """MAJIS miscellaneous submodule."""
2
+
3
+ from .csv import fmt_csv
4
+ from .evf import read_evf
5
+ from .time import fmt_datetime, get_datetime
6
+
7
+ __all__ = [
8
+ 'read_evf',
9
+ 'get_datetime',
10
+ 'fmt_datetime',
11
+ 'fmt_csv',
12
+ ]
majis/misc/csv.py ADDED
@@ -0,0 +1,110 @@
1
+ """CSV miscellaneous module."""
2
+
3
+ from planetary_coverage.events import Event, EventsDict, EventsList, EventWindow
4
+
5
+ from .time import fmt_datetime
6
+
7
+ CSV_TIME_REL_KEYS = {
8
+ 't_start': ['OBS_START', 'OBS_START_REL'],
9
+ 't_end': ['OBS_END', 'OBS_END_REL'],
10
+ }
11
+
12
+
13
+ def get_header(
14
+ blocks: list[list | dict] | EventsList | EventsDict,
15
+ ref: str | dict | None = None,
16
+ ) -> list:
17
+ """Get CSV header.
18
+
19
+ The keys are unique and ordered with the following rules:
20
+
21
+ - If `OBS_NAME` is present, it will be placed first.
22
+
23
+ - `t_start` and `t_end` are required and replaced by `OBS_START`
24
+ and `OBS_END` and placed after `OBS_NAME` (if present).
25
+
26
+ - if `ref` time is provided `OBS_START_REL` and `OBS_END_REL`
27
+ are appended after `OBS_START` and `OBS_END`.
28
+
29
+ - `COMMENTS` is present, it will always put last.
30
+
31
+ """
32
+ keys = dict.fromkeys(key for block in blocks for key in block)
33
+
34
+ first, last = [], []
35
+ if 'OBS_NAME' in keys:
36
+ keys.pop('OBS_NAME')
37
+ first.append('OBS_NAME')
38
+
39
+ if 't_start' in keys:
40
+ keys.pop('t_start')
41
+ first.append('OBS_START')
42
+ else:
43
+ raise KeyError('Missing `t_start` keyword.')
44
+
45
+ if 't_end' in keys:
46
+ keys.pop('t_end')
47
+ first.append('OBS_END')
48
+ else:
49
+ raise KeyError('Missing `t_end` keyword.')
50
+
51
+ if ref:
52
+ first.append('OBS_START_REL')
53
+ first.append('OBS_END_REL')
54
+
55
+ if 'COMMENTS' in keys:
56
+ keys.pop('COMMENTS')
57
+ last.append('COMMENTS')
58
+
59
+ return first + list(keys) + last
60
+
61
+
62
+ def get_value(
63
+ block: dict | Event | EventWindow,
64
+ key: str,
65
+ ref: str | None = None,
66
+ ) -> str:
67
+ """Format block value.
68
+
69
+ This method extract the block value for a given property
70
+ and re-format the datetime if necessary.
71
+
72
+ Comments values are escaped with double quotes (`"..."`).
73
+
74
+ """
75
+ if key == 'OBS_START':
76
+ return fmt_datetime(block['t_start'])
77
+
78
+ if key in ['OBS_START', 'OBS_END']:
79
+ return fmt_datetime(block['t_end'])
80
+
81
+ if key == 'OBS_START_REL' and ref:
82
+ return fmt_datetime(block['t_start'], ref=ref)
83
+
84
+ if key == 'OBS_END_REL' and ref:
85
+ return fmt_datetime(block['t_end'], ref=ref)
86
+
87
+ value = str(block.get(key, ''))
88
+
89
+ if key == 'COMMENTS':
90
+ return f'"{value}"'
91
+
92
+ return value
93
+
94
+
95
+ def fmt_csv(
96
+ blocks: dict | EventsList | EventsDict,
97
+ ref: str | None = None,
98
+ sep: str = ';',
99
+ ) -> str:
100
+ """Format CSV format."""
101
+ # Get unique header keys (ordered)
102
+ header = get_header(blocks, ref=ref)
103
+
104
+ # Create rows values with separator
105
+ rows = [
106
+ sep.join(get_value(block, key, ref=ref) for key in header) for block in blocks
107
+ ]
108
+
109
+ # Merge header and rows
110
+ return ['#' + sep.join(header)] + rows
majis/misc/events.py ADDED
@@ -0,0 +1,67 @@
1
+ """Events module."""
2
+
3
+ from operator import attrgetter
4
+
5
+ from planetary_coverage.events.event import (
6
+ AbstractEvent,
7
+ EventsDict,
8
+ EventsList,
9
+ )
10
+
11
+
12
+ def flatten(events: tuple | list | EventsList | EventsDict | AbstractEvent) -> EventsList:
13
+ """Flatten multi events object."""
14
+ if isinstance(events, tuple | list | EventsList | EventsDict):
15
+ return EventsList(
16
+ sorted(
17
+ [
18
+ ev
19
+ for event in events
20
+ for ev in (
21
+ flatten(event)
22
+ if isinstance(event, EventsList | EventsDict)
23
+ else [event]
24
+ )
25
+ ],
26
+ key=attrgetter('start'),
27
+ )
28
+ )
29
+
30
+ if isinstance(events, AbstractEvent):
31
+ return EventsList([events])
32
+
33
+ raise TypeError(f'Invalid events type: `{type(events)}`')
34
+
35
+
36
+ def group(events: tuple | list | EventsList | EventsDict) -> EventsDict:
37
+ """Group events by observation name."""
38
+ if isinstance(events, tuple | list | EventsList):
39
+ return EventsDict(events)
40
+
41
+ if isinstance(events, EventsDict):
42
+ return events
43
+
44
+ raise TypeError(f'Invalid events type: `{type(events)}`')
45
+
46
+
47
+ def concatenate(
48
+ *events: EventsList | EventsDict, flat: bool = False, overlap: bool = False
49
+ ) -> EventsList | EventsDict:
50
+ """Concatenate ITL events.
51
+
52
+ Note
53
+ ----
54
+ By default, concatenated blocks must not overlap
55
+ each other. This can be disable with `overlap=True`.
56
+
57
+ """
58
+ blocks = flatten(events)
59
+
60
+ if blocks and not overlap:
61
+ previous = blocks[0]
62
+ for block in blocks[1:]:
63
+ if block.start < previous.stop:
64
+ raise ValueError(f'Overlap between `{previous}` and `{block}`')
65
+ previous = block
66
+
67
+ return blocks if flat else group(blocks)
majis/misc/evf.py ADDED
@@ -0,0 +1,56 @@
1
+ """Event file miscellaneous module."""
2
+
3
+ import re
4
+ from pathlib import Path
5
+
6
+ from planetary_coverage import datetime
7
+
8
+ # EVF key pattern: REF_NAME (COUNT = N)
9
+ EVF_KEY = r'(?P<ref>\w+)\s*\(COUNT\s*=\s*(?P<count>\d+)\)'
10
+
11
+
12
+ def ref_count(key: str) -> tuple[str, int]:
13
+ """Extract reference name and count from EVF key."""
14
+ if match := re.match(EVF_KEY, key):
15
+ return match.group('ref').upper(), int(match.group('count'))
16
+
17
+ raise KeyError(f'Invalid EVF key pattern: `{key}`. Should be `REF_NAME (COUNT = N)`')
18
+
19
+
20
+ def read_evf(fname: Path | str | list | None, comment: str = '#') -> dict | None:
21
+ """Read and extract EVF references and times."""
22
+ if fname is None:
23
+ return None
24
+
25
+ if str(fname).endswith('.evf'):
26
+ lines = Path(fname).read_text().splitlines()
27
+ elif isinstance(fname, list):
28
+ lines = fname
29
+ else:
30
+ lines = fname.splitlines()
31
+
32
+ refs = {}
33
+ for line in lines:
34
+ if not line.startswith(comment) and (line_strip := line.strip()):
35
+ dt, key = line_strip.split(maxsplit=1)
36
+ refs[ref_count(key)] = datetime(dt)
37
+
38
+ return refs
39
+
40
+
41
+ def ref_key(ref: str | dict | tuple) -> tuple[str, datetime]:
42
+ """Format relative datetime reference key."""
43
+ if isinstance(ref, tuple):
44
+ key, t_ref = ref
45
+
46
+ else:
47
+ if not isinstance(ref, dict):
48
+ ref = read_evf(ref)
49
+
50
+ if len(ref) > 1:
51
+ raise ValueError(f'Only 1 reference could be provided, not {len(ref)}')
52
+
53
+ (ref, count), t_ref = list(ref.items())[0]
54
+ key = f'{ref} (COUNT = {count})'
55
+
56
+ return key, t_ref
majis/misc/time.py ADDED
@@ -0,0 +1,79 @@
1
+ """Time miscellaneous module."""
2
+
3
+ import re
4
+
5
+ from numpy import datetime64, timedelta64
6
+
7
+ from planetary_coverage import datetime
8
+
9
+ from .evf import EVF_KEY, read_evf, ref_key
10
+
11
+ # Timedelta pattern: 'EVENT_NAME (COUNT = N) [-+][JJJ.]HH:MM:SS[.MS]'
12
+ EVF_TD = (
13
+ r'^' + EVF_KEY + r'\s+'
14
+ r'(?P<sign>[+-])?'
15
+ r'(?:(?P<day>\d+)\.)?'
16
+ r'(?P<h>\d{2})'
17
+ r':'
18
+ r'(?P<m>\d{2})'
19
+ r':'
20
+ r'(?P<s>\d{2})'
21
+ r'(?:\.(?P<ms>\d+))?'
22
+ )
23
+
24
+
25
+ def get_datetime(time: str, refs: dict | str | list | None = None) -> datetime64:
26
+ """Datetime getter."""
27
+ if match := re.match(EVF_TD, time):
28
+ ref, count, sign, d, h, m, s, ms = match.groups()
29
+
30
+ # Extract reference absolute time
31
+ if refs and not isinstance(refs, dict):
32
+ refs = read_evf(refs)
33
+
34
+ if not refs or (key := (ref.upper(), int(count))) not in refs:
35
+ raise KeyError(f'Unknown time reference: `{ref} (COUNT = {count})`')
36
+
37
+ # Compute time delta to reference
38
+ t_delta = (-1 if sign == '-' else 1) * (
39
+ timedelta64(int(d) if d else 0, 'D')
40
+ + timedelta64(int(h), 'h')
41
+ + timedelta64(int(m), 'm')
42
+ + timedelta64(int(s), 's')
43
+ + (timedelta64(int(1_000 * float(f'0.{ms}')), 'ms') if ms else 0)
44
+ )
45
+ return refs[key] + t_delta
46
+
47
+ t, *_ = str(time).strip().split()
48
+ return datetime(t)
49
+
50
+
51
+ def fmt_datetime(
52
+ *times: str | datetime64, ref: str | dict | tuple | None = None
53
+ ) -> str | list[str]:
54
+ """Format relative datetime for a time or a list of times."""
55
+ if ref is not None:
56
+ key, t_ref = ref_key(ref)
57
+
58
+ t = [f'{key} {fmt_timedelta(datetime(t) - t_ref)}' for t in times]
59
+
60
+ else:
61
+ t = [
62
+ datetime(t).item().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z' for t in times
63
+ ]
64
+
65
+ return t if len(times) > 1 else t[0]
66
+
67
+
68
+ def fmt_timedelta(dt: timedelta64) -> str:
69
+ """Format time delta."""
70
+ t = abs(dt.item())
71
+ h, r = divmod(t.seconds, 3600)
72
+ m, s = divmod(r, 60)
73
+
74
+ out = '-' if dt < 0 else '+'
75
+ out += f'{t.days:03d}.'
76
+ out += f'{h:02d}:{m:02d}:{s:02d}'
77
+ out += f'.{t.microseconds // 1_000:03d}'
78
+
79
+ return out
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.3
2
+ Name: majis-ops
3
+ Version: 1.0.0
4
+ Summary: Juice/MAJIS operations toolbox
5
+ Project-URL: Source, https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox
6
+ Project-URL: Issues, https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/-/issues
7
+ Project-URL: Documentation, https://majis-ops.readthedocs.io/en/latest/
8
+ Author-email: Benoît Seignovert <benoit.seignovert@univ-nantes.fr>, Axelle Gottafray <quentin.gottafray@ias.u-psud.fr>
9
+ Maintainer-email: Benoît Seignovert <benoit.seignovert@univ-nantes.fr>
10
+ License-Expression: BSD-3-Clause
11
+ License-File: LICENSE.md
12
+ Keywords: esa,ias,juice,majis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: numpy>=1.26
20
+ Requires-Dist: openpyxl>=3.1.3
21
+ Requires-Dist: packaging>=24
22
+ Requires-Dist: planetary-coverage>=1.1
23
+ Description-Content-Type: text/markdown
24
+
25
+ MAJIS Operations Toolbox
26
+ ========================
27
+
28
+ <img src="https://majis-ops.readthedocs.io/en/latest/_images/logo-square.svg" align="right" hspace="50" vspace="50" height="200" alt="Majis operations toolbox logo">
29
+
30
+ [![Pipeline Status](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/badges/main/pipeline.svg)](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/pipelines/main/latest)
31
+ [![Test coverage](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/badges/main/coverage.svg)](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/pipelines/main/latest)
32
+ [![Documentation Status](https://readthedocs.org/projects/majis-ops/badge/?version=latest)](https://app.readthedocs.org/projects/majis-ops/builds/?version=latest)
33
+ [![Latest release](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/-/badges/release.svg)](https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox/-/releases)
34
+
35
+
36
+ This toolbox aims to collect MAJIS Operations scripts in a common python package.
37
+
38
+ The full documentation of the package can be found in [majis-ops.readthedocs.io](https://majis-ops.readthedocs.io)
39
+
40
+ 🚀 Installation
41
+ ---------------
42
+ ```bash
43
+ python -m pip install majis-ops
44
+ ```
45
+
46
+ 🛰️ Basic examples
47
+ -----------------
48
+ ### 🐍 As python package
49
+ - Read a ITL file:
50
+ ```python
51
+ from majis.itl import read_itl
52
+
53
+ # Load absolute time ITL as EventsDict object
54
+ itl_abs = read_itl('absolute_time.itl')
55
+
56
+ # Load relative time ITL as EventsList object
57
+ itl_rel = read_itl('relative_time.itl', refs='events.evf', flat=True)
58
+ ```
59
+ __Note:__ Relative datetime can be provided either with a EVF file or inline with one or multiple strings: `DATETIME REF_NAME (COUNT = N)`
60
+
61
+ - Export one (or multiple) ITL blocks:
62
+ ```python
63
+ from majis.itl import save_itl, save_csv, save_xlsm
64
+
65
+ # Export as absolute ITL
66
+ save_itl('output.itl', itl_abs, itl_rel, …)
67
+
68
+ # Export as relative ITL
69
+ save_itl('output.itl', itl_abs, itl_rel, …, ref='DATETIME REF_NAME (COUNT = N)')
70
+
71
+ # Export as CSV
72
+ save_csv('output.csv', itl_abs, itl_rel, …)
73
+
74
+ # Export as XLSM timeline w.r.t. C/A reference (based on default template)
75
+ save_xlsm('output.xlsm', itl_abs, ca_ref='DATETIME REF_CA (COUNT = N)')
76
+
77
+ # Append to an existing XLSM timeline
78
+ save_xlsm(None, itl_abs, timeline='timeline.xlsm')
79
+ ```
80
+ __Notes:__
81
+ - When multiple ITL are provided, they will be concatenate and ordered by date.
82
+ - Absolute and relative ITL are compatible.
83
+ - Export can be either absolute or relative to a reference.
84
+ - Observation block must not overlap.
85
+
86
+ - Manipulate MAJIS timeline (`.xlsm` file):
87
+ ```python
88
+ >>> from majis import Timeline
89
+
90
+ >>> timeline = Timeline(timeline='timeline.xlsm')
91
+
92
+ # Get template version
93
+ >>> template.version
94
+ <Version('2.0')>
95
+
96
+ # Get template changelog
97
+ >>> template.log
98
+ '>>> 2.0 | 2024-06-04 | Vincent Carlier'
99
+ 'Empty template with 500 lines pre-filled with formulas and data validation format'
100
+ '...'
101
+ '>>> 1.0 | 2022-11-08 | François Poulet'
102
+ 'creation'
103
+
104
+ # Get science changelog
105
+ >>> template.science
106
+ '' # Empty by default
107
+
108
+ # Get the number of observations
109
+ >>> len(timeline)
110
+ 10
111
+
112
+ # Get the list of observations
113
+ >>> timeline['OBS_NAME']
114
+ ['OBS_001', ...]
115
+
116
+ # Get an observation details
117
+ >>> timeline[1]
118
+ {'OBS_NAME': 'OBS_001', 'start_angle': 1.5, ...}
119
+
120
+ # Get an observation property
121
+ >>> timeline['start_angle', 1]
122
+ 1.5
123
+
124
+ # Append new observations from ITL file
125
+ >>> timeline.append('absolute_time.itl')
126
+
127
+ # Edit a single field
128
+ >>> timeline['start_angle', 1] = -1.5
129
+ >>> timeline['start_angle', 1]
130
+ -1.5
131
+
132
+ # Save to the same XLSM timeline
133
+ >>> timeline.save()
134
+
135
+ # Create a new timeline from the default template and a relative ITL file
136
+ >>> timeline = Timeline('relative_time.itl', refs='events.evf')
137
+
138
+ # Compute all relative time w.r.t. to a C/A reference
139
+ >>> timeline.ca_ref = '2032-09-24T21:33:36 PERIJOVE_12PJ (COUNT = 1)'
140
+ >>> timeline['First CU_frame start wrt C/A', 1]
141
+ '-001.18:35:25'
142
+
143
+ # Export the timeline to a new file
144
+ >>> timeline.save('new_timeline.xlsm')
145
+ ```
146
+
147
+ ### 👾 As command line interface
148
+ ```bash
149
+ $ majis-itl --help
150
+
151
+ usage: majis-itl [-h] [-o output.[itl|csv|xlsm]] [-f]
152
+ [-t "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"]
153
+ [-r "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"]
154
+ [--timeline timeline.xlsm] [--header "# my-custom-header"]
155
+ [--overlap] [--csv] [--csv-sep separator]
156
+ [input.itl ...]
157
+
158
+ MAJIS ITL toolbox
159
+
160
+ positional arguments:
161
+ input.itl Input ITL filename(s). If multiple files are provided
162
+ they will be concatenated.
163
+
164
+ options:
165
+ -h, --help show this help message and exit
166
+ -o output.[itl|csv|xlsm], --output output.[itl|csv|xlsm]
167
+ Output filename, it could be either ITL, CSV or XLSM.
168
+ If none provided, the results will be displayed (only
169
+ for ITL and CSV).
170
+ -f, --force Overwrite the output file if already exists.
171
+ -t "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)", --time-ref "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"
172
+ Input events time reference(s). If multiple values are
173
+ required use an `events.evf` file.
174
+ -r "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)", --relative-to "YYYY-MM-DDTHH:MM:SS REF_NAME (COUNT = N)"
175
+ Reference time to be used for relative time output.
176
+ --timeline timeline.xlsm
177
+ Original timeline to append. If no explicit `--output`
178
+ is provided new observations will be append in this
179
+ file.
180
+ --header "# my-custom-header"
181
+ ITL custom file header.
182
+ --overlap Allow blocks overlap.
183
+ --csv Display the ITL as CSV.
184
+ --csv-sep separator CSV separator (default: ";")
185
+ ```
186
+
187
+ _Examples:_
188
+ - Convert a single ITL with relative time as an absolute CSV ITL file:
189
+ ```bash
190
+ majis-itl relative_time.itl --time-ref "2032-09-24T21:33:36 PERIJOVE_12PJ (COUNT = 1)" --output output.csv
191
+ ```
192
+
193
+ - Concatenate two ITL with absolute and relative times as an relative ITL file:
194
+ ```bash
195
+ majis-itl absolute_time.itl relative_time.itl --ref-time events.evf --relative-to "2032-09-24T21:33:36 PERIJOVE_12PJ (COUNT = 1)" --output output.itl
196
+ ```
197
+
198
+ __Note:__ If no `--output` flag is present, the output is display in the console.
199
+
200
+ - Create a new MAJIS timeline (`.xlsm`) from a ITL the default template.
201
+ ```bash
202
+ majis-itl absolute_time.itl --output output.xlsm
203
+ ```
204
+
205
+ - Edit an existing MAJIS timeline to compute relative time w.r.t. C/A reference.
206
+ ```bash
207
+ majis-itl --timeline timeline.xlsm --relative-to "2032-09-24T21:33:36 PERIJOVE_12PJ (COUNT = 1)"
208
+ ```
209
+
210
+ __Note:__ If no `--output` flag is present, the output will be save in the original template.
211
+
212
+
213
+ 👐 Contribution
214
+ ---------------
215
+ If you want to contribute to this project, you need to install [`hatch`](https://hatch.pypa.io/latest/install/) on your system, then clone the depot and install de default env:
216
+ ```bash
217
+ git clone https://git.ias.u-psud.fr/majis_sgs/operations/majis-ops-toolbox.git
218
+ cd majis-ops-toolbox
219
+
220
+ # Install dev dependencies
221
+ hatch env create
222
+
223
+ # Setup pre-commit hook
224
+ hatch -e linter run pre-commit install
225
+ ```
226
+
227
+ To lint and format the source code:
228
+
229
+ ```bash
230
+ hatch -e linter run check
231
+ hatch -e linter run format
232
+ ```
233
+
234
+ To test the module:
235
+ ```bash
236
+ hatch -e tests run tests
237
+ ```
238
+
239
+ To build the docs:
240
+ ```bash
241
+ hatch -e docs run build
242
+ ```
@@ -0,0 +1,18 @@
1
+ majis/__init__.py,sha256=LCGLbjrJOLEANMlWLTYPNV4Z7fdEhJ69d1Z4AinR9dI,171
2
+ majis/__version__.py,sha256=yI_5D8eFtN7JaVosj3_LBsJHSULKHKUSFAXjndz7Mkc,63
3
+ majis/itl/__init__.py,sha256=HTsY3G3qQPJfblTdDtGynKpg7qINO6L-ZDeTWiYuQJE,234
4
+ majis/itl/cli.py,sha256=Aiqw2RVeChJc2VUarTOFVJ2H5FO41HUANzDF5YIMypY,4184
5
+ majis/itl/export.py,sha256=-viRAwYG9X5_HpRALW_CkwbZFTLx4lFM8uWQiNRAYTc,2764
6
+ majis/itl/reader.py,sha256=qfJc2ZpQHs0FgS3-teidsXnfWUOdcb4AG32H5sM8UiA,2924
7
+ majis/itl/timeline.py,sha256=0fRV6O8FnlsMLhku320qdvsWUYvNSOzHUQD1aH6jVCw,9817
8
+ majis/itl/timeline.xltm,sha256=XrQSeHd7g6tNWqplI6kdc8DaoF7hFxBf5LmOacpntMM,198334
9
+ majis/misc/__init__.py,sha256=TUnOnzJhzAXAEY37n98cwzpk98MJPUU_nNPERuyNLz0,220
10
+ majis/misc/csv.py,sha256=LvtRCE51wGx_UspXicXIWDAdDvJOqZqUJfGjq1G_Qck,2748
11
+ majis/misc/events.py,sha256=knlH4PzvYqRmg0G1XBhif2hAAK7anVjdFUE1YYHXYi0,1859
12
+ majis/misc/evf.py,sha256=dUr3r2swYYEQwfiy8yH9LjYckivsdUbRdz6rPOSrXqE,1594
13
+ majis/misc/time.py,sha256=Z_Y_LlgfILb6xKWt1wrt2T4t-CIGODbrH65pcigw7nw,2165
14
+ majis_ops-1.0.0.dist-info/METADATA,sha256=zavzrkjFnWZ8LZ0hxeQs2KTR0X5uiurzJfWe6q-aQdU,8476
15
+ majis_ops-1.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
16
+ majis_ops-1.0.0.dist-info/entry_points.txt,sha256=tXTL7tdKnhCChmF0F-aMZ41WxEzmSJgMKNyvHxa64Gg,48
17
+ majis_ops-1.0.0.dist-info/licenses/LICENSE.md,sha256=k27F9_LZqwQ6dSbbV-uCKeE-5oKLdKtc6DNEVNXrkss,1687
18
+ majis_ops-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.24.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ majis-itl = majis.itl.cli:cli
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Observatoire des Sciences de l'Univers Nantes Atlantique (Osuna), CNRS UAR-3281, Nantes Université; Institut d'Astrophysique Spatiale (IAS), CNRS UMR-8617, Université Paris Sud.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.