imap-processing 0.19.4__py3-none-any.whl → 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.
Potentially problematic release.
This version of imap-processing might be problematic. Click here for more details.
- imap_processing/_version.py +2 -2
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +44 -44
- imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml +127 -126
- imap_processing/cdf/config/imap_constant_attrs.yaml +1 -1
- imap_processing/cdf/config/imap_enamaps_l2-common_variable_attrs.yaml +36 -37
- imap_processing/cdf/config/imap_enamaps_l2-healpix_variable_attrs.yaml +1 -2
- imap_processing/cdf/config/imap_enamaps_l2-rectangular_variable_attrs.yaml +5 -3
- imap_processing/codice/codice_l1a.py +42 -21
- imap_processing/codice/constants.py +163 -129
- imap_processing/ena_maps/ena_maps.py +13 -10
- imap_processing/hi/hi_l2.py +8 -8
- imap_processing/ialirt/l0/ialirt_spice.py +1 -1
- imap_processing/ialirt/l0/parse_mag.py +33 -0
- imap_processing/ialirt/utils/create_xarray.py +1 -0
- imap_processing/spice/geometry.py +28 -19
- imap_processing/ultra/l2/ultra_l2.py +3 -3
- {imap_processing-0.19.4.dist-info → imap_processing-1.0.0.dist-info}/METADATA +1 -1
- {imap_processing-0.19.4.dist-info → imap_processing-1.0.0.dist-info}/RECORD +21 -21
- {imap_processing-0.19.4.dist-info → imap_processing-1.0.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.19.4.dist-info → imap_processing-1.0.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.19.4.dist-info → imap_processing-1.0.0.dist-info}/entry_points.txt +0 -0
|
@@ -236,8 +236,9 @@ HI_COUNTERS_AGGREGATED_VARIABLE_NAMES = [
|
|
|
236
236
|
REQUIRES_DESPINNING = [
|
|
237
237
|
"imap_codice_l1a_lo-sw-angular",
|
|
238
238
|
"imap_codice_l1a_lo-nsw-angular",
|
|
239
|
-
|
|
240
|
-
"imap_codice_l1a_lo-
|
|
239
|
+
# TBD if this requires despinning
|
|
240
|
+
# "imap_codice_l1a_lo-sw-priority",
|
|
241
|
+
# "imap_codice_l1a_lo-nsw-priority",
|
|
241
242
|
]
|
|
242
243
|
|
|
243
244
|
# Energy tables for CoDICE-Hi data products. These values represent the edges
|
|
@@ -268,149 +269,158 @@ IALIRT_ENERGY_TABLE = {
|
|
|
268
269
|
|
|
269
270
|
OMNI_ENERGY_TABLE = {
|
|
270
271
|
"h": [
|
|
271
|
-
0.
|
|
272
|
-
0.
|
|
273
|
-
0.
|
|
274
|
-
0.
|
|
275
|
-
0.
|
|
276
|
-
0.
|
|
277
|
-
0.
|
|
278
|
-
0.
|
|
279
|
-
0.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
272
|
+
0.0200000000,
|
|
273
|
+
0.0282842712,
|
|
274
|
+
0.0400000000,
|
|
275
|
+
0.0565685425,
|
|
276
|
+
0.0800000000,
|
|
277
|
+
0.1131370850,
|
|
278
|
+
0.1600000000,
|
|
279
|
+
0.2262741700,
|
|
280
|
+
0.3200000000,
|
|
281
|
+
0.4525483400,
|
|
282
|
+
0.6400000000,
|
|
283
|
+
0.9050966799,
|
|
284
|
+
1.2800000000,
|
|
285
|
+
1.8101933598,
|
|
286
|
+
2.5600000000,
|
|
287
|
+
3.6203867197,
|
|
287
288
|
],
|
|
288
289
|
"he3": [
|
|
289
|
-
0.
|
|
290
|
-
0.
|
|
291
|
-
0.
|
|
292
|
-
0.
|
|
293
|
-
0.
|
|
294
|
-
0.
|
|
295
|
-
0.
|
|
296
|
-
0.
|
|
297
|
-
0.
|
|
298
|
-
0.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
290
|
+
0.0200000000,
|
|
291
|
+
0.0282842712,
|
|
292
|
+
0.0400000000,
|
|
293
|
+
0.0565685425,
|
|
294
|
+
0.0800000000,
|
|
295
|
+
0.1131370850,
|
|
296
|
+
0.1600000000,
|
|
297
|
+
0.2262741700,
|
|
298
|
+
0.3200000000,
|
|
299
|
+
0.4525483400,
|
|
300
|
+
0.6400000000,
|
|
301
|
+
0.9050966799,
|
|
302
|
+
1.2800000000,
|
|
303
|
+
1.8101933598,
|
|
304
|
+
2.5600000000,
|
|
305
|
+
3.6203867197,
|
|
305
306
|
],
|
|
306
307
|
"he4": [
|
|
307
|
-
0.
|
|
308
|
-
0.
|
|
309
|
-
0.
|
|
310
|
-
0.
|
|
311
|
-
0.
|
|
312
|
-
0.
|
|
313
|
-
0.
|
|
314
|
-
0.
|
|
315
|
-
0.
|
|
316
|
-
0.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
308
|
+
0.0200000000,
|
|
309
|
+
0.0282842712,
|
|
310
|
+
0.0400000000,
|
|
311
|
+
0.0565685425,
|
|
312
|
+
0.0800000000,
|
|
313
|
+
0.1131370850,
|
|
314
|
+
0.1600000000,
|
|
315
|
+
0.2262741700,
|
|
316
|
+
0.3200000000,
|
|
317
|
+
0.4525483400,
|
|
318
|
+
0.6400000000,
|
|
319
|
+
0.9050966799,
|
|
320
|
+
1.2800000000,
|
|
321
|
+
1.8101933598,
|
|
322
|
+
2.5600000000,
|
|
323
|
+
3.6203867197,
|
|
323
324
|
],
|
|
324
325
|
"c": [
|
|
325
|
-
0.
|
|
326
|
-
0.
|
|
327
|
-
0.
|
|
328
|
-
0.
|
|
329
|
-
0.
|
|
330
|
-
0.
|
|
331
|
-
0.
|
|
332
|
-
0.
|
|
333
|
-
0.
|
|
334
|
-
0.
|
|
335
|
-
0.
|
|
336
|
-
|
|
337
|
-
1.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
326
|
+
0.0200000000,
|
|
327
|
+
0.0282842712,
|
|
328
|
+
0.0400000000,
|
|
329
|
+
0.0565685425,
|
|
330
|
+
0.0800000000,
|
|
331
|
+
0.1131370850,
|
|
332
|
+
0.1600000000,
|
|
333
|
+
0.2262741700,
|
|
334
|
+
0.3200000000,
|
|
335
|
+
0.4525483400,
|
|
336
|
+
0.6400000000,
|
|
337
|
+
0.9050966799,
|
|
338
|
+
1.2800000000,
|
|
339
|
+
1.8101933598,
|
|
340
|
+
2.5600000000,
|
|
341
|
+
3.6203867197,
|
|
342
|
+
5.1200000000,
|
|
343
|
+
7.2407734394,
|
|
344
|
+
10.2400000000,
|
|
344
345
|
],
|
|
345
346
|
"o": [
|
|
346
|
-
0.
|
|
347
|
-
0.
|
|
348
|
-
0.
|
|
349
|
-
0.
|
|
350
|
-
0.
|
|
351
|
-
0.
|
|
352
|
-
0.
|
|
353
|
-
0.
|
|
354
|
-
0.
|
|
355
|
-
0.
|
|
356
|
-
0.
|
|
357
|
-
|
|
358
|
-
1.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
347
|
+
0.0200000000,
|
|
348
|
+
0.0282842712,
|
|
349
|
+
0.0400000000,
|
|
350
|
+
0.0565685425,
|
|
351
|
+
0.0800000000,
|
|
352
|
+
0.1131370850,
|
|
353
|
+
0.1600000000,
|
|
354
|
+
0.2262741700,
|
|
355
|
+
0.3200000000,
|
|
356
|
+
0.4525483400,
|
|
357
|
+
0.6400000000,
|
|
358
|
+
0.9050966799,
|
|
359
|
+
1.2800000000,
|
|
360
|
+
1.8101933598,
|
|
361
|
+
2.5600000000,
|
|
362
|
+
3.6203867197,
|
|
363
|
+
5.1200000000,
|
|
364
|
+
7.2407734394,
|
|
365
|
+
10.2400000000,
|
|
365
366
|
],
|
|
366
367
|
"ne_mg_si": [
|
|
367
|
-
0.
|
|
368
|
-
0.
|
|
369
|
-
0.
|
|
370
|
-
0.
|
|
371
|
-
0.
|
|
372
|
-
0.
|
|
373
|
-
0.
|
|
374
|
-
0.
|
|
375
|
-
0.
|
|
376
|
-
0.
|
|
377
|
-
0.
|
|
378
|
-
0.
|
|
379
|
-
1.
|
|
380
|
-
1.
|
|
381
|
-
2.
|
|
382
|
-
3.
|
|
368
|
+
0.0200000000,
|
|
369
|
+
0.0282842712,
|
|
370
|
+
0.0400000000,
|
|
371
|
+
0.0565685425,
|
|
372
|
+
0.0800000000,
|
|
373
|
+
0.1131370850,
|
|
374
|
+
0.1600000000,
|
|
375
|
+
0.2262741700,
|
|
376
|
+
0.3200000000,
|
|
377
|
+
0.4525483400,
|
|
378
|
+
0.6400000000,
|
|
379
|
+
0.9050966799,
|
|
380
|
+
1.2800000000,
|
|
381
|
+
1.8101933598,
|
|
382
|
+
2.5600000000,
|
|
383
|
+
3.6203867197,
|
|
383
384
|
],
|
|
384
385
|
"fe": [
|
|
385
|
-
0.
|
|
386
|
-
0.
|
|
387
|
-
0.
|
|
388
|
-
0.
|
|
389
|
-
0.
|
|
390
|
-
0.
|
|
391
|
-
0.
|
|
392
|
-
0.
|
|
393
|
-
0.
|
|
394
|
-
0.
|
|
395
|
-
0.
|
|
396
|
-
0.
|
|
397
|
-
1.
|
|
398
|
-
1.
|
|
399
|
-
2.
|
|
400
|
-
3.
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
386
|
+
0.0200000000,
|
|
387
|
+
0.0282842712,
|
|
388
|
+
0.0400000000,
|
|
389
|
+
0.0565685425,
|
|
390
|
+
0.0800000000,
|
|
391
|
+
0.1131370850,
|
|
392
|
+
0.1600000000,
|
|
393
|
+
0.2262741700,
|
|
394
|
+
0.3200000000,
|
|
395
|
+
0.4525483400,
|
|
396
|
+
0.6400000000,
|
|
397
|
+
0.9050966799,
|
|
398
|
+
1.2800000000,
|
|
399
|
+
1.8101933598,
|
|
400
|
+
2.5600000000,
|
|
401
|
+
3.6203867197,
|
|
402
|
+
5.1200000000,
|
|
403
|
+
7.2407734394,
|
|
404
|
+
10.2400000000,
|
|
404
405
|
],
|
|
405
|
-
"uh": [
|
|
406
|
-
|
|
406
|
+
"uh": [
|
|
407
|
+
0.0200000000,
|
|
408
|
+
0.0282842712,
|
|
409
|
+
0.0400000000,
|
|
410
|
+
0.0565685425,
|
|
411
|
+
0.0800000000,
|
|
412
|
+
0.1131370850,
|
|
413
|
+
],
|
|
414
|
+
"junk": [0.0200000000, 0.0282842712],
|
|
407
415
|
}
|
|
408
416
|
|
|
417
|
+
# In the future, we get csv file with these column:
|
|
418
|
+
# species, min_energy, max_energy, product (descriptor of the product)
|
|
409
419
|
SECTORED_ENERGY_TABLE = {
|
|
410
|
-
"h": [0.
|
|
411
|
-
"he3he4": [0.
|
|
412
|
-
"cno": [0.
|
|
413
|
-
"fe": [0.
|
|
420
|
+
"h": [0.020, 0.040, 0.080, 0.160, 0.320, 0.640, 1.280, 2.560, 5.120],
|
|
421
|
+
"he3he4": [0.020, 0.040, 0.080, 0.160, 0.320, 0.640, 1.280, 2.560, 5.120],
|
|
422
|
+
"cno": [0.020, 0.040, 0.080, 0.160, 0.320, 0.640, 1.280, 2.560, 5.120],
|
|
423
|
+
"fe": [0.020, 0.040, 0.080, 0.160, 0.320, 0.640, 1.280, 2.560, 5.120],
|
|
414
424
|
}
|
|
415
425
|
|
|
416
426
|
# Various configurations to support processing of individual data products
|
|
@@ -2185,6 +2195,30 @@ ACQUISITION_TIMES = {
|
|
|
2185
2195
|
],
|
|
2186
2196
|
}
|
|
2187
2197
|
|
|
2198
|
+
# These are for product that requires despinning in l1b.
|
|
2199
|
+
SW_INDEX_TO_POSITION = [1, 2, 3, 23, 24]
|
|
2200
|
+
NSW_INDEX_TO_POSITION = [
|
|
2201
|
+
4,
|
|
2202
|
+
5,
|
|
2203
|
+
6,
|
|
2204
|
+
7,
|
|
2205
|
+
8,
|
|
2206
|
+
9,
|
|
2207
|
+
10,
|
|
2208
|
+
11,
|
|
2209
|
+
12,
|
|
2210
|
+
13,
|
|
2211
|
+
14,
|
|
2212
|
+
15,
|
|
2213
|
+
16,
|
|
2214
|
+
17,
|
|
2215
|
+
18,
|
|
2216
|
+
19,
|
|
2217
|
+
20,
|
|
2218
|
+
21,
|
|
2219
|
+
22,
|
|
2220
|
+
]
|
|
2221
|
+
|
|
2188
2222
|
# TODO: Update EFFICIENCY value when better information is available.
|
|
2189
2223
|
# Constant for CoDICE Intensity calculations.
|
|
2190
2224
|
EFFICIENCY = 1
|
|
@@ -1331,25 +1331,28 @@ class RectangularSkyMap(AbstractSkyMap):
|
|
|
1331
1331
|
)
|
|
1332
1332
|
cdf_ds.attrs.update(map_attrs)
|
|
1333
1333
|
|
|
1334
|
-
# Set the variable attributes
|
|
1335
|
-
for
|
|
1334
|
+
# Set the variable and coordinate attributes
|
|
1335
|
+
for name, data_array in {**cdf_ds.data_vars, **cdf_ds.coords}.items():
|
|
1336
1336
|
try:
|
|
1337
|
-
#
|
|
1338
|
-
|
|
1339
|
-
check_schema =
|
|
1340
|
-
False if any(s in var for s in ignore_schema_substrings) else True
|
|
1341
|
-
)
|
|
1337
|
+
# We only check the schema on data variables that include "epoch"
|
|
1338
|
+
# in their list of dimensions (But not epoch itself).
|
|
1339
|
+
check_schema = name != "epoch" and "epoch" in data_array.dims
|
|
1342
1340
|
var_attrs = cdf_attrs.get_variable_attributes(
|
|
1343
|
-
variable_name=
|
|
1341
|
+
variable_name=name,
|
|
1344
1342
|
check_schema=check_schema,
|
|
1345
1343
|
)
|
|
1346
1344
|
except KeyError as e:
|
|
1347
1345
|
raise KeyError(
|
|
1348
|
-
f"Attributes for variable {
|
|
1346
|
+
f"Attributes for variable {name} not found in "
|
|
1349
1347
|
f"loaded variable attributes."
|
|
1350
1348
|
) from e
|
|
1351
1349
|
|
|
1352
|
-
cdf_ds[
|
|
1350
|
+
cdf_ds[name].attrs.update(var_attrs)
|
|
1351
|
+
|
|
1352
|
+
# Manually adjust epoch attributes
|
|
1353
|
+
cdf_ds["epoch"].attrs.update(
|
|
1354
|
+
{"DELTA_PLUS_VAR": "epoch_delta", "BIN_LOCATION": 0}
|
|
1355
|
+
)
|
|
1353
1356
|
|
|
1354
1357
|
return cdf_ds
|
|
1355
1358
|
|
imap_processing/hi/hi_l2.py
CHANGED
|
@@ -229,7 +229,7 @@ def calculate_ena_intensity(
|
|
|
229
229
|
Returns
|
|
230
230
|
-------
|
|
231
231
|
map_ds : xarray.Dataset
|
|
232
|
-
Map dataset with new variables: ena_intensity,
|
|
232
|
+
Map dataset with new variables: ena_intensity, ena_intensity_stat_uncert,
|
|
233
233
|
ena_intensity_sys_err.
|
|
234
234
|
"""
|
|
235
235
|
# read calibration product configuration file
|
|
@@ -248,7 +248,7 @@ def calculate_ena_intensity(
|
|
|
248
248
|
# Convert ENA Signal Rate to Flux
|
|
249
249
|
flux_conversion_divisor = geometric_factor * esa_energy
|
|
250
250
|
map_ds["ena_intensity"] = map_ds["ena_signal_rates"] / flux_conversion_divisor
|
|
251
|
-
map_ds["
|
|
251
|
+
map_ds["ena_intensity_stat_uncert"] = (
|
|
252
252
|
map_ds["ena_signal_rate_stat_unc"] / flux_conversion_divisor
|
|
253
253
|
)
|
|
254
254
|
map_ds["ena_intensity_sys_err"] = map_ds["bg_rates_unc"] / flux_conversion_divisor
|
|
@@ -268,12 +268,12 @@ def calculate_ena_intensity(
|
|
|
268
268
|
# dimension by passing the zeroth element.
|
|
269
269
|
corrected_intensity, corrected_stat_unc = corrector.apply_flux_correction(
|
|
270
270
|
map_ds["ena_intensity"].values[0],
|
|
271
|
-
map_ds["
|
|
271
|
+
map_ds["ena_intensity_stat_uncert"].values[0],
|
|
272
272
|
esa_energy.data,
|
|
273
273
|
)
|
|
274
274
|
# Add the size 1 epoch dimension back in to the corrected fluxes.
|
|
275
275
|
map_ds["ena_intensity"].data = corrected_intensity[np.newaxis, ...]
|
|
276
|
-
map_ds["
|
|
276
|
+
map_ds["ena_intensity_stat_uncert"].data = corrected_stat_unc[np.newaxis, ...]
|
|
277
277
|
|
|
278
278
|
return map_ds
|
|
279
279
|
|
|
@@ -302,7 +302,7 @@ def combine_calibration_products(
|
|
|
302
302
|
Returns
|
|
303
303
|
-------
|
|
304
304
|
map_ds : xarray.Dataset
|
|
305
|
-
Map dataset with updated variables: ena_intensity,
|
|
305
|
+
Map dataset with updated variables: ena_intensity, ena_intensity_stat_uncert,
|
|
306
306
|
ena_intensity_sys_err now combined across calibration products at each
|
|
307
307
|
energy level.
|
|
308
308
|
"""
|
|
@@ -336,7 +336,7 @@ def combine_calibration_products(
|
|
|
336
336
|
combined_flux = weighted_flux_sum / flux_weights.sum(dim="calibration_prod")
|
|
337
337
|
|
|
338
338
|
map_ds["ena_intensity"] = combined_flux
|
|
339
|
-
map_ds["
|
|
339
|
+
map_ds["ena_intensity_stat_uncert"] = combined_stat_unc
|
|
340
340
|
# For systematic error, just do quadrature sum over the systematic error for
|
|
341
341
|
# each calibration product.
|
|
342
342
|
map_ds["ena_intensity_sys_err"] = np.sqrt((sys_err**2).sum(dim="calibration_prod"))
|
|
@@ -377,7 +377,7 @@ def _calculate_improved_stat_variance(
|
|
|
377
377
|
|
|
378
378
|
if n_calib_prods <= 1:
|
|
379
379
|
# No improvement possible with single calibration product
|
|
380
|
-
return map_ds["
|
|
380
|
+
return map_ds["ena_intensity_stat_uncert"] ** 2
|
|
381
381
|
|
|
382
382
|
logger.debug("Computing geometric factor normalized signal rates")
|
|
383
383
|
|
|
@@ -417,7 +417,7 @@ def _calculate_improved_stat_variance(
|
|
|
417
417
|
# Handle invalid cases by falling back to original uncertainties
|
|
418
418
|
improved_variance = xr.where(
|
|
419
419
|
~np.isfinite(improved_variance) | (geometric_factors == 0),
|
|
420
|
-
map_ds["
|
|
420
|
+
map_ds["ena_intensity_stat_uncert"],
|
|
421
421
|
improved_variance,
|
|
422
422
|
)
|
|
423
423
|
|
|
@@ -177,7 +177,7 @@ def transform_instrument_vectors_to_inertial(
|
|
|
177
177
|
)
|
|
178
178
|
|
|
179
179
|
# Get static mount matrix
|
|
180
|
-
mount_matrix = spice.pxform(instrument_frame.name, spacecraft_frame.name, 0.0)
|
|
180
|
+
mount_matrix = spice.pxform(instrument_frame.name, spacecraft_frame.name, 0.0).T
|
|
181
181
|
|
|
182
182
|
# Compute total rotations
|
|
183
183
|
total_rotations = compute_total_rotation(
|
|
@@ -719,6 +719,39 @@ def process_packet(
|
|
|
719
719
|
"mag_theta_B_GSM": Decimal(str(theta_gsm[i])),
|
|
720
720
|
"mag_phi_B_GSE": Decimal(str(phi_gse[i])),
|
|
721
721
|
"mag_theta_B_GSE": Decimal(str(theta_gse[i])),
|
|
722
|
+
"mag_hk_status": {
|
|
723
|
+
"hk1v5_warn": bool(status_data["hk1v5_warn"]),
|
|
724
|
+
"hk1v5_danger": bool(status_data["hk1v5_danger"]),
|
|
725
|
+
"hk1v5c_warn": bool(status_data["hk1v5c_warn"]),
|
|
726
|
+
"hk1v5c_danger": bool(status_data["hk1v5c_danger"]),
|
|
727
|
+
"hk1v8_warn": bool(status_data["hk1v8_warn"]),
|
|
728
|
+
"hk1v8_danger": bool(status_data["hk1v8_danger"]),
|
|
729
|
+
"hk1v8c_warn": bool(status_data["hk1v8c_warn"]),
|
|
730
|
+
"hk1v8c_danger": bool(status_data["hk1v8c_danger"]),
|
|
731
|
+
"fob_saturated": bool(status_data["fob_saturated"]),
|
|
732
|
+
"fib_saturated": bool(status_data["fib_saturated"]),
|
|
733
|
+
"mode": int(status_data["mode"]),
|
|
734
|
+
"icu_temp": int(status_data["icu_temp"]),
|
|
735
|
+
"hk2v5_warn": bool(status_data["hk2v5_warn"]),
|
|
736
|
+
"hk2v5_danger": bool(status_data["hk2v5_danger"]),
|
|
737
|
+
"hk2v5c_warn": bool(status_data["hk2v5c_warn"]),
|
|
738
|
+
"hk2v5c_danger": bool(status_data["hk2v5c_danger"]),
|
|
739
|
+
"hk3v3": int(status_data["hk3v3"]),
|
|
740
|
+
"hk3v3_current": int(status_data["hk3v3_current"]),
|
|
741
|
+
"pri_isvalid": bool(status_data["pri_isvalid"]),
|
|
742
|
+
"hkp8v5_warn": bool(status_data["hkp8v5_warn"]),
|
|
743
|
+
"hkp8v5_danger": bool(status_data["hkp8v5_danger"]),
|
|
744
|
+
"hkp8v5c_warn": bool(status_data["hkp8v5c_warn"]),
|
|
745
|
+
"hkp8v5c_danger": bool(status_data["hkp8v5c_danger"]),
|
|
746
|
+
"hkn8v5": int(status_data["hkn8v5"]),
|
|
747
|
+
"hkn8v5_current": int(status_data["hkn8v5_current"]),
|
|
748
|
+
"fob_temp": int(status_data["fob_temp"]),
|
|
749
|
+
"fib_temp": int(status_data["fib_temp"]),
|
|
750
|
+
"fob_range": int(status_data["fob_range"]),
|
|
751
|
+
"fib_range": int(status_data["fib_range"]),
|
|
752
|
+
"multbit_errs": bool(status_data["multbit_errs"]),
|
|
753
|
+
"sec_isvalid": bool(status_data["sec_isvalid"]),
|
|
754
|
+
},
|
|
722
755
|
}
|
|
723
756
|
)
|
|
724
757
|
|
|
@@ -21,7 +21,7 @@ from numpy.typing import NDArray
|
|
|
21
21
|
class SpiceBody(IntEnum):
|
|
22
22
|
"""Enum containing SPICE IDs for bodies that we use."""
|
|
23
23
|
|
|
24
|
-
# A subset of IMAP Specific bodies as defined in
|
|
24
|
+
# A subset of IMAP Specific bodies as defined in imap_xxx.tf
|
|
25
25
|
IMAP = -43
|
|
26
26
|
IMAP_SPACECRAFT = -43000
|
|
27
27
|
# IMAP Pointing Frame (Despun) as defined in imap_science_xxx.tf
|
|
@@ -58,7 +58,7 @@ class SpiceFrame(IntEnum):
|
|
|
58
58
|
IMAP_CODICE = -43400
|
|
59
59
|
IMAP_HIT = -43500
|
|
60
60
|
IMAP_IDEX = -43700
|
|
61
|
-
IMAP_GLOWS = -
|
|
61
|
+
IMAP_GLOWS = -43750
|
|
62
62
|
|
|
63
63
|
# IMAP Science Frames (new additions from imap_science_xxx.tf)
|
|
64
64
|
IMAP_OMD = -43900
|
|
@@ -85,6 +85,8 @@ class SpiceFrame(IntEnum):
|
|
|
85
85
|
|
|
86
86
|
BORESIGHT_LOOKUP = {
|
|
87
87
|
SpiceFrame.IMAP_LO_BASE: np.array([0, -1, 0]),
|
|
88
|
+
SpiceFrame.IMAP_LO: np.array([0, -1, 0]),
|
|
89
|
+
SpiceFrame.IMAP_LO_STAR_SENSOR: np.array([0, -1, 0]),
|
|
88
90
|
SpiceFrame.IMAP_HI_45: np.array([0, 1, 0]),
|
|
89
91
|
SpiceFrame.IMAP_HI_90: np.array([0, 1, 0]),
|
|
90
92
|
SpiceFrame.IMAP_ULTRA_45: np.array([0, 0, 1]),
|
|
@@ -160,7 +162,7 @@ def get_instrument_mounting_az_el(instrument: SpiceFrame) -> np.ndarray:
|
|
|
160
162
|
# frame that is used to compute the s/c to instrument mounting.
|
|
161
163
|
# Most of these vectors are the same as the instrument boresight vector.
|
|
162
164
|
mounting_normal_vector = {
|
|
163
|
-
SpiceFrame.IMAP_LO_BASE: np.array([0, -1
|
|
165
|
+
SpiceFrame.IMAP_LO_BASE: np.array([0, 0, -1]),
|
|
164
166
|
SpiceFrame.IMAP_HI_45: np.array([0, 1, 0]),
|
|
165
167
|
SpiceFrame.IMAP_HI_90: np.array([0, 1, 0]),
|
|
166
168
|
SpiceFrame.IMAP_ULTRA_45: np.array([0, 0, 1]),
|
|
@@ -190,11 +192,16 @@ def get_spacecraft_to_instrument_spin_phase_offset(instrument: SpiceFrame) -> fl
|
|
|
190
192
|
"""
|
|
191
193
|
Get the spin phase offset from the spacecraft to the instrument.
|
|
192
194
|
|
|
193
|
-
|
|
195
|
+
Nominal offset values were determined using `Table 1: Nominal Instrument
|
|
194
196
|
to S/C CS Transformations` in document `7516-0011_drw.pdf`. That Table
|
|
195
|
-
defines the angle from the spacecraft y-axis. We add 90 and take the
|
|
196
|
-
with 360
|
|
197
|
-
|
|
197
|
+
defines the angle from the spacecraft y-axis. We add 90-degrees and take the
|
|
198
|
+
modulus with 360 to get the angle from the spacecraft x-axis. This math is
|
|
199
|
+
shown in the comments after each key value pair in the dictionary defined
|
|
200
|
+
in code. The true values differ slightly from the nominal values. True
|
|
201
|
+
values are derived from the frame definitions in the IMAP frames kernel
|
|
202
|
+
which uses ground calibration measurements to define the as-built mounting
|
|
203
|
+
of each instrument. The function in this module, `get_instrument_mounting_az_el`,
|
|
204
|
+
was used to retrieve the true azimuth angles from the IMAP frames kernel.
|
|
198
205
|
|
|
199
206
|
Parameters
|
|
200
207
|
----------
|
|
@@ -207,19 +214,21 @@ def get_spacecraft_to_instrument_spin_phase_offset(instrument: SpiceFrame) -> fl
|
|
|
207
214
|
The spin phase offset from the spacecraft to the instrument.
|
|
208
215
|
"""
|
|
209
216
|
phase_offset_lookup = {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
SpiceFrame.
|
|
213
|
-
SpiceFrame.
|
|
214
|
-
SpiceFrame.
|
|
217
|
+
# Phase offset values based on imap_100.tf frame kernel
|
|
218
|
+
# See docstring notes for details on how these values were determined.
|
|
219
|
+
SpiceFrame.IMAP_LO: 60 / 360, # (330 + 90) % 360 = 60
|
|
220
|
+
SpiceFrame.IMAP_HI_45: 344.8264 / 360, # 255 + 90 = 345
|
|
221
|
+
SpiceFrame.IMAP_HI_90: 15.1649 / 360, # (285 + 90) % 360 = 15
|
|
222
|
+
SpiceFrame.IMAP_ULTRA_45: 122.8642 / 360, # 33 + 90 = 123
|
|
223
|
+
SpiceFrame.IMAP_ULTRA_90: 299.9511 / 360, # 210 + 90 = 300
|
|
215
224
|
SpiceFrame.IMAP_SWAPI: 258 / 360, # 168 + 90 = 258
|
|
216
|
-
SpiceFrame.IMAP_IDEX:
|
|
217
|
-
SpiceFrame.IMAP_CODICE:
|
|
218
|
-
SpiceFrame.IMAP_HIT:
|
|
219
|
-
SpiceFrame.IMAP_SWE: 243 / 360, # 153 + 90 = 243
|
|
220
|
-
SpiceFrame.IMAP_GLOWS: 217 / 360, # 127 + 90 = 217
|
|
221
|
-
SpiceFrame.IMAP_MAG_I:
|
|
222
|
-
SpiceFrame.IMAP_MAG_O:
|
|
225
|
+
SpiceFrame.IMAP_IDEX: 179.9229 / 360, # 90 + 90 = 180
|
|
226
|
+
SpiceFrame.IMAP_CODICE: 225.9086 / 360, # 136 + 90 = 226
|
|
227
|
+
SpiceFrame.IMAP_HIT: 119.6452 / 360, # 30 + 90 = 120
|
|
228
|
+
SpiceFrame.IMAP_SWE: 243.0155 / 360, # 153 + 90 = 243
|
|
229
|
+
SpiceFrame.IMAP_GLOWS: 217.1384 / 360, # 127 + 90 = 217
|
|
230
|
+
SpiceFrame.IMAP_MAG_I: 89.9709 / 360, # 0 + 90 = 90
|
|
231
|
+
SpiceFrame.IMAP_MAG_O: 89.4077 / 360, # 0 + 90 = 90
|
|
223
232
|
}
|
|
224
233
|
return phase_offset_lookup[instrument]
|
|
225
234
|
|
|
@@ -160,7 +160,7 @@ def generate_ultra_healpix_skymap( # noqa: PLR0912
|
|
|
160
160
|
This function combines IMAP Ultra L1C pointing sets into a single L2 HealpixSkyMap.
|
|
161
161
|
It handles the projection of values from pointing sets to the map, applies necessary
|
|
162
162
|
weighting and background subtraction, and calculates ena_intensity
|
|
163
|
-
and
|
|
163
|
+
and ena_intensity_stat_uncert.
|
|
164
164
|
|
|
165
165
|
Parameters
|
|
166
166
|
----------
|
|
@@ -391,7 +391,7 @@ def generate_ultra_healpix_skymap( # noqa: PLR0912
|
|
|
391
391
|
skymap.data_1d["sensitivity"] * skymap.solid_angle * delta_energy
|
|
392
392
|
)
|
|
393
393
|
|
|
394
|
-
skymap.data_1d["
|
|
394
|
+
skymap.data_1d["ena_intensity_stat_uncert"] = (
|
|
395
395
|
skymap.data_1d["counts"].astype(float) ** 0.5
|
|
396
396
|
) / (
|
|
397
397
|
skymap.data_1d["exposure_factor"]
|
|
@@ -630,7 +630,7 @@ def ultra_l2(
|
|
|
630
630
|
# Add systematic error as all zeros with shape matching statistical unc
|
|
631
631
|
# TODO: update once we have information from the instrument team
|
|
632
632
|
map_dataset["ena_intensity_sys_err"] = xr.zeros_like(
|
|
633
|
-
map_dataset["
|
|
633
|
+
map_dataset["ena_intensity_stat_uncert"],
|
|
634
634
|
)
|
|
635
635
|
|
|
636
636
|
# Add epoch_delta
|