SimbioReader 0.6.7__tar.gz → 0.8.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SimbioReader
3
- Version: 0.6.7
3
+ Version: 0.8.0
4
4
  Summary: Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo
5
5
  License-File: LICENSE
6
6
  Keywords: data reader,Space Mission,BepiColombo,SIMBIO-SYS
@@ -23,7 +23,7 @@ Requires-Dist: update-checker (>=0.18.0,<0.19.0)
23
23
  Project-URL: Repository, https://github.com/SIMBIO-SYS/SimbioReader
24
24
  Description-Content-Type: text/markdown
25
25
 
26
- ![Version 0.6.7](https://img.shields.io/badge/version-0.6.7-blue?style=plastic)
26
+ ![Version 0.7.0](https://img.shields.io/badge/version-0.7.0-blue?style=plastic)
27
27
  ![Language Python 3.13](https://img.shields.io/badge/python-3.13-orange?style=plastic&logo=python)
28
28
  ![BepiColombo SIMBIO-SYS](https://img.shields.io/badge/BepiColombo-SIMBIO--SYS-blue?style=plastic)
29
29
  [![SimbioReader Test](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml/badge.svg)](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml)
@@ -57,9 +57,14 @@ The package contain a class that read and decode the SIMBIO-SYS image
57
57
  ```python
58
58
  from SimbioReader import SimbioReader as SR
59
59
 
60
- dat = SimbioReader("sim_raw_sc_vihi_internal_cruise_ico4_2020-12-14_001.dat")
60
+ dat = SR("sim_raw_sc_vihi_internal_cruise_ico4_2020-12-14_001.dat")
61
61
  ```
62
62
 
63
+ Filter display is guarded for product types that do not expose filter metadata,
64
+ so requesting filter output on those products no longer raises an attribute
65
+ error. See [`FLUSSO_DATI.md`](FLUSSO_DATI.md) for the reader's parsing and data
66
+ flow.
67
+
63
68
  ## Command line tools
64
69
 
65
70
  In the package are included two command line tools:
@@ -1,4 +1,4 @@
1
- ![Version 0.6.7](https://img.shields.io/badge/version-0.6.7-blue?style=plastic)
1
+ ![Version 0.7.0](https://img.shields.io/badge/version-0.7.0-blue?style=plastic)
2
2
  ![Language Python 3.13](https://img.shields.io/badge/python-3.13-orange?style=plastic&logo=python)
3
3
  ![BepiColombo SIMBIO-SYS](https://img.shields.io/badge/BepiColombo-SIMBIO--SYS-blue?style=plastic)
4
4
  [![SimbioReader Test](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml/badge.svg)](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml)
@@ -32,9 +32,14 @@ The package contain a class that read and decode the SIMBIO-SYS image
32
32
  ```python
33
33
  from SimbioReader import SimbioReader as SR
34
34
 
35
- dat = SimbioReader("sim_raw_sc_vihi_internal_cruise_ico4_2020-12-14_001.dat")
35
+ dat = SR("sim_raw_sc_vihi_internal_cruise_ico4_2020-12-14_001.dat")
36
36
  ```
37
37
 
38
+ Filter display is guarded for product types that do not expose filter metadata,
39
+ so requesting filter output on those products no longer raises an attribute
40
+ error. See [`FLUSSO_DATI.md`](FLUSSO_DATI.md) for the reader's parsing and data
41
+ flow.
42
+
38
43
  ## Command line tools
39
44
 
40
45
  In the package are included two command line tools:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "SimbioReader"
3
- version = "0.6.7"
3
+ version = "0.8.0"
4
4
  description="Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo"
5
5
  dependencies = [
6
6
 
@@ -1,6 +1,3 @@
1
- #! /usr/bin/env python3
2
-
3
-
4
1
  stcFilters={
5
2
  "panl":{
6
3
  "name" : "PAN-L",
@@ -89,75 +86,51 @@ stcFilters={
89
86
  }
90
87
  hricFilters={
91
88
  "fpan":{
92
- "name" : "PAN-L",
93
- "desc" : "Fraction of the CCD used by the PAN-L filter",
94
- "id" : "L_P700",
95
- "bandwidth" : "204.3",
96
- "centerFilter" : "699.5",
97
- "interframeDel": "0.8",
98
- "fistLine" : "1227",
99
- "firstSample" : "576",
100
- "line" : "384",
101
- "sample" : "896"
89
+ "name" : "FPAN",
90
+ "desc" : "Portion of CMOS with panchromatic filter",
91
+ "id" : "FPAN",
92
+ "bandwidth" : "504.9",
93
+ "centerFilter" : "652.3",
94
+ "interframeDel": "__",
95
+ "fistLine" : "938",
96
+ "firstSample" : "0",
97
+ "line" : "640",
98
+ "sample" : "2048"
102
99
  },
103
100
  "f550":{
104
- "name" : "F550-L",
105
- "desc" : "Fraction of the CCD used by the F550-L filter",
106
- "id" : "L_F550",
107
- "bandwidth" : "20",
108
- "centerFilter" : "550",
109
- "interframeDel": "0.8",
110
- "fistLine" : "1745",
111
- "firstSample" : "576",
112
- "line" : "64",
113
- "sample" : "896"
101
+ "name" : "F550",
102
+ "desc" : "Portion of CMOS with broadband F550 filter",
103
+ "id" : "F550",
104
+ "bandwidth" : "40.4",
105
+ "centerFilter" : "549.3",
106
+ "interframeDel": "__",
107
+ "fistLine" : "1662",
108
+ "firstSample" : "0",
109
+ "line" : "384",
110
+ "sample" : "2048"
114
111
  },
115
112
  "f750":{
116
- "name" : "F750-H",
117
- "desc" : "Fraction of the CCD used by the F880-H filter",
118
- "id" : "H_F420",
119
- "bandwidth" : "20",
120
- "centerFilter" : "420",
121
- "interframeDel": "0.8",
122
- "fistLine" : "240",
123
- "firstSample" : "576",
124
- "line" : "64",
125
- "sample" : "896"
126
- },
127
- "f880":{
128
- "name" : "F880-H",
129
- "desc" : "Fraction of the CCD used by the F880-H filter",
130
- "id" : "H_F750",
131
- "bandwidth" : "20",
132
- "centerFilter" : "750",
133
- "interframeDel": "0.8",
134
- "fistLine" : "32",
135
- "firstSample" : "576",
136
- "line" : "64",
137
- "sample" : "896"
138
- },
139
- "cust0":{
140
- "name" : "PAN-L - custom",
141
- "desc" : "Fraction of the CCD used by the PAN-L filter",
142
- "id" : "CUST-0",
143
- "bandwidth" : "204.3",
144
- "centerFilter" : "699.5",
145
- "interframeDel": "0.8",
146
- "fistLine" : "1227",
147
- "firstSample" : "576",
113
+ "name" : "F750",
114
+ "desc" : "Portion of CMOS with broadband F750 filter",
115
+ "id" : "F750",
116
+ "bandwidth" : "39.9",
117
+ "centerFilter" : "752.9",
118
+ "interframeDel": "__",
119
+ "fistLine" : "2",
120
+ "firstSample" : "0",
148
121
  "line" : "384",
149
- "sample" : "896"
122
+ "sample" : "2048"
150
123
  },
151
- "cust1":{
152
- "name" : "PAN-L - custom",
153
- "desc" : "Fraction of the CCD used by the PAN-L filter",
154
- "id" : "CUST-1",
155
- "bandwidth" : "204.3",
156
- "centerFilter" : "699.5",
157
- "interframeDel": "0.8",
158
- "fistLine" : "1227",
159
- "firstSample" : "576",
124
+ "f880":{
125
+ "name" : "F880",
126
+ "desc" : "Portion of CMOS with broadband F750 filter",
127
+ "id" : "F880",
128
+ "bandwidth" : "39.8",
129
+ "centerFilter" : "880.1",
130
+ "interframeDel": "__",
131
+ "fistLine" : "470",
132
+ "firstSample" : "0",
160
133
  "line" : "384",
161
- "sample" : "896"
134
+ "sample" : "2048"
162
135
  },
163
136
  }
@@ -0,0 +1,31 @@
1
+ phases = {
2
+ "necp": [
3
+ {
4
+ "start": "2018-12-10 00:00:00",
5
+ "end": "2018-12-12 23:59:59",
6
+ "LPName": "Near-Earth Commissioning Phase",
7
+ }
8
+ ],
9
+ "cruise": [
10
+ {
11
+ "start": "2018-12-13 00:00:00",
12
+ "end": "2025-01-08 02:59:00",
13
+ "LPName": "Cruise",
14
+ },
15
+ {
16
+ "start": "2025-01-08 06:15:01",
17
+ "end": "2030-04-08 04:00:00",
18
+ "LPName": "Cruise",
19
+ },
20
+ ],
21
+ "mga6": [
22
+ {
23
+ "start": "2025-01-08 03:00:00",
24
+ "end": "2025-01-08 06:15:00",
25
+ "LPName": "Mercury Gravity Assist 6",
26
+ }
27
+ ],
28
+ "None": [
29
+ {"start": "2030-04-08 04:00:01", "end": "2030-12-31 23:59:59", "LPName": "None"}
30
+ ],
31
+ }
@@ -36,9 +36,10 @@ class Phase:
36
36
  ValueError: If neither name nor dt is provided, or if no phase is found.
37
37
  """
38
38
  if name:
39
- phase_data = phases.get(name)
40
- if not phase_data:
39
+ intervals = phases.get(name)
40
+ if not intervals:
41
41
  raise ValueError(f"Phase '{name}' not found.")
42
+ phase_data = self._merge_intervals(name, intervals)
42
43
  elif dt:
43
44
  if isinstance(dt, str):
44
45
  dt = parse(dt,ignoretz=True)
@@ -47,27 +48,56 @@ class Phase:
47
48
  raise ValueError(f"No phase found for the given date. (dt: {dt})")
48
49
  else:
49
50
  raise ValueError("You must provide a phase name or a date.")
50
-
51
+
51
52
  self.name = phase_data["name"]
52
- self.start = parse(phase_data["start"],ignoretz=True)
53
- self.end = parse(phase_data["end"],ignoretz=True)
53
+ self.start = phase_data["start"]
54
+ self.end = phase_data["end"]
54
55
  self.extended_name = phase_data["LPName"]
55
56
 
57
+ @staticmethod
58
+ def _merge_intervals(name, intervals):
59
+ """
60
+ Combines every interval registered for a phase name into a single span,
61
+ since a phase name (e.g. "cruise") may now be split across several
62
+ non-contiguous date intervals.
63
+
64
+ Args:
65
+ name (str): The name of the phase.
66
+ intervals (list[dict]): The list of intervals registered for that name.
67
+
68
+ Returns:
69
+ dict: Phase data with the earliest start and latest end of all intervals.
70
+ """
71
+ starts = [parse(interval["start"], ignoretz=True) for interval in intervals]
72
+ ends = [parse(interval["end"], ignoretz=True) for interval in intervals]
73
+ return {
74
+ "name": name,
75
+ "start": min(starts),
76
+ "end": max(ends),
77
+ "LPName": intervals[0]["LPName"],
78
+ }
79
+
56
80
  def _find_phase_by_date(self, dt):
57
81
  """
58
- Finds a phase by a given date.
82
+ Finds the phase interval that contains a given date.
59
83
 
60
84
  Args:
61
85
  dt (datetime): The date to find the corresponding phase.
62
86
 
63
87
  Returns:
64
- dict | None: The phase data if found, otherwise None.
65
- """
66
- for phase_name, phase_data in phases.items():
67
- start = parse(phase_data["start"],ignoretz=True)
68
- end = parse(phase_data["end"],ignoretz=True)
69
- if start <= dt <= end:
70
- return phase_data
88
+ dict | None: The matching interval's phase data if found, otherwise None.
89
+ """
90
+ for phase_name, intervals in phases.items():
91
+ for interval in intervals:
92
+ start = parse(interval["start"],ignoretz=True)
93
+ end = parse(interval["end"],ignoretz=True)
94
+ if start <= dt <= end:
95
+ return {
96
+ "name": phase_name,
97
+ "start": start,
98
+ "end": end,
99
+ "LPName": interval["LPName"],
100
+ }
71
101
  return None
72
102
 
73
103
  def __str__(self)-> str:
@@ -100,12 +130,17 @@ class Phase:
100
130
  tb.add_column('Phase Name')
101
131
  tb.add_column('Start Time')
102
132
  tb.add_column('End Time')
103
- for phase_name, phase_data in phases.items():
104
- if phase_name == "None":
105
- continue
106
- tb.add_row(f"{phase_data['LPName']} ({phase_name})",
107
- parse(phase_data['start']).strftime(dateFormat),
108
- parse(phase_data['end']).strftime(dateFormat))
133
+ rows = [
134
+ (phase_name, interval)
135
+ for phase_name, intervals in phases.items()
136
+ if phase_name != "None"
137
+ for interval in intervals
138
+ ]
139
+ rows.sort(key=lambda row: parse(row[1]['start'], ignoretz=True))
140
+ for phase_name, interval in rows:
141
+ tb.add_row(f"{interval['LPName']} ({phase_name})",
142
+ parse(interval['start']).strftime(dateFormat),
143
+ parse(interval['end']).strftime(dateFormat))
109
144
  return tb
110
145
 
111
146
  def show(self):
@@ -750,7 +750,7 @@ class SimbioReader:
750
750
  disp = getattr(self.data, f"filter_{item.lower()}")
751
751
  columns.append(disp.data_structure.show(title=f"Data Structure Info - Filter {item.upper()}"))
752
752
 
753
- if filters:
753
+ if filters and hasattr(self.data, "filters"):
754
754
  for item in self.data.filters:
755
755
  disp = getattr(self.data, f"filter_{item.lower()}")
756
756
  columns.append(disp.show())
@@ -843,6 +843,13 @@ class SimbioReader:
843
843
  return disp
844
844
  return None
845
845
 
846
+ def get_filters(self) -> list:
847
+ filters = []
848
+ for item in self.data.filters:
849
+ disp = getattr(self.data, f"filter_{item.lower()}")
850
+ filters.append(disp)
851
+ return filters
852
+
846
853
  def get_segment_by_file(self, file_name: Path) -> SimbioObject | None:
847
854
  if isinstance(file_name, str):
848
855
  file_name = Path(file_name)
@@ -4,118 +4,146 @@ subphases = {
4
4
  "end": "2018-12-12 23:59:59",
5
5
  "name": "necp",
6
6
  "phase": "necp",
7
- "LPName": "Near-Earth Commissioning Phase"
7
+ "LPName": "Near-Earth Commissioning Phase",
8
8
  },
9
9
  "dnecp": {
10
10
  "start": "2019-06-06 00:00:00",
11
11
  "end": "2019-06-06 23:59:59",
12
12
  "name": "dnecp",
13
13
  "phase": "cruise",
14
- "LPName": "Delta Near-Earth Commissioning Phase"
14
+ "LPName": "Delta Near-Earth Commissioning Phase",
15
15
  },
16
16
  "ico1": {
17
17
  "start": "2019-06-07 00:00:00",
18
18
  "end": "2019-06-07 23:59:59",
19
19
  "name": "ico1",
20
20
  "phase": "cruise",
21
- "LPName": "Instrument Check-Out #1"
21
+ "LPName": "Instrument Check-Out #1",
22
22
  },
23
23
  "ico2": {
24
24
  "start": "2019-11-27 00:00:00",
25
25
  "end": "2019-11-27 23:59:59",
26
26
  "name": "ico2",
27
27
  "phase": "cruise",
28
- "LPName": "Instrument Check-Out #2"
28
+ "LPName": "Instrument Check-Out #2",
29
29
  },
30
30
  "ico3": {
31
31
  "start": "2020-06-24 00:00:00",
32
32
  "end": "2020-06-25 23:59:59",
33
33
  "name": "ico3",
34
34
  "phase": "cruise",
35
- "LPName": "Instrument Check-Out #3"
35
+ "LPName": "Instrument Check-Out #3",
36
36
  },
37
37
  "ico4": {
38
38
  "start": "2020-12-14 00:00:00",
39
39
  "end": "2020-12-15 23:00:00",
40
40
  "name": "ico4",
41
41
  "phase": "cruise",
42
- "LPName": "Instrument Check-Out #4"
42
+ "LPName": "Instrument Check-Out #4",
43
43
  },
44
44
  "ico4b": {
45
45
  "start": "2021-04-24 00:00:00",
46
46
  "end": "2021-04-25 00:00:00",
47
47
  "name": "ico4b",
48
48
  "phase": "cruise",
49
- "LPName": "Instrument Check-Out #4b"
49
+ "LPName": "Instrument Check-Out #4b",
50
50
  },
51
51
  "ico5": {
52
52
  "start": "2021-06-14 00:00:00",
53
53
  "end": "2021-06-15 00:00:00",
54
54
  "name": "ico5",
55
55
  "phase": "cruise",
56
- "LPName": "Instrument Check-Out #5"
56
+ "LPName": "Instrument Check-Out #5",
57
57
  },
58
58
  "ico6": {
59
59
  "start": "2021-11-21 00:00:00",
60
60
  "end": "2021-11-23 00:00:00",
61
61
  "name": "ico6",
62
62
  "phase": "cruise",
63
- "LPName": "Instrument Check-Out #6"
63
+ "LPName": "Instrument Check-Out #6",
64
64
  },
65
65
  "ico7": {
66
66
  "start": "2022-05-16 00:00:00",
67
67
  "end": "2022-05-16 03:00:00",
68
68
  "name": "ico7",
69
69
  "phase": "cruise",
70
- "LPName": "Instrument Check-Out #7"
70
+ "LPName": "Instrument Check-Out #7",
71
71
  },
72
72
  "ico8": {
73
73
  "start": "2022-11-06 23:00:00",
74
74
  "end": "2022-11-07 12:30:00",
75
75
  "name": "ico8",
76
76
  "phase": "cruise",
77
- "LPName": "Instrument Check-Out #8"
77
+ "LPName": "Instrument Check-Out #8",
78
78
  },
79
79
  "aswu": {
80
80
  "start": "2022-11-28 07:00:00",
81
81
  "end": "2022-11-28 14:00:00",
82
82
  "name": "aswu",
83
83
  "phase": "cruise",
84
- "LPName": "Application Software Update"
84
+ "LPName": "Application Software Update",
85
85
  },
86
86
  "ico9": {
87
87
  "start": "2023-05-23 07:50:00",
88
88
  "end": "2023-05-23 10:52:00",
89
89
  "name": "ico9",
90
90
  "phase": "cruise",
91
- "LPName": "Instrument Check-Out #9"
91
+ "LPName": "Instrument Check-Out #9",
92
92
  },
93
93
  "ssmm_load": {
94
94
  "start": "2023-05-30 11:00:00",
95
95
  "end": "2023-06-01 18:00:00",
96
96
  "name": "ssmm_load",
97
97
  "phase": "cruise",
98
- "LPName": "SSMM Load"
98
+ "LPName": "SSMM Load",
99
99
  },
100
100
  "ico10": {
101
101
  "start": "2023-11-05 23:30:00",
102
102
  "end": "2023-11-06 02:00:00",
103
103
  "name": "ico10",
104
104
  "phase": "cruise",
105
- "LPName": "Instrument Check-Out #10"
105
+ "LPName": "Instrument Check-Out #10",
106
106
  },
107
107
  "ico11": {
108
108
  "start": "2024-04-08 00:00:00",
109
109
  "end": "2024-04-08 04:00:00",
110
110
  "name": "ico11",
111
111
  "phase": "cruise",
112
- "LPName": "Instrument Check-Out #11"
112
+ "LPName": "Instrument Check-Out #11",
113
113
  },
114
+ "ico13": {
115
+ "start": "2025-04-07 00:00:00",
116
+ "end": "2025-04-07 06:00:00",
117
+ "name": "ico13",
118
+ "phase": "cruise",
119
+ "LPName": "Instrument Check-Out #13",
120
+ },
121
+ "msb6": {
122
+ "start": "2025-01-08 03:00:00",
123
+ "end": "2025-01-08 06:15:00",
124
+ "name": "msb6",
125
+ "phase": "cruise",
126
+ "LPName": "Mercury Swing-By Maneuver #6",
127
+ },
128
+ "ico14": {
129
+ "start": "2025-10-13 01:00:00",
130
+ "end": "2025-10-13 06:47:00",
131
+ "name": "ico14",
132
+ "phase": "cruise",
133
+ "LPName": "Instrument Check-Out #14",
134
+ },
135
+ "ico17": {
136
+ "start": "2026-09-15 07:00:00",
137
+ "end": "2026-09-16 09:00:00",
138
+ "name": "ico17",
139
+ "phase": "cruise",
140
+ "LPName": "Instrument Check-Out #17",
141
+ },
114
142
  "None": {
115
- "start": "2024-04-08 04:00:01",
143
+ "start": "2026-09-16 09:00:01",
116
144
  "end": "2028-12-31 23:59:59",
117
145
  "name": "None",
118
146
  "phase": "None",
119
- "LPName": "None"
120
- }
147
+ "LPName": "None",
148
+ },
121
149
  }