imap-processing 0.16.2__py3-none-any.whl → 0.18.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.
Potentially problematic release.
This version of imap-processing might be problematic. Click here for more details.
- imap_processing/_version.py +2 -2
- imap_processing/ccsds/excel_to_xtce.py +12 -0
- imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +6 -6
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +35 -0
- imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml +35 -0
- imap_processing/cdf/config/imap_codice_l2_variable_attrs.yaml +24 -0
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +8 -8
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +1 -1
- imap_processing/cdf/config/imap_hit_l1a_variable_attrs.yaml +163 -100
- imap_processing/cdf/config/imap_hit_l2_variable_attrs.yaml +398 -415
- imap_processing/cdf/config/imap_ialirt_l1_variable_attrs.yaml +97 -54
- imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +9 -9
- imap_processing/cdf/config/imap_idex_l2b_variable_attrs.yaml +233 -57
- imap_processing/cdf/config/imap_idex_l2c_variable_attrs.yaml +16 -90
- imap_processing/cdf/config/imap_lo_global_cdf_attrs.yaml +30 -0
- imap_processing/cdf/config/imap_mag_global_cdf_attrs.yaml +15 -1
- imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +19 -0
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +20 -0
- imap_processing/cdf/config/imap_swe_l2_variable_attrs.yaml +39 -0
- imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml +168 -0
- imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +103 -2
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +91 -11
- imap_processing/cdf/utils.py +7 -1
- imap_processing/cli.py +42 -13
- imap_processing/codice/codice_l1a.py +125 -78
- imap_processing/codice/codice_l1b.py +1 -1
- imap_processing/codice/codice_l2.py +0 -9
- imap_processing/codice/constants.py +481 -498
- imap_processing/hi/hi_l1a.py +4 -4
- imap_processing/hi/hi_l1b.py +2 -2
- imap_processing/hi/packet_definitions/TLM_HI_COMBINED_SCI.xml +218 -38
- imap_processing/hit/hit_utils.py +2 -2
- imap_processing/hit/l0/decom_hit.py +4 -3
- imap_processing/hit/l1a/hit_l1a.py +64 -24
- imap_processing/hit/l1b/constants.py +5 -0
- imap_processing/hit/l1b/hit_l1b.py +18 -16
- imap_processing/hit/l2/constants.py +1 -1
- imap_processing/hit/l2/hit_l2.py +4 -4
- imap_processing/ialirt/constants.py +21 -0
- imap_processing/ialirt/generate_coverage.py +188 -0
- imap_processing/ialirt/l0/parse_mag.py +62 -5
- imap_processing/ialirt/l0/process_swapi.py +1 -1
- imap_processing/ialirt/l0/process_swe.py +23 -7
- imap_processing/ialirt/utils/constants.py +22 -16
- imap_processing/ialirt/utils/create_xarray.py +42 -19
- imap_processing/idex/idex_constants.py +8 -5
- imap_processing/idex/idex_l2b.py +554 -58
- imap_processing/idex/idex_l2c.py +30 -196
- imap_processing/lo/l0/lo_apid.py +1 -0
- imap_processing/lo/l0/lo_star_sensor.py +48 -0
- imap_processing/lo/l1a/lo_l1a.py +74 -30
- imap_processing/lo/packet_definitions/lo_xtce.xml +5359 -106
- imap_processing/mag/constants.py +1 -0
- imap_processing/mag/l0/decom_mag.py +9 -6
- imap_processing/mag/l0/mag_l0_data.py +46 -0
- imap_processing/mag/l1d/__init__.py +0 -0
- imap_processing/mag/l1d/mag_l1d.py +133 -0
- imap_processing/mag/l1d/mag_l1d_data.py +588 -0
- imap_processing/mag/l2/__init__.py +0 -0
- imap_processing/mag/l2/mag_l2.py +25 -20
- imap_processing/mag/l2/mag_l2_data.py +191 -130
- imap_processing/quality_flags.py +20 -2
- imap_processing/spice/geometry.py +25 -3
- imap_processing/spice/pointing_frame.py +1 -1
- imap_processing/spice/spin.py +4 -0
- imap_processing/spice/time.py +51 -0
- imap_processing/swapi/l1/swapi_l1.py +12 -2
- imap_processing/swapi/l2/swapi_l2.py +59 -14
- imap_processing/swapi/swapi_utils.py +1 -1
- imap_processing/swe/l1b/swe_l1b.py +11 -4
- imap_processing/swe/l2/swe_l2.py +111 -17
- imap_processing/ultra/constants.py +49 -1
- imap_processing/ultra/l0/decom_tools.py +28 -14
- imap_processing/ultra/l0/decom_ultra.py +225 -15
- imap_processing/ultra/l0/ultra_utils.py +281 -8
- imap_processing/ultra/l1a/ultra_l1a.py +77 -8
- imap_processing/ultra/l1b/cullingmask.py +3 -3
- imap_processing/ultra/l1b/de.py +53 -15
- imap_processing/ultra/l1b/extendedspin.py +26 -2
- imap_processing/ultra/l1b/lookup_utils.py +171 -50
- imap_processing/ultra/l1b/quality_flag_filters.py +14 -0
- imap_processing/ultra/l1b/ultra_l1b_culling.py +198 -5
- imap_processing/ultra/l1b/ultra_l1b_extended.py +304 -66
- imap_processing/ultra/l1c/helio_pset.py +54 -7
- imap_processing/ultra/l1c/spacecraft_pset.py +9 -1
- imap_processing/ultra/l1c/ultra_l1c.py +2 -0
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +106 -109
- imap_processing/ultra/packet_definitions/ULTRA_SCI_COMBINED.xml +3 -3
- imap_processing/ultra/utils/ultra_l1_utils.py +13 -1
- imap_processing/utils.py +20 -42
- {imap_processing-0.16.2.dist-info → imap_processing-0.18.0.dist-info}/METADATA +2 -2
- {imap_processing-0.16.2.dist-info → imap_processing-0.18.0.dist-info}/RECORD +95 -103
- imap_processing/lo/l0/data_classes/star_sensor.py +0 -98
- imap_processing/lo/l0/utils/lo_base.py +0 -57
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM45_LeftSlit.csv +0 -526
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM45_RightSlit.csv +0 -526
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM90_LeftSlit.csv +0 -526
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM90_RightSlit.csv +0 -524
- imap_processing/ultra/lookup_tables/EgyNorm.mem.csv +0 -32769
- imap_processing/ultra/lookup_tables/FM45_Startup1_ULTRA_IMGPARAMS_20240719.csv +0 -2
- imap_processing/ultra/lookup_tables/FM90_Startup1_ULTRA_IMGPARAMS_20240719.csv +0 -2
- imap_processing/ultra/lookup_tables/dps_grid45_compressed.cdf +0 -0
- imap_processing/ultra/lookup_tables/ultra45_back-pos-luts.csv +0 -4097
- imap_processing/ultra/lookup_tables/ultra45_tdc_norm.csv +0 -2050
- imap_processing/ultra/lookup_tables/ultra90_back-pos-luts.csv +0 -4097
- imap_processing/ultra/lookup_tables/ultra90_tdc_norm.csv +0 -2050
- imap_processing/ultra/lookup_tables/yadjust.csv +0 -257
- {imap_processing-0.16.2.dist-info → imap_processing-0.18.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.16.2.dist-info → imap_processing-0.18.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.16.2.dist-info → imap_processing-0.18.0.dist-info}/entry_points.txt +0 -0
|
@@ -10,15 +10,23 @@ class PacketProperties(NamedTuple):
|
|
|
10
10
|
logical_source: list # List of logical sources
|
|
11
11
|
addition_to_logical_desc: str # Description of the logical source
|
|
12
12
|
width: Union[int, None] # Width of binary data (could be None).
|
|
13
|
+
# Block, image_planes, pixel_window_rows, and pixel_window_columns are important for
|
|
14
|
+
# decompressing the images and a description is available on page 171 of IMAP-Ultra
|
|
15
|
+
# Flight Software Specification document (7523-9009_Rev_-.pdf).
|
|
13
16
|
block: Union[int, None] # Number of values in each block (could be None).
|
|
14
|
-
# This is important for decompressing the images and
|
|
15
|
-
# a description is available on page 171 of IMAP-Ultra Flight
|
|
16
|
-
# Software Specification document (7523-9009_Rev_-.pdf).
|
|
17
17
|
len_array: Union[
|
|
18
18
|
int, None
|
|
19
19
|
] # Length of the array to be decompressed (could be None).
|
|
20
20
|
mantissa_bit_length: Union[int, None] # used to determine the level of
|
|
21
21
|
# precision that can be recovered from compressed data (could be None).
|
|
22
|
+
image_planes: Union[int, None] = None
|
|
23
|
+
# number of images. See table 11 in the FSSD.
|
|
24
|
+
pixel_window_rows: Union[int, None] = None
|
|
25
|
+
# number of rows in each image. See table 49 in the FSSD.
|
|
26
|
+
pixel_window_columns: Union[int, None] = None
|
|
27
|
+
# number of columns in each image. See table 49 in the FSSD.
|
|
28
|
+
image_planes_per_packet: Union[int, None] = None
|
|
29
|
+
# number of image planes in each packet. See table 52 in the FSSD.
|
|
22
30
|
|
|
23
31
|
|
|
24
32
|
# Define PacketProperties instances directly in the module namespace
|
|
@@ -40,15 +48,123 @@ ULTRA_RATES = PacketProperties(
|
|
|
40
48
|
len_array=48,
|
|
41
49
|
mantissa_bit_length=12,
|
|
42
50
|
)
|
|
43
|
-
|
|
51
|
+
ULTRA_ENERGY_RATES = PacketProperties(
|
|
52
|
+
apid=[882, 946],
|
|
53
|
+
logical_source=[
|
|
54
|
+
"imap_ultra_l1a_45sensor-energy-rates",
|
|
55
|
+
"imap_ultra_l1a_90sensor-energy-rates",
|
|
56
|
+
],
|
|
57
|
+
addition_to_logical_desc="Energy Rates",
|
|
58
|
+
width=5,
|
|
59
|
+
block=16,
|
|
60
|
+
len_array=11,
|
|
61
|
+
mantissa_bit_length=12,
|
|
62
|
+
)
|
|
63
|
+
ULTRA_ENERGY_SPECTRA = PacketProperties(
|
|
64
|
+
apid=[889, 953],
|
|
65
|
+
logical_source=[
|
|
66
|
+
"imap_ultra_l1a_45sensor-energy-spectra",
|
|
67
|
+
"imap_ultra_l1a_90sensor-energy-spectra",
|
|
68
|
+
],
|
|
69
|
+
addition_to_logical_desc="Energy Spectra",
|
|
70
|
+
width=4,
|
|
71
|
+
block=16,
|
|
72
|
+
len_array=1,
|
|
73
|
+
mantissa_bit_length=5,
|
|
74
|
+
)
|
|
75
|
+
ULTRA_PHXTOF_HIGH_ANGULAR = PacketProperties(
|
|
44
76
|
apid=[883, 947],
|
|
45
77
|
logical_source=[
|
|
46
78
|
"imap_ultra_l1a_45sensor-histogram-ena-phxtof-hi-ang",
|
|
47
79
|
"imap_ultra_l1a_90sensor-histogram-ena-phxtof-hi-ang",
|
|
48
80
|
],
|
|
49
|
-
addition_to_logical_desc="Time of Flight Images",
|
|
81
|
+
addition_to_logical_desc="Pulse Height Time of Flight High Angular Images",
|
|
50
82
|
width=4,
|
|
51
83
|
block=15,
|
|
84
|
+
image_planes=8,
|
|
85
|
+
pixel_window_rows=54,
|
|
86
|
+
pixel_window_columns=180,
|
|
87
|
+
image_planes_per_packet=1,
|
|
88
|
+
len_array=None,
|
|
89
|
+
mantissa_bit_length=4,
|
|
90
|
+
)
|
|
91
|
+
ULTRA_PHXTOF_HIGH_ENERGY = PacketProperties(
|
|
92
|
+
apid=[884, 948],
|
|
93
|
+
logical_source=[
|
|
94
|
+
"imap_ultra_l1a_45sensor-histogram-ena-phxtof-hi-nrg",
|
|
95
|
+
"imap_ultra_l1a_90sensor-histogram-ena-phxtof-hi-nrg",
|
|
96
|
+
],
|
|
97
|
+
addition_to_logical_desc="Pulse Height By Time of Flight High Energy Images",
|
|
98
|
+
width=4,
|
|
99
|
+
block=15,
|
|
100
|
+
image_planes=28,
|
|
101
|
+
pixel_window_rows=27,
|
|
102
|
+
pixel_window_columns=90,
|
|
103
|
+
image_planes_per_packet=1,
|
|
104
|
+
len_array=None,
|
|
105
|
+
mantissa_bit_length=4,
|
|
106
|
+
)
|
|
107
|
+
ULTRA_PHXTOF_HIGH_TIME = PacketProperties(
|
|
108
|
+
apid=[885, 949],
|
|
109
|
+
logical_source=[
|
|
110
|
+
"imap_ultra_l1a_45sensor-histogram-ena-phxtof-hi-time",
|
|
111
|
+
"imap_ultra_l1a_90sensor-histogram-ena-phxtof-hi-time",
|
|
112
|
+
],
|
|
113
|
+
addition_to_logical_desc="Time of Flight High Time Images",
|
|
114
|
+
width=4,
|
|
115
|
+
block=15,
|
|
116
|
+
image_planes=8,
|
|
117
|
+
pixel_window_rows=18,
|
|
118
|
+
pixel_window_columns=60,
|
|
119
|
+
image_planes_per_packet=2,
|
|
120
|
+
len_array=None,
|
|
121
|
+
mantissa_bit_length=4,
|
|
122
|
+
)
|
|
123
|
+
ULTRA_EXTOF_HIGH_ANGULAR = PacketProperties(
|
|
124
|
+
apid=[886, 950],
|
|
125
|
+
logical_source=[
|
|
126
|
+
"imap_ultra_l1a_45sensor-histogram-ena-extof-hi-ang",
|
|
127
|
+
"imap_ultra_l1a_90sensor-histogram-ena-extof-hi-ang",
|
|
128
|
+
],
|
|
129
|
+
addition_to_logical_desc="Energy By Time of Flight High Angular Images",
|
|
130
|
+
width=4,
|
|
131
|
+
block=15,
|
|
132
|
+
image_planes=12,
|
|
133
|
+
pixel_window_rows=18,
|
|
134
|
+
pixel_window_columns=60,
|
|
135
|
+
image_planes_per_packet=2,
|
|
136
|
+
len_array=None,
|
|
137
|
+
mantissa_bit_length=4,
|
|
138
|
+
)
|
|
139
|
+
ULTRA_EXTOF_HIGH_TIME = PacketProperties(
|
|
140
|
+
apid=[888, 952],
|
|
141
|
+
logical_source=[
|
|
142
|
+
"imap_ultra_l1a_45sensor-histogram-ena-extof-hi-time",
|
|
143
|
+
"imap_ultra_l1a_90sensor-histogram-ena-extof-hi-time",
|
|
144
|
+
],
|
|
145
|
+
addition_to_logical_desc="Energy By Time of Flight High Time Images",
|
|
146
|
+
width=4,
|
|
147
|
+
block=15,
|
|
148
|
+
image_planes=4,
|
|
149
|
+
pixel_window_rows=9,
|
|
150
|
+
pixel_window_columns=30,
|
|
151
|
+
image_planes_per_packet=8,
|
|
152
|
+
len_array=None,
|
|
153
|
+
mantissa_bit_length=4,
|
|
154
|
+
)
|
|
155
|
+
ULTRA_EXTOF_HIGH_ENERGY = PacketProperties(
|
|
156
|
+
apid=[887, 951],
|
|
157
|
+
logical_source=[
|
|
158
|
+
"imap_ultra_l1a_45sensor-histogram-ena-extof-hi-nrg",
|
|
159
|
+
"imap_ultra_l1a_90sensor-histogram-ena-extof-hi-nrg",
|
|
160
|
+
],
|
|
161
|
+
addition_to_logical_desc="Energy By Time of Flight High Energy Images",
|
|
162
|
+
width=4,
|
|
163
|
+
block=15,
|
|
164
|
+
image_planes=44,
|
|
165
|
+
pixel_window_rows=9,
|
|
166
|
+
pixel_window_columns=30,
|
|
167
|
+
image_planes_per_packet=8,
|
|
52
168
|
len_array=None,
|
|
53
169
|
mantissa_bit_length=4,
|
|
54
170
|
)
|
|
@@ -61,20 +177,96 @@ ULTRA_EVENTS = PacketProperties(
|
|
|
61
177
|
len_array=None,
|
|
62
178
|
mantissa_bit_length=None,
|
|
63
179
|
)
|
|
180
|
+
ULTRA_ENERGY_EVENTS = PacketProperties(
|
|
181
|
+
apid=[897, 961],
|
|
182
|
+
logical_source=[
|
|
183
|
+
"imap_ultra_l1a_45sensor-energy-de",
|
|
184
|
+
"imap_ultra_l1a_90sensor-energy-de",
|
|
185
|
+
],
|
|
186
|
+
addition_to_logical_desc="Single Energy Events",
|
|
187
|
+
width=None,
|
|
188
|
+
block=None,
|
|
189
|
+
len_array=None,
|
|
190
|
+
mantissa_bit_length=None,
|
|
191
|
+
)
|
|
192
|
+
ULTRA_MACROS_CHECKSUM = PacketProperties(
|
|
193
|
+
apid=[872, 936],
|
|
194
|
+
logical_source=[
|
|
195
|
+
"imap_ultra_l1a_45sensor-macroschecksum",
|
|
196
|
+
"imap_ultra_l1a_90sensor-macroschecksum",
|
|
197
|
+
],
|
|
198
|
+
addition_to_logical_desc="Macros Checksum",
|
|
199
|
+
width=None,
|
|
200
|
+
block=None,
|
|
201
|
+
len_array=None,
|
|
202
|
+
mantissa_bit_length=None,
|
|
203
|
+
)
|
|
204
|
+
ULTRA_PRI_1_EVENTS = PacketProperties(
|
|
205
|
+
apid=[898, 962],
|
|
206
|
+
logical_source=[
|
|
207
|
+
"imap_ultra_l1a_45sensor-priority-1-de",
|
|
208
|
+
"imap_ultra_l1a_90sensor-priority-1-de",
|
|
209
|
+
],
|
|
210
|
+
addition_to_logical_desc="Primary 1 Events",
|
|
211
|
+
width=None,
|
|
212
|
+
block=None,
|
|
213
|
+
len_array=None,
|
|
214
|
+
mantissa_bit_length=None,
|
|
215
|
+
)
|
|
216
|
+
ULTRA_PRI_2_EVENTS = PacketProperties(
|
|
217
|
+
apid=[899, 963],
|
|
218
|
+
logical_source=[
|
|
219
|
+
"imap_ultra_l1a_45sensor-priority-2-de",
|
|
220
|
+
"imap_ultra_l1a_90sensor-priority-2-de",
|
|
221
|
+
],
|
|
222
|
+
addition_to_logical_desc="Primary 2 Events",
|
|
223
|
+
width=None,
|
|
224
|
+
block=None,
|
|
225
|
+
len_array=None,
|
|
226
|
+
mantissa_bit_length=None,
|
|
227
|
+
)
|
|
228
|
+
ULTRA_PRI_3_EVENTS = PacketProperties(
|
|
229
|
+
apid=[900, 964],
|
|
230
|
+
logical_source=[
|
|
231
|
+
"imap_ultra_l1a_45sensor-priority-3-de",
|
|
232
|
+
"imap_ultra_l1a_90sensor-priority-3-de",
|
|
233
|
+
],
|
|
234
|
+
addition_to_logical_desc="Primary 3 Events",
|
|
235
|
+
width=None,
|
|
236
|
+
block=None,
|
|
237
|
+
len_array=None,
|
|
238
|
+
mantissa_bit_length=None,
|
|
239
|
+
)
|
|
240
|
+
ULTRA_PRI_4_EVENTS = PacketProperties(
|
|
241
|
+
apid=[901, 965],
|
|
242
|
+
logical_source=[
|
|
243
|
+
"imap_ultra_l1a_45sensor-priority-4-de",
|
|
244
|
+
"imap_ultra_l1a_90sensor-priority-4-de",
|
|
245
|
+
],
|
|
246
|
+
addition_to_logical_desc="Primary 4 Events",
|
|
247
|
+
width=None,
|
|
248
|
+
block=None,
|
|
249
|
+
len_array=None,
|
|
250
|
+
mantissa_bit_length=None,
|
|
251
|
+
)
|
|
64
252
|
ULTRA_HK = PacketProperties(
|
|
65
253
|
apid=[
|
|
66
254
|
866,
|
|
67
255
|
867,
|
|
256
|
+
868,
|
|
68
257
|
869,
|
|
69
258
|
870,
|
|
259
|
+
871,
|
|
70
260
|
873,
|
|
71
261
|
874,
|
|
72
262
|
876,
|
|
73
263
|
877,
|
|
74
264
|
930,
|
|
75
265
|
931,
|
|
266
|
+
932,
|
|
76
267
|
933,
|
|
77
268
|
934,
|
|
269
|
+
935,
|
|
78
270
|
937,
|
|
79
271
|
938,
|
|
80
272
|
940,
|
|
@@ -83,16 +275,20 @@ ULTRA_HK = PacketProperties(
|
|
|
83
275
|
logical_source=[
|
|
84
276
|
"imap_ultra_l1a_45sensor-alarm",
|
|
85
277
|
"imap_ultra_l1a_45sensor-memchecksum",
|
|
278
|
+
"imap_ultra_l1a_45sensor-memdump",
|
|
86
279
|
"imap_ultra_l1a_45sensor-status",
|
|
87
280
|
"imap_ultra_l1a_45sensor-bootstatus",
|
|
281
|
+
"imap_ultra_l1a_45sensor-macrodump",
|
|
88
282
|
"imap_ultra_l1a_45sensor-monitorlimits",
|
|
89
283
|
"imap_ultra_l1a_45sensor-params",
|
|
90
284
|
"imap_ultra_l1a_45sensor-scauto",
|
|
91
285
|
"imap_ultra_l1a_45sensor-imgparams",
|
|
92
286
|
"imap_ultra_l1a_90sensor-alarm",
|
|
93
287
|
"imap_ultra_l1a_90sensor-memchecksum",
|
|
288
|
+
"imap_ultra_l1a_90sensor-memdump",
|
|
94
289
|
"imap_ultra_l1a_90sensor-status",
|
|
95
290
|
"imap_ultra_l1a_90sensor-bootstatus",
|
|
291
|
+
"imap_ultra_l1a_90sensor-macrodump",
|
|
96
292
|
"imap_ultra_l1a_90sensor-monitorlimits",
|
|
97
293
|
"imap_ultra_l1a_90sensor-params",
|
|
98
294
|
"imap_ultra_l1a_90sensor-scauto",
|
|
@@ -119,7 +315,21 @@ ULTRA_CMD_TEXT = PacketProperties(
|
|
|
119
315
|
len_array=None,
|
|
120
316
|
mantissa_bit_length=None,
|
|
121
317
|
)
|
|
122
|
-
|
|
318
|
+
ULTRA_CMD_ECHO = PacketProperties(
|
|
319
|
+
apid=[
|
|
320
|
+
865,
|
|
321
|
+
929,
|
|
322
|
+
],
|
|
323
|
+
logical_source=[
|
|
324
|
+
"imap_ultra_l1a_45sensor-cmdecho",
|
|
325
|
+
"imap_ultra_l1a_90sensor-cmdecho",
|
|
326
|
+
],
|
|
327
|
+
addition_to_logical_desc="Command echo",
|
|
328
|
+
width=None,
|
|
329
|
+
block=None,
|
|
330
|
+
len_array=None,
|
|
331
|
+
mantissa_bit_length=None,
|
|
332
|
+
)
|
|
123
333
|
|
|
124
334
|
# Module-level constant for event field ranges
|
|
125
335
|
EVENT_FIELD_RANGES = {
|
|
@@ -206,6 +416,20 @@ EVENT_FIELD_RANGES = {
|
|
|
206
416
|
"phase_angle": (156, 166),
|
|
207
417
|
}
|
|
208
418
|
|
|
419
|
+
# Module-level constant for event field ranges
|
|
420
|
+
ENERGY_EVENT_FIELD_RANGES = {
|
|
421
|
+
# Stop Type
|
|
422
|
+
"stop_type": (0, 4),
|
|
423
|
+
# Energy/Pulse Height
|
|
424
|
+
"energy_ph": (4, 16),
|
|
425
|
+
# Pulse Width
|
|
426
|
+
"pulse_width": (16, 27),
|
|
427
|
+
# Bin
|
|
428
|
+
"bin": (27, 31),
|
|
429
|
+
# Phase Angle
|
|
430
|
+
"phase_angle": (31, 41),
|
|
431
|
+
}
|
|
432
|
+
|
|
209
433
|
|
|
210
434
|
RATES_KEYS = [
|
|
211
435
|
# Start Right Full Constant Fraction Discriminator (CFD) Pulses
|
|
@@ -323,8 +547,55 @@ RATES_KEYS = [
|
|
|
323
547
|
# "discarded_events"
|
|
324
548
|
]
|
|
325
549
|
|
|
550
|
+
ENERGY_RATES_KEYS = [
|
|
551
|
+
# SSD0 Energy LED
|
|
552
|
+
"ssd0_energy_led",
|
|
553
|
+
# SSD1 Energy LED
|
|
554
|
+
"ssd1_energy_led",
|
|
555
|
+
# SSD2 Energy LED
|
|
556
|
+
"ssd2_energy_led",
|
|
557
|
+
# SSD3 Energy LED
|
|
558
|
+
"ssd3_energy_led",
|
|
559
|
+
# SSD4 Energy LED
|
|
560
|
+
"ssd4_energy_led",
|
|
561
|
+
# SSD5 Energy LED
|
|
562
|
+
"ssd5_energy_led",
|
|
563
|
+
# SSD6 Energy LED
|
|
564
|
+
"ssd6_energy_led",
|
|
565
|
+
# SSD7 Energy LED
|
|
566
|
+
"ssd7_energy_led",
|
|
567
|
+
# Event Active Time
|
|
568
|
+
"event_active_time",
|
|
569
|
+
# FIFO Valid Events
|
|
570
|
+
"fifo_valid_events",
|
|
571
|
+
# Processed Events
|
|
572
|
+
"processed_events",
|
|
573
|
+
]
|
|
574
|
+
|
|
575
|
+
ENERGY_SPECTRA_KEYS = [
|
|
576
|
+
# Sum of the 8 SSDs
|
|
577
|
+
"ssd_sum",
|
|
578
|
+
]
|
|
579
|
+
|
|
580
|
+
# Map of command echo fields
|
|
581
|
+
CMD_ECHO_MAP = {
|
|
582
|
+
0x00: "No error command executed",
|
|
583
|
+
0x01: "No error command appended to macro",
|
|
584
|
+
0x02: "Unknown opcode or insufficient arguments",
|
|
585
|
+
0x03: "Bad argument",
|
|
586
|
+
0x04: "Cannot run macro; no contexts",
|
|
587
|
+
0x05: "Cannot be used outside of a macro",
|
|
588
|
+
0x06: "Macro compilation error",
|
|
589
|
+
0x07: "Macro not killed (not running?)",
|
|
590
|
+
0x08: "Cannot boot program; bad checksum",
|
|
591
|
+
0x09: "Cannot restore macros; bad checksum",
|
|
592
|
+
0x0A: "Cannot load memory; write disabled",
|
|
593
|
+
0x10: "HV goal greater than limit",
|
|
594
|
+
0x11: "Shutter deployment disabled",
|
|
595
|
+
}
|
|
596
|
+
|
|
326
597
|
|
|
327
|
-
def parse_event(event_binary: str) -> dict:
|
|
598
|
+
def parse_event(event_binary: str, field_ranges: dict) -> dict:
|
|
328
599
|
"""
|
|
329
600
|
Parse a binary string representing a single event.
|
|
330
601
|
|
|
@@ -332,6 +603,8 @@ def parse_event(event_binary: str) -> dict:
|
|
|
332
603
|
----------
|
|
333
604
|
event_binary : str
|
|
334
605
|
Event binary string.
|
|
606
|
+
field_ranges : dict
|
|
607
|
+
The field ranges for the event data.
|
|
335
608
|
|
|
336
609
|
Returns
|
|
337
610
|
-------
|
|
@@ -339,7 +612,7 @@ def parse_event(event_binary: str) -> dict:
|
|
|
339
612
|
Dict of the fields for a single event.
|
|
340
613
|
"""
|
|
341
614
|
fields_dict = {}
|
|
342
|
-
for field, (start, end) in
|
|
615
|
+
for field, (start, end) in field_ranges.items():
|
|
343
616
|
field_value = int(event_binary[start:end], 2)
|
|
344
617
|
fields_dict[field] = field_value
|
|
345
618
|
return fields_dict
|
|
@@ -8,24 +8,44 @@ import xarray as xr
|
|
|
8
8
|
from imap_processing import imap_module_directory
|
|
9
9
|
from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
|
|
10
10
|
from imap_processing.ultra.l0.decom_ultra import (
|
|
11
|
+
process_ultra_cmd_echo,
|
|
12
|
+
process_ultra_energy_rates,
|
|
13
|
+
process_ultra_energy_spectra,
|
|
11
14
|
process_ultra_events,
|
|
15
|
+
process_ultra_macros_checksum,
|
|
12
16
|
process_ultra_rates,
|
|
13
17
|
process_ultra_tof,
|
|
14
18
|
)
|
|
15
19
|
from imap_processing.ultra.l0.ultra_utils import (
|
|
16
20
|
ULTRA_AUX,
|
|
21
|
+
ULTRA_CMD_ECHO,
|
|
17
22
|
ULTRA_CMD_TEXT,
|
|
23
|
+
ULTRA_ENERGY_EVENTS,
|
|
24
|
+
ULTRA_ENERGY_RATES,
|
|
25
|
+
ULTRA_ENERGY_SPECTRA,
|
|
18
26
|
ULTRA_EVENTS,
|
|
27
|
+
ULTRA_EXTOF_HIGH_ANGULAR,
|
|
28
|
+
ULTRA_EXTOF_HIGH_ENERGY,
|
|
29
|
+
ULTRA_EXTOF_HIGH_TIME,
|
|
19
30
|
ULTRA_HK,
|
|
31
|
+
ULTRA_MACROS_CHECKSUM,
|
|
32
|
+
ULTRA_PHXTOF_HIGH_ANGULAR,
|
|
33
|
+
ULTRA_PHXTOF_HIGH_ENERGY,
|
|
34
|
+
ULTRA_PHXTOF_HIGH_TIME,
|
|
35
|
+
ULTRA_PRI_1_EVENTS,
|
|
36
|
+
ULTRA_PRI_2_EVENTS,
|
|
37
|
+
ULTRA_PRI_3_EVENTS,
|
|
38
|
+
ULTRA_PRI_4_EVENTS,
|
|
20
39
|
ULTRA_RATES,
|
|
21
|
-
ULTRA_TOF,
|
|
22
40
|
)
|
|
23
41
|
from imap_processing.utils import packet_file_to_datasets
|
|
24
42
|
|
|
25
43
|
logger = logging.getLogger(__name__)
|
|
26
44
|
|
|
27
45
|
|
|
28
|
-
def ultra_l1a(
|
|
46
|
+
def ultra_l1a( # noqa: PLR0912
|
|
47
|
+
packet_file: str, apid_input: Optional[int] = None
|
|
48
|
+
) -> list[xr.Dataset]:
|
|
29
49
|
"""
|
|
30
50
|
Will process ULTRA L0 data into L1A CDF files at output_filepath.
|
|
31
51
|
|
|
@@ -59,6 +79,32 @@ def ultra_l1a(packet_file: str, apid_input: Optional[int] = None) -> list[xr.Dat
|
|
|
59
79
|
else:
|
|
60
80
|
apids = list(datasets_by_apid.keys())
|
|
61
81
|
|
|
82
|
+
all_event_apids = {
|
|
83
|
+
apid: group.logical_source[i]
|
|
84
|
+
for group in [
|
|
85
|
+
ULTRA_EVENTS,
|
|
86
|
+
ULTRA_ENERGY_EVENTS,
|
|
87
|
+
ULTRA_PRI_1_EVENTS,
|
|
88
|
+
ULTRA_PRI_2_EVENTS,
|
|
89
|
+
ULTRA_PRI_3_EVENTS,
|
|
90
|
+
ULTRA_PRI_4_EVENTS,
|
|
91
|
+
]
|
|
92
|
+
for i, apid in enumerate(group.apid)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
all_l1a_image_apids = {
|
|
96
|
+
apid: group
|
|
97
|
+
for group in [
|
|
98
|
+
ULTRA_PHXTOF_HIGH_ANGULAR,
|
|
99
|
+
ULTRA_PHXTOF_HIGH_ENERGY,
|
|
100
|
+
ULTRA_PHXTOF_HIGH_TIME,
|
|
101
|
+
ULTRA_EXTOF_HIGH_ANGULAR,
|
|
102
|
+
ULTRA_EXTOF_HIGH_TIME,
|
|
103
|
+
ULTRA_EXTOF_HIGH_ENERGY,
|
|
104
|
+
]
|
|
105
|
+
for apid in group.apid
|
|
106
|
+
}
|
|
107
|
+
|
|
62
108
|
# Update dataset global attributes
|
|
63
109
|
attr_mgr = ImapCdfAttributes()
|
|
64
110
|
attr_mgr.add_instrument_global_attrs("ultra")
|
|
@@ -68,19 +114,39 @@ def ultra_l1a(packet_file: str, apid_input: Optional[int] = None) -> list[xr.Dat
|
|
|
68
114
|
if apid in ULTRA_AUX.apid:
|
|
69
115
|
decom_ultra_dataset = datasets_by_apid[apid]
|
|
70
116
|
gattr_key = ULTRA_AUX.logical_source[ULTRA_AUX.apid.index(apid)]
|
|
71
|
-
elif apid in
|
|
72
|
-
|
|
73
|
-
|
|
117
|
+
elif apid in all_l1a_image_apids:
|
|
118
|
+
packet_props = all_l1a_image_apids[apid]
|
|
119
|
+
decom_ultra_dataset = process_ultra_tof(
|
|
120
|
+
datasets_by_apid[apid], packet_props
|
|
121
|
+
)
|
|
122
|
+
gattr_key = packet_props.logical_source[packet_props.apid.index(apid)]
|
|
74
123
|
elif apid in ULTRA_RATES.apid:
|
|
75
124
|
decom_ultra_dataset = process_ultra_rates(datasets_by_apid[apid])
|
|
76
125
|
decom_ultra_dataset = decom_ultra_dataset.drop_vars("fastdata_00")
|
|
77
126
|
gattr_key = ULTRA_RATES.logical_source[ULTRA_RATES.apid.index(apid)]
|
|
78
|
-
elif apid in
|
|
79
|
-
decom_ultra_dataset =
|
|
80
|
-
|
|
127
|
+
elif apid in ULTRA_ENERGY_RATES.apid:
|
|
128
|
+
decom_ultra_dataset = process_ultra_energy_rates(datasets_by_apid[apid])
|
|
129
|
+
decom_ultra_dataset = decom_ultra_dataset.drop_vars("ratedata")
|
|
130
|
+
gattr_key = ULTRA_ENERGY_RATES.logical_source[
|
|
131
|
+
ULTRA_ENERGY_RATES.apid.index(apid)
|
|
132
|
+
]
|
|
133
|
+
elif apid in all_event_apids:
|
|
134
|
+
decom_ultra_dataset = process_ultra_events(datasets_by_apid[apid], apid)
|
|
135
|
+
gattr_key = all_event_apids[apid]
|
|
81
136
|
# Add coordinate attributes
|
|
82
137
|
attrs = attr_mgr.get_variable_attributes("event_id")
|
|
83
138
|
decom_ultra_dataset.coords["event_id"].attrs.update(attrs)
|
|
139
|
+
elif apid in ULTRA_ENERGY_SPECTRA.apid:
|
|
140
|
+
decom_ultra_dataset = process_ultra_energy_spectra(datasets_by_apid[apid])
|
|
141
|
+
decom_ultra_dataset = decom_ultra_dataset.drop_vars("compdata")
|
|
142
|
+
gattr_key = ULTRA_ENERGY_SPECTRA.logical_source[
|
|
143
|
+
ULTRA_ENERGY_SPECTRA.apid.index(apid)
|
|
144
|
+
]
|
|
145
|
+
elif apid in ULTRA_MACROS_CHECKSUM.apid:
|
|
146
|
+
decom_ultra_dataset = process_ultra_macros_checksum(datasets_by_apid[apid])
|
|
147
|
+
gattr_key = ULTRA_MACROS_CHECKSUM.logical_source[
|
|
148
|
+
ULTRA_MACROS_CHECKSUM.apid.index(apid)
|
|
149
|
+
]
|
|
84
150
|
elif apid in ULTRA_HK.apid:
|
|
85
151
|
decom_ultra_dataset = datasets_by_apid[apid]
|
|
86
152
|
gattr_key = ULTRA_HK.logical_source[ULTRA_HK.apid.index(apid)]
|
|
@@ -97,6 +163,9 @@ def ultra_l1a(packet_file: str, apid_input: Optional[int] = None) -> list[xr.Dat
|
|
|
97
163
|
coords={"epoch": decom_ultra_dataset["epoch"]},
|
|
98
164
|
)
|
|
99
165
|
gattr_key = ULTRA_CMD_TEXT.logical_source[ULTRA_CMD_TEXT.apid.index(apid)]
|
|
166
|
+
elif apid in ULTRA_CMD_ECHO.apid:
|
|
167
|
+
decom_ultra_dataset = process_ultra_cmd_echo(datasets_by_apid[apid])
|
|
168
|
+
gattr_key = ULTRA_CMD_ECHO.logical_source[ULTRA_CMD_ECHO.apid.index(apid)]
|
|
100
169
|
else:
|
|
101
170
|
logger.error(f"APID {apid} not recognized.")
|
|
102
171
|
continue
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import xarray as xr
|
|
5
5
|
|
|
6
|
-
from imap_processing.
|
|
6
|
+
from imap_processing.ultra.l1b.quality_flag_filters import QUALITY_FLAG_FILTERS
|
|
7
7
|
from imap_processing.ultra.utils.ultra_l1_utils import create_dataset, extract_data_dict
|
|
8
8
|
|
|
9
9
|
FILLVAL_UINT16 = 65535
|
|
@@ -32,14 +32,14 @@ def calculate_cullingmask(extendedspin_dataset: xr.Dataset, name: str) -> xr.Dat
|
|
|
32
32
|
good_mask = (
|
|
33
33
|
(
|
|
34
34
|
extendedspin_dataset["quality_attitude"]
|
|
35
|
-
&
|
|
35
|
+
& sum(flag.value for flag in QUALITY_FLAG_FILTERS["quality_attitude"])
|
|
36
36
|
)
|
|
37
37
|
== 0
|
|
38
38
|
) & (
|
|
39
39
|
(
|
|
40
40
|
(
|
|
41
41
|
extendedspin_dataset["quality_ena_rates"]
|
|
42
|
-
&
|
|
42
|
+
& sum(flag.value for flag in QUALITY_FLAG_FILTERS["quality_ena_rates"])
|
|
43
43
|
)
|
|
44
44
|
== 0
|
|
45
45
|
).all(dim="energy_bin_geometric_mean")
|