imap-processing 0.7.0__py3-none-any.whl → 0.9.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.

Files changed (172) hide show
  1. imap_processing/__init__.py +1 -1
  2. imap_processing/_version.py +2 -2
  3. imap_processing/ccsds/excel_to_xtce.py +36 -2
  4. imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +1 -1
  5. imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +145 -30
  6. imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +36 -36
  7. imap_processing/cdf/config/imap_hi_variable_attrs.yaml +136 -9
  8. imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +14 -0
  9. imap_processing/cdf/config/imap_hit_l1a_variable_attrs.yaml +63 -1
  10. imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml +9 -0
  11. imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +14 -7
  12. imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +577 -235
  13. imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +326 -0
  14. imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +33 -23
  15. imap_processing/cdf/config/imap_mag_l1_variable_attrs.yaml +24 -28
  16. imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +1 -0
  17. imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +137 -79
  18. imap_processing/cdf/config/imap_variable_schema.yaml +13 -0
  19. imap_processing/cdf/imap_cdf_manager.py +31 -27
  20. imap_processing/cdf/utils.py +3 -5
  21. imap_processing/cli.py +25 -14
  22. imap_processing/codice/codice_l1a.py +153 -63
  23. imap_processing/codice/constants.py +10 -10
  24. imap_processing/codice/decompress.py +10 -11
  25. imap_processing/codice/utils.py +1 -0
  26. imap_processing/glows/l1a/glows_l1a.py +1 -2
  27. imap_processing/glows/l1b/glows_l1b.py +3 -3
  28. imap_processing/glows/l1b/glows_l1b_data.py +59 -37
  29. imap_processing/glows/l2/glows_l2_data.py +123 -0
  30. imap_processing/hi/l1a/hi_l1a.py +4 -4
  31. imap_processing/hi/l1a/histogram.py +107 -109
  32. imap_processing/hi/l1a/science_direct_event.py +92 -225
  33. imap_processing/hi/l1b/hi_l1b.py +85 -11
  34. imap_processing/hi/l1c/hi_l1c.py +23 -1
  35. imap_processing/hi/packet_definitions/TLM_HI_COMBINED_SCI.xml +3994 -0
  36. imap_processing/hi/utils.py +1 -1
  37. imap_processing/hit/hit_utils.py +221 -0
  38. imap_processing/hit/l0/constants.py +118 -0
  39. imap_processing/hit/l0/decom_hit.py +100 -156
  40. imap_processing/hit/l1a/hit_l1a.py +170 -184
  41. imap_processing/hit/l1b/hit_l1b.py +33 -153
  42. imap_processing/ialirt/l0/process_codicelo.py +153 -0
  43. imap_processing/ialirt/l0/process_hit.py +5 -5
  44. imap_processing/ialirt/packet_definitions/ialirt_codicelo.xml +281 -0
  45. imap_processing/ialirt/process_ephemeris.py +212 -0
  46. imap_processing/idex/idex_l1a.py +65 -84
  47. imap_processing/idex/idex_l1b.py +192 -0
  48. imap_processing/idex/idex_variable_unpacking_and_eu_conversion.csv +33 -0
  49. imap_processing/idex/packet_definitions/idex_packet_definition.xml +97 -595
  50. imap_processing/lo/l0/decompression_tables/decompression_tables.py +17 -1
  51. imap_processing/lo/l0/lo_science.py +45 -13
  52. imap_processing/lo/l1a/lo_l1a.py +76 -8
  53. imap_processing/lo/packet_definitions/lo_xtce.xml +8344 -1849
  54. imap_processing/mag/l0/decom_mag.py +4 -3
  55. imap_processing/mag/l1a/mag_l1a.py +12 -13
  56. imap_processing/mag/l1a/mag_l1a_data.py +1 -2
  57. imap_processing/mag/l1b/mag_l1b.py +90 -7
  58. imap_processing/spice/geometry.py +156 -16
  59. imap_processing/spice/time.py +144 -2
  60. imap_processing/swapi/l1/swapi_l1.py +4 -4
  61. imap_processing/swapi/l2/swapi_l2.py +1 -1
  62. imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +1535 -446
  63. imap_processing/swe/l1b/swe_l1b_science.py +8 -8
  64. imap_processing/swe/l2/swe_l2.py +134 -17
  65. imap_processing/tests/ccsds/test_data/expected_output.xml +2 -1
  66. imap_processing/tests/ccsds/test_excel_to_xtce.py +4 -4
  67. imap_processing/tests/cdf/test_imap_cdf_manager.py +0 -10
  68. imap_processing/tests/codice/conftest.py +1 -17
  69. imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
  70. imap_processing/tests/codice/test_codice_l0.py +8 -2
  71. imap_processing/tests/codice/test_codice_l1a.py +127 -107
  72. imap_processing/tests/codice/test_codice_l1b.py +1 -0
  73. imap_processing/tests/codice/test_decompress.py +7 -7
  74. imap_processing/tests/conftest.py +100 -58
  75. imap_processing/tests/glows/conftest.py +6 -0
  76. imap_processing/tests/glows/test_glows_l1b.py +9 -9
  77. imap_processing/tests/glows/test_glows_l1b_data.py +9 -9
  78. imap_processing/tests/hi/test_data/l0/H90_NHK_20241104.bin +0 -0
  79. imap_processing/tests/hi/test_data/l0/H90_sci_cnt_20241104.bin +0 -0
  80. imap_processing/tests/hi/test_data/l0/H90_sci_de_20241104.bin +0 -0
  81. imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
  82. imap_processing/tests/hi/test_hi_l1b.py +73 -3
  83. imap_processing/tests/hi/test_hi_l1c.py +10 -2
  84. imap_processing/tests/hi/test_l1a.py +31 -58
  85. imap_processing/tests/hi/test_science_direct_event.py +58 -0
  86. imap_processing/tests/hi/test_utils.py +4 -3
  87. imap_processing/tests/hit/test_data/sci_sample1.ccsds +0 -0
  88. imap_processing/tests/hit/{test_hit_decom.py → test_decom_hit.py} +95 -36
  89. imap_processing/tests/hit/test_hit_l1a.py +299 -179
  90. imap_processing/tests/hit/test_hit_l1b.py +231 -24
  91. imap_processing/tests/hit/test_hit_utils.py +218 -0
  92. imap_processing/tests/hit/validation_data/hskp_sample_eu.csv +89 -0
  93. imap_processing/tests/hit/validation_data/sci_sample_raw1.csv +29 -0
  94. imap_processing/tests/ialirt/test_data/l0/apid01152.tlm +0 -0
  95. imap_processing/tests/ialirt/test_data/l0/imap_codice_l1a_lo-ialirt_20241110193700_v0.0.0.cdf +0 -0
  96. imap_processing/tests/ialirt/unit/test_process_codicelo.py +106 -0
  97. imap_processing/tests/ialirt/unit/test_process_ephemeris.py +109 -0
  98. imap_processing/tests/ialirt/unit/test_process_hit.py +9 -6
  99. imap_processing/tests/idex/conftest.py +2 -2
  100. imap_processing/tests/idex/imap_idex_l0_raw_20231214_v001.pkts +0 -0
  101. imap_processing/tests/idex/impact_14_tof_high_data.txt +4444 -4444
  102. imap_processing/tests/idex/test_idex_l0.py +4 -4
  103. imap_processing/tests/idex/test_idex_l1a.py +8 -2
  104. imap_processing/tests/idex/test_idex_l1b.py +126 -0
  105. imap_processing/tests/lo/test_lo_l1a.py +7 -16
  106. imap_processing/tests/lo/test_lo_science.py +69 -5
  107. imap_processing/tests/lo/test_pkts/imap_lo_l0_raw_20240803_v002.pkts +0 -0
  108. imap_processing/tests/lo/validation_data/Instrument_FM1_T104_R129_20240803_ILO_SCI_DE_dec_DN_with_fills.csv +1999 -0
  109. imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf +0 -0
  110. imap_processing/tests/mag/test_mag_l1b.py +97 -7
  111. imap_processing/tests/spice/test_data/imap_ena_sim_metakernel.template +3 -1
  112. imap_processing/tests/spice/test_geometry.py +115 -9
  113. imap_processing/tests/spice/test_time.py +135 -6
  114. imap_processing/tests/swapi/test_swapi_decom.py +75 -69
  115. imap_processing/tests/swapi/test_swapi_l1.py +4 -4
  116. imap_processing/tests/swe/conftest.py +33 -0
  117. imap_processing/tests/swe/l1_validation/swe_l0_unpacked-data_20240510_v001_VALIDATION_L1B_v3.dat +4332 -0
  118. imap_processing/tests/swe/test_swe_l1b.py +29 -8
  119. imap_processing/tests/swe/test_swe_l2.py +64 -8
  120. imap_processing/tests/test_utils.py +2 -2
  121. imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -3314
  122. imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E12.cdf +0 -0
  123. imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E24.cdf +0 -0
  124. imap_processing/tests/ultra/unit/test_de.py +113 -0
  125. imap_processing/tests/ultra/unit/test_spatial_utils.py +125 -0
  126. imap_processing/tests/ultra/unit/test_ultra_l1b.py +27 -3
  127. imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +31 -10
  128. imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +55 -35
  129. imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +10 -68
  130. imap_processing/ultra/constants.py +12 -3
  131. imap_processing/ultra/l1b/de.py +168 -30
  132. imap_processing/ultra/l1b/ultra_l1b_annotated.py +24 -10
  133. imap_processing/ultra/l1b/ultra_l1b_extended.py +46 -80
  134. imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +60 -144
  135. imap_processing/ultra/utils/spatial_utils.py +221 -0
  136. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/METADATA +15 -14
  137. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/RECORD +142 -139
  138. imap_processing/cdf/cdf_attribute_manager.py +0 -322
  139. imap_processing/cdf/config/shared/default_global_cdf_attrs_schema.yaml +0 -246
  140. imap_processing/cdf/config/shared/default_variable_cdf_attrs_schema.yaml +0 -466
  141. imap_processing/hi/l0/decom_hi.py +0 -24
  142. imap_processing/hi/packet_definitions/hi_packet_definition.xml +0 -482
  143. imap_processing/hit/l0/data_classes/housekeeping.py +0 -240
  144. imap_processing/hit/l0/data_classes/science_packet.py +0 -259
  145. imap_processing/hit/l0/utils/hit_base.py +0 -57
  146. imap_processing/tests/cdf/shared/default_global_cdf_attrs_schema.yaml +0 -246
  147. imap_processing/tests/cdf/shared/default_variable_cdf_attrs_schema.yaml +0 -466
  148. imap_processing/tests/cdf/test_cdf_attribute_manager.py +0 -353
  149. imap_processing/tests/codice/data/imap_codice_l0_hi-counters-aggregated_20240429_v001.pkts +0 -0
  150. imap_processing/tests/codice/data/imap_codice_l0_hi-counters-singles_20240429_v001.pkts +0 -0
  151. imap_processing/tests/codice/data/imap_codice_l0_hi-omni_20240429_v001.pkts +0 -0
  152. imap_processing/tests/codice/data/imap_codice_l0_hi-pha_20240429_v001.pkts +0 -0
  153. imap_processing/tests/codice/data/imap_codice_l0_hi-sectored_20240429_v001.pkts +0 -0
  154. imap_processing/tests/codice/data/imap_codice_l0_hskp_20100101_v001.pkts +0 -0
  155. imap_processing/tests/codice/data/imap_codice_l0_lo-counters-aggregated_20240429_v001.pkts +0 -0
  156. imap_processing/tests/codice/data/imap_codice_l0_lo-counters-singles_20240429_v001.pkts +0 -0
  157. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-angular_20240429_v001.pkts +0 -0
  158. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-priority_20240429_v001.pkts +0 -0
  159. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-species_20240429_v001.pkts +0 -0
  160. imap_processing/tests/codice/data/imap_codice_l0_lo-pha_20240429_v001.pkts +0 -0
  161. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-angular_20240429_v001.pkts +0 -0
  162. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-priority_20240429_v001.pkts +0 -0
  163. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-species_20240429_v001.pkts +0 -0
  164. imap_processing/tests/hi/test_decom.py +0 -55
  165. imap_processing/tests/hi/test_l1a_sci_de.py +0 -72
  166. imap_processing/tests/idex/imap_idex_l0_raw_20230725_v001.pkts +0 -0
  167. imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf +0 -0
  168. /imap_processing/{hi/l0/__init__.py → tests/glows/test_glows_l2_data.py} +0 -0
  169. /imap_processing/tests/hit/test_data/{imap_hit_l0_hk_20100105_v001.pkts → imap_hit_l0_raw_20100105_v001.pkts} +0 -0
  170. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/LICENSE +0 -0
  171. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/WHEEL +0 -0
  172. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/entry_points.txt +0 -0
@@ -1,240 +0,0 @@
1
- """L1A HIT Housekeeping data class."""
2
-
3
- from dataclasses import dataclass
4
-
5
- import numpy as np
6
- import space_packet_parser
7
-
8
- from imap_processing.ccsds.ccsds_data import CcsdsData
9
- from imap_processing.hit.l0.utils.hit_base import HITBase
10
-
11
-
12
- @dataclass
13
- class Housekeeping(HITBase):
14
- """
15
- L1A HIT Housekeeping data.
16
-
17
- The HIT Housekeeping data class handles the decommutation
18
- and parsing of L0 to L1A data.
19
-
20
- Parameters
21
- ----------
22
- packet : dict
23
- Dictionary of packet.
24
- software_version : str
25
- Version of software.
26
- packet_file_name : str
27
- Name of packet file.
28
-
29
- Attributes
30
- ----------
31
- SHCOARSE : int
32
- Spacecraft time.
33
- MODE : int
34
- Mode (0=boot, 1=maint, 2=stdby, 3=science)
35
- FSW_VERSION_A : int
36
- FSW version number (A.B.C bits)
37
- FSW_VERSION_B : int
38
- FSW version number (A.B.C bits)
39
- FSW_VERSION_C : int
40
- FSW version number (A.B.C bits)
41
- NUM_GOOD_CMDS : int
42
- Number of good commands
43
- LAST_GOOD_CMD : int
44
- Last good command
45
- LAST_GOOD_SEQ_NUM : int
46
- Last good sequence number
47
- NUM_BAD_CMDS : int
48
- Number of bad commands
49
- LAST_BAD_CMD : int
50
- Last bad command
51
- LAST_BAD_SEQ_NUM : int
52
- Last bad sequence number
53
- FEE_RUNNING : int
54
- FEE running (1) or reset (0)
55
- MRAM_DISABLED : int
56
- MRAM disabled (1) or enabled (0)
57
- ENABLE_50KHZ : int
58
- 50kHz enabled (1) or disabled (0)
59
- ENABLE_HVPS : int
60
- HVPS enabled (1) or disabled (0)
61
- TABLE_STATUS : int
62
- Table status OK (1) or error (0)
63
- HEATER_CONTROL : int
64
- Heater control (0=none, 1=pri, 2=sec)
65
- ADC_MODE : int
66
- ADC mode (0=quiet, 1=normal, 2=adcstim, 3=adcThreshold?)
67
- DYN_THRESH_LVL : int
68
- Dynamic threshold level (0-3)
69
- NUM_EVNT_LAST_HK : int
70
- Number of events since last HK update
71
- NUM_ERRORS : int
72
- Number of errors
73
- LAST_ERROR_NUM : int
74
- Last error number
75
- CODE_CHECKSUM : int
76
- Code checksum
77
- SPIN_PERIOD_SHORT : int
78
- Spin period at t=0
79
- SPIN_PERIOD_LONG : int
80
- Spin period at t=0
81
- LEAK_I_RAW : str
82
- Raw binary for Leakage current [V]
83
- LEAK_I : np.ndarray
84
- Leakage currents [V] formatted as (64, 1) array
85
- PHASIC_STAT : int
86
- PHASIC status
87
- ACTIVE_HEATER : int
88
- Active heater
89
- HEATER_ON : int
90
- Heater on/off
91
- TEST_PULSER_ON : int
92
- Test pulser on/off
93
- DAC0_ENABLE : int
94
- DAC_0 enable
95
- DAC1_ENABLE : int
96
- DAC_1 enable
97
- PREAMP_L234A : int
98
- Preamp L234A
99
- PREAMP_L1A : int
100
- Preamp L1A
101
- PREAMP_L1B : int
102
- Preamp L1B
103
- PREAMP_L234B : int
104
- Preamp L234B
105
- TEMP0 : int
106
- FEE LDO Regulator
107
- TEMP1 : int
108
- Primary Heater
109
- TEMP2 : int
110
- FEE FPGA
111
- TEMP3 : int
112
- Secondary Heater
113
- ANALOG_TEMP : int
114
- Chassis temp
115
- HVPS_TEMP : int
116
- Board temp
117
- IDPU_TEMP : int
118
- LDO Temp
119
- LVPS_TEMP : int
120
- Board temp
121
- EBOX_3D4VD : int
122
- 3.4VD Ebox (digital)
123
- EBOX_5D1VD : int
124
- 5.1VD Ebox (digital)
125
- EBOX_P12VA : int
126
- +12VA Ebox (analog)
127
- EBOX_M12VA : int
128
- -12VA Ebox (analog)
129
- EBOX_P5D7VA : int
130
- +5.7VA Ebox (analog)
131
- EBOX_M5D7VA : int
132
- -5.7VA Ebox (analog)
133
- REF_P5V : int
134
- +5Vref
135
- L1AB_BIAS : int
136
- L1A/B Bias
137
- L2AB_BIAS : int
138
- L2A/B Bias
139
- L34A_BIAS : int
140
- L3/4A Bias
141
- L34B_BIAS : int
142
- L3/4B Bias
143
- EBOX_P2D0VD : int
144
- +2.0VD Ebox (digital)
145
-
146
- Methods
147
- -------
148
- __init__(packet, software_vesion, packet_file_name):
149
- Uses the CCSDS packet, version of the software, and
150
- the name of the packet file to parse and store information about
151
- the Housekeeping packet data.
152
- _parse_leak():
153
- Parse each current leakage field and put into an array.
154
- """
155
-
156
- SHCOARSE: int
157
- MODE: int
158
- FSW_VERSION_A: int
159
- FSW_VERSION_B: int
160
- FSW_VERSION_C: int
161
- NUM_GOOD_CMDS: int
162
- LAST_GOOD_CMD: int
163
- LAST_GOOD_SEQ_NUM: int
164
- NUM_BAD_CMDS: int
165
- LAST_BAD_CMD: int
166
- LAST_BAD_SEQ_NUM: int
167
- FEE_RUNNING: int
168
- MRAM_DISABLED: int
169
- ENABLE_50KHZ: int
170
- ENABLE_HVPS: int
171
- TABLE_STATUS: int
172
- HEATER_CONTROL: int
173
- ADC_MODE: int
174
- DYN_THRESH_LVL: int
175
- NUM_EVNT_LAST_HK: int
176
- NUM_ERRORS: int
177
- LAST_ERROR_NUM: int
178
- CODE_CHECKSUM: int
179
- SPIN_PERIOD_SHORT: int
180
- SPIN_PERIOD_LONG: int
181
- LEAK_I_RAW: str
182
- LEAK_I: np.ndarray
183
- PHASIC_STAT: int
184
- ACTIVE_HEATER: int
185
- HEATER_ON: int
186
- TEST_PULSER_ON: int
187
- DAC0_ENABLE: int
188
- DAC1_ENABLE: int
189
- PREAMP_L234A: int
190
- PREAMP_L1A: int
191
- PREAMP_L1B: int
192
- PREAMP_L234B: int
193
- TEMP0: int
194
- TEMP1: int
195
- TEMP2: int
196
- TEMP3: int
197
- ANALOG_TEMP: int
198
- HVPS_TEMP: int
199
- IDPU_TEMP: int
200
- LVPS_TEMP: int
201
- EBOX_3D4VD: int
202
- EBOX_5D1VD: int
203
- EBOX_P12VA: int
204
- EBOX_M12VA: int
205
- EBOX_P5D7VA: int
206
- EBOX_M5D7VA: int
207
- REF_P5V: int
208
- L1AB_BIAS: int
209
- L2AB_BIAS: int
210
- L34A_BIAS: int
211
- L34B_BIAS: int
212
- EBOX_P2D0VD: int
213
-
214
- def __init__(
215
- self,
216
- packet: space_packet_parser.packets.CCSDSPacket,
217
- software_version: str,
218
- packet_file_name: str,
219
- ):
220
- """Housekeeping Data class initialization method."""
221
- super().__init__(software_version, packet_file_name, CcsdsData(packet.header))
222
- self.parse_data(packet)
223
- self._parse_leak()
224
-
225
- def _parse_leak(self) -> None:
226
- """Parse each current leakage field and put into an array."""
227
- # Each Leak field is 10 bits long
228
- leak_bit_length = 10
229
- # There are 64 leak fields
230
- num_leak_fields = 64
231
- self.LEAK_I = np.empty(num_leak_fields, dtype=np.uint16)
232
- # The leak fields appear in the packet in ascending order, so to append
233
- # the leak fields in the correct order, the binary will be parsed
234
- # from right to left.
235
- for i, leak_idx in enumerate(
236
- range(leak_bit_length * num_leak_fields, 0, -leak_bit_length)
237
- ):
238
- self.LEAK_I[i] = int(
239
- self.LEAK_I_RAW[leak_idx - leak_bit_length : leak_idx], 2
240
- )
@@ -1,259 +0,0 @@
1
- """L0 HIT Science Packet data class."""
2
-
3
- from dataclasses import InitVar, dataclass
4
-
5
- import numpy as np
6
-
7
- from imap_processing.hit.l0.utils.hit_base import HITBase
8
-
9
- # TODO: add methods to the SciencePacket data class to decom attributes with binary data
10
- # TODO: add __post_init__ method to SciencePacket data class to handle InitVar
11
- # attributes
12
-
13
-
14
- @dataclass
15
- class SciencePacket(HITBase):
16
- """
17
- L0 HIT Science Package data.
18
-
19
- This data class handles the decommutation of the HIT Science Packet
20
- data.
21
-
22
- Attributes
23
- ----------
24
- SHCOARSE: int
25
- Spacecraft time
26
- HDR_UNIT_NUM: int
27
- Unit ID (e.g. EM)
28
- HDR_FRAME_VERSION: int
29
- Frame version number
30
- HDR_STATUS_BITS: int
31
- Status bits
32
- HDR_MINUTE_CNT: int
33
- Minute counter (minute mod 10 -> subcom for sectored rates)
34
- LIVE_TIME: int
35
- Livetime count (270=100%)
36
- NUM_TRIG: int
37
- Number of triggers
38
- NUM_REJECT: int
39
- Number of rejected events
40
- NUM_ACC_W_PHA: int
41
- Number of accepted events with PHA data
42
- NUM_ACC_NO_PHA: int
43
- Number of events without PHA data
44
- NUM_HAZ_TRIG: int
45
- Number of triggers with hazard flag
46
- NUM_HAZ_REJECT: int
47
- Number of rejected events with hazard flag
48
- NUM_HAZ_ACC_W_PHA: int
49
- Number of accepted hazard events with PHA data
50
- NUM_HAZ_ACC_NO_PHA: int
51
- Number of hazard events without PHA data
52
- SNGRATES_HG: np.ndarray (int, (64,1))
53
- Counts since last science frame for PHA (hi gain) formatted as an array
54
- SNGRATES_LG: np.ndarray (int, (64,1))
55
- Counts since last science frame for PHA (low gain) formatted as an array
56
- NREAD: int
57
- Events read from event fifo
58
- NHAZARD: int
59
- Events tagged with hazard flag
60
- NADSTIM: int
61
- adc-stim events
62
- NODD: int
63
- Odd events
64
- NODDFIX: int
65
- Odd events that were fixed in sw
66
- NMULTI: int
67
- Events with multiple hits in a single detector (may be crosstalk)
68
- NMULTIFIX: int
69
- Multi events that were fixed in sw
70
- NBADTRAJ: int
71
- Bad trajectory
72
- NL2: int
73
- Events sorted into L12 event category
74
- NL3: int
75
- Events sorted into L123 event category
76
- NL4: int
77
- Events sorted into L1423 event category
78
- NPEN: int
79
- Events sorted into PEN (penetrating) event category
80
- NFORMAT: int
81
- Nothing currently goes in this slot
82
- NASIDE: int
83
- A-side events
84
- NBSIDE: int
85
- B-side events
86
- NERROR: int
87
- Events that caused a processing error - should never happen
88
- NBADTAGS: int
89
- Events with inconsistent tags vs pulse heights
90
- COINRATES: np.ndarray (int, (26,1))
91
- Coincidence rates for all detectors formatted into an array
92
- BUFRATES: np.ndarray (int, (31,1))
93
- Priority Buffer: ADC cal events formatted into an array
94
- L2FGRATES: np.ndarray (int, (132,1))
95
- R2 foreground rates formatted into an array
96
- L2BGRATES: np.ndarray (int, (12,1))
97
- R2 background rates formatted into an array
98
- L3FGRATES: np.ndarray (int, (167,1))
99
- R3 foreground rates formatted into an array
100
- L3BGRATES: np.ndarray (int, (12,1))
101
- R3 background rates formatted into an array
102
- PENFGRATES: np.ndarray (int, (15,1))
103
- R4 foreground rates formatted into an array
104
- PENBGRATES: np.ndarray (int, (15,1))
105
- R4 foreground rates formatted into an array
106
- IALIRTRATES: np.ndarray (int, (20,1))
107
- I-ALiRT rates formatted into an array
108
- SECTORATES: np.ndarray (int, (120,1))
109
- R4 background rates formatted into an array
110
- L4FGRATES: np.ndarray (int, (48,1))
111
- L4 ions foreground rates formatted into an array
112
- L4BGRATES: np.ndarray (int, (24,1))
113
- L4 ions background rates formatted into an array
114
- PHA_RECORDS: np.ndarray (int, (917,1))
115
- Event PHA records, array of 4-byte fields, formatted into an array
116
- SNGRATES_RAW: InitVar[str]
117
- Raw binary for PHA high gain and low gain for all detectors
118
- COINRATES_RAW: InitVar[str]
119
- Raw binary for coincidence rates for all detectors
120
- BUFRATES_RAW: InitVar[str]
121
- Raw binary for ADC calibration events
122
- L2FGRATES_RAW: InitVar[str]
123
- Raw binary for R2 foreground rates
124
- L2BGRATES_RAW: InitVar[str]
125
- Raw binary for R2 background rates
126
- L3FGRATES_RAW: InitVar[str]
127
- Raw binary for R3 foreground rates
128
- L3BGRATES_RAW: InitVar[str]
129
- Raw binary for R3 background rates
130
- PENFGRATES_RAW: InitVar[str]
131
- Raw binary for R4 foreground rates
132
- PENBGRATES_RAW: InitVar[str]
133
- Raw binary for R4 background rates
134
- IALIRTRATES_RAW: InitVar[str]
135
- Raw binary for I-ALiRT rates
136
- SECTORATES_RAW: InitVar[str]
137
- Raw binary for sector rates
138
- L4FGRATES_RAW: InitVar[str]
139
- Raw binary for L4 Ions foreground rates
140
- L4BGRATES_RAW: InitVar[str]
141
- Raw binary for L4 Ions background rates
142
- PHA_RECORDS_RAW: InitVar[str]
143
- Raw binary for event PHA records
144
- """
145
-
146
- SHCOARSE: int
147
- HDR_UNIT_NUM: int
148
- HDR_FRAME_VERSION: int
149
- HDR_STATUS_BITS: int
150
- HDR_MINUTE_CNT: int
151
- LIVE_TIME: int
152
- NUM_TRIG: int
153
- NUM_REJECT: int
154
- NUM_ACC_W_PHA: int
155
- NUM_ACC_NO_PHA: int
156
- NUM_HAZ_TRIG: int
157
- NUM_HAZ_REJECT: int
158
- NUM_HAZ_ACC_W_PHA: int
159
- NUM_HAZ_ACC_NO_PHA: int
160
- SNGRATES_HG: np.ndarray
161
- SNGRATES_LG: np.ndarray
162
- NREAD: int
163
- NHAZARD: int
164
- NADSTIM: int
165
- NODD: int
166
- NODDFIX: int
167
- NMULTI: int
168
- NMULTIFIX: int
169
- NBADTRAJ: int
170
- NL2: int
171
- NL3: int
172
- NL4: int
173
- NPEN: int
174
- NFORMAT: int
175
- NASIDE: int
176
- NBSIDE: int
177
- NERROR: int
178
- NBADTAGS: int
179
- COINRATES: np.ndarray
180
- BUFRATES: np.ndarray
181
- L2FGRATES: np.ndarray
182
- L2BGRATES: np.ndarray
183
- L3FGRATES: np.ndarray
184
- L3BGRATES: np.ndarray
185
- PENFGRATES: np.ndarray
186
- PENBGRATES: np.ndarray
187
- IALIRTRATES: np.ndarray
188
- SECTORATES: np.ndarray
189
- L4FGRATES: np.ndarray
190
- L4BGRATES: np.ndarray
191
- PHA_RECORDS: np.ndarray
192
- SNGRATES_RAW: InitVar[str]
193
- COINRATES_RAW: InitVar[str]
194
- BUFRATES_RAW: InitVar[str]
195
- L2FGRATES_RAW: InitVar[str]
196
- L2BGRATES_RAW: InitVar[str]
197
- L3FGRATES_RAW: InitVar[str]
198
- L3BGRATES_RAW: InitVar[str]
199
- PENFGRATES_RAW: InitVar[str]
200
- PENBGRATES_RAW: InitVar[str]
201
- IALIRTRATES_RAW: InitVar[str]
202
- SECTORATES_RAW: InitVar[str]
203
- L4FGRATES_RAW: InitVar[str]
204
- L4BGRATES_RAW: InitVar[str]
205
- PHA_RECORDS_RAW: InitVar[str]
206
-
207
-
208
- @dataclass
209
- class SectorRates:
210
- """
211
- L0 PHA Record data.
212
-
213
- A data class for PHA Record data which will be stored
214
- in the SciencePacket PHA_RECORDS attribute.
215
-
216
- Attributes
217
- ----------
218
- TBD - talk to Eric for descriptions
219
- """
220
-
221
- RATE_TYPE: int
222
- DATA: int
223
-
224
-
225
- @dataclass
226
- class PHARecord:
227
- """
228
- L0 Sector Rates data.
229
-
230
- A data class for Sector Rate data which will be stored
231
- in the SciencePacket SECTORATES attribute.
232
-
233
- Attributes
234
- ----------
235
- TBD - talk to Eric for descriptions
236
- """
237
-
238
- particle_id: int
239
- priority_buffer_num: int
240
- stim_tag: int
241
- haz_tag: int
242
- time_tag: int
243
- a_b_side: int
244
- has_unread_adc: bool
245
- extended_header_flag: int
246
- culling_flag: int
247
- detector_flags: int
248
- de_index: int
249
- ep_index: int
250
- stim_block: int
251
- dac_value: int
252
- pha_number: int
253
- stim_step: int
254
- stim_gain: int
255
- astim: int
256
- adc_value: int
257
- detector_address: int
258
- gain_flag: int
259
- last_pha_in_event: int
@@ -1,57 +0,0 @@
1
- """General HIT L0 data class used for parsing data and setting attributes."""
2
-
3
- from dataclasses import dataclass, fields
4
-
5
- import space_packet_parser
6
-
7
- from imap_processing.ccsds.ccsds_data import CcsdsData
8
-
9
-
10
- @dataclass
11
- class HITBase:
12
- """
13
- Data structure for common values across HIT.
14
-
15
- Attributes
16
- ----------
17
- ground_sw_version : str
18
- Ground software version.
19
- packet_file_name : str
20
- File name of the source packet.
21
- ccsds_header : CcsdsData
22
- CCSDS header data.
23
-
24
- Methods
25
- -------
26
- parse_data(packet):
27
- Parse the packet and assign to class variable using the xtce defined named.
28
- """
29
-
30
- ground_sw_version: str
31
- packet_file_name: str
32
- ccsds_header: CcsdsData
33
-
34
- def parse_data(self, packet: space_packet_parser.packets.CCSDSPacket) -> None:
35
- """
36
- Parse Lo L0 packet data.
37
-
38
- Parameters
39
- ----------
40
- packet : space_packet_parser.packets.CCSDSPacket
41
- A single Lo L0 packet from space packet parser.
42
- """
43
- attributes = [field.name for field in fields(self)]
44
-
45
- # For each item in packet, assign it to the matching attribute in the class.
46
- for key, item in packet.user_data.items():
47
- value = (
48
- item.derived_value if item.derived_value is not None else item.raw_value
49
- )
50
- if "SPARE" in key:
51
- continue
52
- if key not in attributes:
53
- raise KeyError(
54
- f"Did not find matching attribute in {self.__class__} data class"
55
- f"for {key}"
56
- )
57
- setattr(self, key, value)