imap-processing 0.9.0__py3-none-any.whl → 0.11.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 (243) hide show
  1. imap_processing/_version.py +2 -2
  2. imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +749 -442
  3. imap_processing/cdf/config/imap_glows_global_cdf_attrs.yaml +7 -0
  4. imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml +8 -2
  5. imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +0 -1
  6. imap_processing/cdf/config/imap_glows_l2_variable_attrs.yaml +358 -0
  7. imap_processing/cdf/config/imap_hi_variable_attrs.yaml +59 -25
  8. imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +22 -0
  9. imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +32 -8
  10. imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +94 -5
  11. imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +65 -37
  12. imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +16 -1
  13. imap_processing/cdf/config/imap_swe_global_cdf_attrs.yaml +7 -0
  14. imap_processing/cdf/config/imap_swe_l1a_variable_attrs.yaml +14 -14
  15. imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +25 -24
  16. imap_processing/cdf/config/imap_swe_l2_variable_attrs.yaml +238 -0
  17. imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +100 -92
  18. imap_processing/cdf/utils.py +2 -2
  19. imap_processing/cli.py +45 -9
  20. imap_processing/codice/codice_l1a.py +104 -58
  21. imap_processing/codice/constants.py +111 -155
  22. imap_processing/codice/data/esa_sweep_values.csv +256 -256
  23. imap_processing/codice/data/lo_stepping_values.csv +128 -128
  24. imap_processing/ena_maps/ena_maps.py +519 -0
  25. imap_processing/ena_maps/utils/map_utils.py +145 -0
  26. imap_processing/ena_maps/utils/spatial_utils.py +226 -0
  27. imap_processing/glows/__init__.py +3 -0
  28. imap_processing/glows/ancillary/imap_glows_pipeline_settings_v001.json +52 -0
  29. imap_processing/glows/l1a/glows_l1a.py +72 -14
  30. imap_processing/glows/l1b/glows_l1b.py +2 -1
  31. imap_processing/glows/l1b/glows_l1b_data.py +25 -1
  32. imap_processing/glows/l2/glows_l2.py +324 -0
  33. imap_processing/glows/l2/glows_l2_data.py +156 -51
  34. imap_processing/hi/l1a/science_direct_event.py +57 -51
  35. imap_processing/hi/l1b/hi_l1b.py +43 -28
  36. imap_processing/hi/l1c/hi_l1c.py +225 -42
  37. imap_processing/hi/utils.py +20 -3
  38. imap_processing/hit/l0/constants.py +2 -2
  39. imap_processing/hit/l0/decom_hit.py +1 -1
  40. imap_processing/hit/l1a/hit_l1a.py +94 -13
  41. imap_processing/hit/l1b/hit_l1b.py +158 -9
  42. imap_processing/ialirt/l0/process_codicehi.py +156 -0
  43. imap_processing/ialirt/l0/process_codicelo.py +5 -2
  44. imap_processing/ialirt/packet_definitions/ialirt.xml +28 -20
  45. imap_processing/ialirt/packet_definitions/ialirt_codicehi.xml +241 -0
  46. imap_processing/ialirt/packet_definitions/ialirt_swapi.xml +170 -0
  47. imap_processing/ialirt/packet_definitions/ialirt_swe.xml +258 -0
  48. imap_processing/ialirt/process_ephemeris.py +72 -40
  49. imap_processing/idex/decode.py +241 -0
  50. imap_processing/idex/idex_l1a.py +143 -81
  51. imap_processing/idex/idex_l1b.py +244 -10
  52. imap_processing/lo/l0/lo_science.py +61 -0
  53. imap_processing/lo/l1a/lo_l1a.py +98 -10
  54. imap_processing/lo/l1b/lo_l1b.py +2 -2
  55. imap_processing/lo/l1c/lo_l1c.py +2 -2
  56. imap_processing/lo/packet_definitions/lo_xtce.xml +1082 -9178
  57. imap_processing/mag/l0/decom_mag.py +2 -2
  58. imap_processing/mag/l1a/mag_l1a.py +7 -7
  59. imap_processing/mag/l1a/mag_l1a_data.py +62 -30
  60. imap_processing/mag/l1b/mag_l1b.py +11 -6
  61. imap_processing/quality_flags.py +18 -3
  62. imap_processing/spice/geometry.py +149 -177
  63. imap_processing/spice/kernels.py +26 -26
  64. imap_processing/spice/spin.py +233 -0
  65. imap_processing/spice/time.py +96 -31
  66. imap_processing/swapi/l1/swapi_l1.py +60 -31
  67. imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +363 -384
  68. imap_processing/swe/l1a/swe_l1a.py +8 -3
  69. imap_processing/swe/l1a/swe_science.py +24 -24
  70. imap_processing/swe/l1b/swe_l1b.py +2 -1
  71. imap_processing/swe/l1b/swe_l1b_science.py +181 -122
  72. imap_processing/swe/l2/swe_l2.py +337 -70
  73. imap_processing/swe/utils/swe_utils.py +28 -0
  74. imap_processing/tests/cdf/test_utils.py +2 -2
  75. imap_processing/tests/codice/conftest.py +20 -17
  76. imap_processing/tests/codice/data/validation/imap_codice_l1a_hskp_20241110193622_v0.0.0.cdf +0 -0
  77. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-aggregated_20241110193700_v0.0.0.cdf +0 -0
  78. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-singles_20241110193700_v0.0.0.cdf +0 -0
  79. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-angular_20241110193700_v0.0.0.cdf +0 -0
  80. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-priority_20241110193700_v0.0.0.cdf +0 -0
  81. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-species_20241110193700_v0.0.0.cdf +0 -0
  82. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf +0 -0
  83. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-priority_20241110193700_v0.0.0.cdf +0 -0
  84. imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-species_20241110193700_v0.0.0.cdf +0 -0
  85. imap_processing/tests/codice/test_codice_l0.py +55 -121
  86. imap_processing/tests/codice/test_codice_l1a.py +147 -59
  87. imap_processing/tests/conftest.py +81 -22
  88. imap_processing/tests/ena_maps/test_ena_maps.py +309 -0
  89. imap_processing/tests/ena_maps/test_map_utils.py +286 -0
  90. imap_processing/tests/ena_maps/test_spatial_utils.py +161 -0
  91. imap_processing/tests/glows/conftest.py +7 -1
  92. imap_processing/tests/glows/test_glows_l1a_cdf.py +3 -7
  93. imap_processing/tests/glows/test_glows_l1a_data.py +34 -6
  94. imap_processing/tests/glows/test_glows_l1b_data.py +29 -17
  95. imap_processing/tests/glows/test_glows_l2.py +101 -0
  96. imap_processing/tests/hi/conftest.py +3 -3
  97. imap_processing/tests/hi/data/l1/imap_hi_l1b_45sensor-de_20250415_v999.cdf +0 -0
  98. imap_processing/tests/hi/data/l1/imap_his_pset-calibration-prod-config_20240101_v001.csv +31 -0
  99. imap_processing/tests/hi/test_hi_l1b.py +14 -9
  100. imap_processing/tests/hi/test_hi_l1c.py +136 -36
  101. imap_processing/tests/hi/test_l1a.py +0 -2
  102. imap_processing/tests/hi/test_science_direct_event.py +18 -14
  103. imap_processing/tests/hi/test_utils.py +16 -11
  104. imap_processing/tests/hit/helpers/__init__.py +0 -0
  105. imap_processing/tests/hit/helpers/l1_validation.py +405 -0
  106. imap_processing/tests/hit/test_data/sci_sample.ccsds +0 -0
  107. imap_processing/tests/hit/test_decom_hit.py +8 -10
  108. imap_processing/tests/hit/test_hit_l1a.py +117 -180
  109. imap_processing/tests/hit/test_hit_l1b.py +149 -55
  110. imap_processing/tests/hit/validation_data/hit_l1b_standard_sample2_nsrl_v4_3decimals.csv +62 -0
  111. imap_processing/tests/hit/validation_data/sci_sample_raw.csv +62 -0
  112. imap_processing/tests/ialirt/test_data/l0/20240827095047_SWE_IALIRT_packet.bin +0 -0
  113. imap_processing/tests/ialirt/test_data/l0/BinLog CCSDS_FRAG_TLM_20240826_152323Z_IALIRT_data_for_SDC.bin +0 -0
  114. imap_processing/tests/ialirt/test_data/l0/eu_SWP_IAL_20240826_152033.csv +644 -0
  115. imap_processing/tests/ialirt/test_data/l0/hi_fsw_view_1_ccsds.bin +0 -0
  116. imap_processing/tests/ialirt/test_data/l0/idle_export_eu.SWE_IALIRT_20240827_093852.csv +914 -0
  117. imap_processing/tests/ialirt/test_data/l0/imap_codice_l1a_hi-ialirt_20240523200000_v0.0.0.cdf +0 -0
  118. imap_processing/tests/ialirt/unit/test_process_codicehi.py +106 -0
  119. imap_processing/tests/ialirt/unit/test_process_ephemeris.py +33 -5
  120. imap_processing/tests/ialirt/unit/test_process_swapi.py +85 -0
  121. imap_processing/tests/ialirt/unit/test_process_swe.py +106 -0
  122. imap_processing/tests/idex/conftest.py +29 -1
  123. imap_processing/tests/idex/test_data/compressed_2023_102_14_24_55.pkts +0 -0
  124. imap_processing/tests/idex/test_data/non_compressed_2023_102_14_22_26.pkts +0 -0
  125. imap_processing/tests/idex/test_idex_l0.py +6 -3
  126. imap_processing/tests/idex/test_idex_l1a.py +151 -1
  127. imap_processing/tests/idex/test_idex_l1b.py +124 -2
  128. imap_processing/tests/lo/test_lo_l1a.py +62 -2
  129. imap_processing/tests/lo/test_lo_science.py +85 -0
  130. imap_processing/tests/lo/validation_data/Instrument_FM1_T104_R129_20240803_ILO_SPIN_EU.csv +2 -0
  131. imap_processing/tests/mag/conftest.py +16 -0
  132. imap_processing/tests/mag/test_mag_decom.py +6 -4
  133. imap_processing/tests/mag/test_mag_l1a.py +36 -7
  134. imap_processing/tests/mag/test_mag_l1b.py +55 -4
  135. imap_processing/tests/mag/test_mag_validation.py +148 -0
  136. imap_processing/tests/mag/validation/L1a/T001/all_p_ones.txt +19200 -0
  137. imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-in.bin +0 -0
  138. imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-out.csv +17 -0
  139. imap_processing/tests/mag/validation/L1a/T002/all_n_ones.txt +19200 -0
  140. imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-in.bin +0 -0
  141. imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-out.csv +17 -0
  142. imap_processing/tests/mag/validation/L1a/T003/field_like.txt +19200 -0
  143. imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-in.bin +0 -0
  144. imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-out.csv +17 -0
  145. imap_processing/tests/mag/validation/L1a/T004/field_like.txt +19200 -0
  146. imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-in.bin +0 -0
  147. imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-out.csv +17 -0
  148. imap_processing/tests/mag/validation/L1a/T005/field_like_range_change.txt +19200 -0
  149. imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-in.bin +0 -0
  150. imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-out.csv +17 -0
  151. imap_processing/tests/mag/validation/L1a/T006/hdr_field.txt +19200 -0
  152. imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-in.bin +0 -0
  153. imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-out.csv +17 -0
  154. imap_processing/tests/mag/validation/L1a/T007/hdr_field_and_range_change.txt +19200 -0
  155. imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-in.bin +0 -0
  156. imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-out.csv +17 -0
  157. imap_processing/tests/mag/validation/L1a/T008/field_like_range_change.txt +19200 -0
  158. imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-in.bin +0 -0
  159. imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-out.csv +17 -0
  160. imap_processing/tests/mag/validation/L1b/T009/data.bin +0 -0
  161. imap_processing/tests/mag/validation/L1b/T009/field_like_all_ranges.txt +19200 -0
  162. imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-in.csv +17 -0
  163. imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-magi-out.csv +17 -0
  164. imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-mago-out.csv +17 -0
  165. imap_processing/tests/mag/validation/L1b/T010/data.bin +0 -0
  166. imap_processing/tests/mag/validation/L1b/T010/field_like_all_ranges.txt +19200 -0
  167. imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-in.csv +17 -0
  168. imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-magi-out.csv +17 -0
  169. imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-mago-out.csv +17 -0
  170. imap_processing/tests/mag/validation/L1b/T011/data.bin +0 -0
  171. imap_processing/tests/mag/validation/L1b/T011/field_like_all_ranges.txt +19200 -0
  172. imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-in.csv +17 -0
  173. imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-magi-out.csv +17 -0
  174. imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-mago-out.csv +17 -0
  175. imap_processing/tests/spice/test_geometry.py +128 -133
  176. imap_processing/tests/spice/test_kernels.py +37 -37
  177. imap_processing/tests/spice/test_spin.py +184 -0
  178. imap_processing/tests/spice/test_time.py +43 -20
  179. imap_processing/tests/swapi/test_swapi_l1.py +11 -10
  180. imap_processing/tests/swapi/test_swapi_l2.py +13 -3
  181. imap_processing/tests/swe/test_swe_l1a.py +1 -1
  182. imap_processing/tests/swe/test_swe_l1b.py +20 -3
  183. imap_processing/tests/swe/test_swe_l1b_science.py +54 -35
  184. imap_processing/tests/swe/test_swe_l2.py +148 -5
  185. imap_processing/tests/test_cli.py +39 -7
  186. imap_processing/tests/test_quality_flags.py +19 -19
  187. imap_processing/tests/test_utils.py +3 -2
  188. imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -3314
  189. imap_processing/tests/ultra/test_data/mock_data.py +161 -0
  190. imap_processing/tests/ultra/unit/conftest.py +73 -0
  191. imap_processing/tests/ultra/unit/test_badtimes.py +58 -0
  192. imap_processing/tests/ultra/unit/test_cullingmask.py +87 -0
  193. imap_processing/tests/ultra/unit/test_de.py +61 -60
  194. imap_processing/tests/ultra/unit/test_ultra_l1a.py +3 -3
  195. imap_processing/tests/ultra/unit/test_ultra_l1b.py +51 -77
  196. imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +5 -5
  197. imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py +114 -0
  198. imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +86 -26
  199. imap_processing/tests/ultra/unit/test_ultra_l1c.py +1 -1
  200. imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +3 -3
  201. imap_processing/ultra/constants.py +11 -1
  202. imap_processing/ultra/l1a/ultra_l1a.py +2 -2
  203. imap_processing/ultra/l1b/badtimes.py +22 -5
  204. imap_processing/ultra/l1b/cullingmask.py +31 -5
  205. imap_processing/ultra/l1b/de.py +32 -37
  206. imap_processing/ultra/l1b/extendedspin.py +44 -20
  207. imap_processing/ultra/l1b/ultra_l1b.py +21 -22
  208. imap_processing/ultra/l1b/ultra_l1b_culling.py +190 -0
  209. imap_processing/ultra/l1b/ultra_l1b_extended.py +81 -30
  210. imap_processing/ultra/l1c/histogram.py +6 -2
  211. imap_processing/ultra/l1c/pset.py +6 -2
  212. imap_processing/ultra/l1c/ultra_l1c.py +2 -3
  213. imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +4 -3
  214. imap_processing/ultra/utils/ultra_l1_utils.py +70 -14
  215. imap_processing/utils.py +2 -2
  216. {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/METADATA +7 -2
  217. {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/RECORD +235 -152
  218. imap_processing/tests/codice/data/eu_unit_lookup_table.csv +0 -101
  219. imap_processing/tests/codice/data/idle_export_eu.COD_NHK_20230822_122700 2.csv +0 -100
  220. imap_processing/tests/codice/data/idle_export_raw.COD_NHK_20230822_122700.csv +0 -100
  221. imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
  222. imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
  223. imap_processing/tests/hit/test_data/sci_sample1.ccsds +0 -0
  224. imap_processing/tests/ultra/unit/test_spatial_utils.py +0 -125
  225. imap_processing/ultra/utils/spatial_utils.py +0 -221
  226. /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.bin +0 -0
  227. /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.csv +0 -0
  228. /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_CNT.bin +0 -0
  229. /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_DE.bin +0 -0
  230. /imap_processing/tests/hi/{test_data → data}/l0/H90_NHK_20241104.bin +0 -0
  231. /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_cnt_20241104.bin +0 -0
  232. /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_de_20241104.bin +0 -0
  233. /imap_processing/tests/hi/{test_data → data}/l0/README.txt +0 -0
  234. /imap_processing/tests/idex/{imap_idex_l0_raw_20231214_v001.pkts → test_data/imap_idex_l0_raw_20231214_v001.pkts} +0 -0
  235. /imap_processing/tests/idex/{impact_14_tof_high_data.txt → test_data/impact_14_tof_high_data.txt} +0 -0
  236. /imap_processing/tests/mag/{imap_mag_l1a_norm-magi_20251017_v001.cdf → validation/imap_mag_l1a_norm-magi_20251017_v001.cdf} +0 -0
  237. /imap_processing/tests/mag/{mag_l0_test_data.pkts → validation/mag_l0_test_data.pkts} +0 -0
  238. /imap_processing/tests/mag/{mag_l0_test_output.csv → validation/mag_l0_test_output.csv} +0 -0
  239. /imap_processing/tests/mag/{mag_l1_test_data.pkts → validation/mag_l1_test_data.pkts} +0 -0
  240. /imap_processing/tests/mag/{mag_l1a_test_output.csv → validation/mag_l1a_test_output.csv} +0 -0
  241. {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/LICENSE +0 -0
  242. {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/WHEEL +0 -0
  243. {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/entry_points.txt +0 -0
@@ -1,32 +1,43 @@
1
- """Tests the decommutation process for CoDICE CCSDS Packets. This also tests the
2
- unit conversion process for CoDICE housekeeping data."""
1
+ """Tests the decommutation process for CoDICE CCSDS Packets
3
2
 
4
- from pathlib import Path
3
+ The tests within ensure that the test L0 data can be decommed and result in
4
+ the expected APIDs, number of packets, and contain valid CCSDS header contents.
5
+ """
5
6
 
6
- import pandas as pd
7
7
  import pytest
8
8
  import xarray as xr
9
9
 
10
- from imap_processing import imap_module_directory
11
10
  from imap_processing.codice import codice_l0
12
- from imap_processing.codice.codice_l1a import create_hskp_dataset
13
- from imap_processing.utils import convert_raw_to_eu
14
-
15
- # Define the CCSDS header fields (which will be ignored in these tests)
16
- CCSDS_HEADER_FIELDS = [
17
- "shcoarse",
18
- "version",
19
- "type",
20
- "sec_hdr_flg",
21
- "pkt_apid",
22
- "seq_flgs",
23
- "src_seq_ctr",
24
- "pkt_len",
25
- ]
11
+ from imap_processing.codice.utils import CODICEAPID
12
+
13
+ from .conftest import TEST_L0_FILE
14
+
15
+ pytestmark = pytest.mark.external_test_data
16
+
17
+ EXPECTED_RESULTS = {
18
+ CODICEAPID.COD_NHK: 31778,
19
+ CODICEAPID.COD_LO_IAL: 18917,
20
+ CODICEAPID.COD_LO_PHA: 616,
21
+ CODICEAPID.COD_LO_SW_PRIORITY_COUNTS: 77,
22
+ CODICEAPID.COD_LO_SW_SPECIES_COUNTS: 77,
23
+ CODICEAPID.COD_LO_NSW_SPECIES_COUNTS: 77,
24
+ CODICEAPID.COD_LO_SW_ANGULAR_COUNTS: 77,
25
+ CODICEAPID.COD_LO_NSW_ANGULAR_COUNTS: 77,
26
+ CODICEAPID.COD_LO_NSW_PRIORITY_COUNTS: 77,
27
+ CODICEAPID.COD_LO_INST_COUNTS_AGGREGATED: 77,
28
+ CODICEAPID.COD_LO_INST_COUNTS_SINGLES: 77,
29
+ CODICEAPID.COD_HI_IAL: 18883,
30
+ CODICEAPID.COD_HI_PHA: 633,
31
+ CODICEAPID.COD_HI_INST_COUNTS_AGGREGATED: 77,
32
+ CODICEAPID.COD_HI_INST_COUNTS_SINGLES: 77,
33
+ CODICEAPID.COD_HI_OMNI_SPECIES_COUNTS: 77,
34
+ CODICEAPID.COD_HI_SECT_SPECIES_COUNTS: 77,
35
+ CODICEAPID.COD_HI_INST_COUNTS_PRIORITIES: 77,
36
+ }
26
37
 
27
38
 
28
39
  @pytest.fixture(scope="session")
29
- def decom_test_data() -> xr.Dataset:
40
+ def decom_test_data(_download_test_data) -> xr.Dataset:
30
41
  """Read test data from file and return a decommutated housekeeping packet.
31
42
 
32
43
  Returns
@@ -35,116 +46,39 @@ def decom_test_data() -> xr.Dataset:
35
46
  A decommutated housekeeping packet
36
47
  """
37
48
 
38
- packet_file = Path(
39
- f"{imap_module_directory}/tests/codice/data/"
40
- f"imap_codice_l0_raw_20241110_v001.pkts"
41
- )
42
-
43
- packet = codice_l0.decom_packets(packet_file)[1136]
49
+ packet = codice_l0.decom_packets(TEST_L0_FILE)
44
50
 
45
51
  return packet
46
52
 
47
53
 
48
- @pytest.fixture(scope="session")
49
- def validation_data() -> pd.core.frame.DataFrame:
50
- """Read in validation data from the CSV file
54
+ @pytest.mark.parametrize("apid", EXPECTED_RESULTS.keys())
55
+ def test_ccsds_headers(decom_test_data: xr.Dataset, apid):
56
+ """Tests that the CCSDS headers are present in the decommed data"""
51
57
 
52
- Returns
53
- -------
54
- validation_data : pandas.core.frame.DataFrame
55
- The validation data read from the CSV, cleaned up and ready to compare
56
- the decommutated packet with
57
- """
58
+ for ccsds_header_field in [
59
+ "shcoarse",
60
+ "version",
61
+ "type",
62
+ "sec_hdr_flg",
63
+ "pkt_apid",
64
+ "seq_flgs",
65
+ "src_seq_ctr",
66
+ "pkt_len",
67
+ ]:
68
+ assert ccsds_header_field in decom_test_data[apid]
58
69
 
59
- # Read in the CSV file
60
- validation_file = Path(
61
- f"{imap_module_directory}/tests/codice/data/"
62
- f"idle_export_raw.COD_NHK_20230822_122700.csv"
63
- )
64
- validation_data = pd.read_csv(validation_file, index_col="SHCOARSE")
65
70
 
66
- if "timestamp" in validation_data.columns:
67
- validation_data.drop(columns=["timestamp"], inplace=True, errors="ignore")
71
+ @pytest.mark.parametrize("apid", EXPECTED_RESULTS.keys())
72
+ def test_expected_apids(decom_test_data: xr.Dataset, apid):
73
+ """Tests that the expected APIDs are present in the decommed data"""
68
74
 
69
- return validation_data
75
+ assert apid in decom_test_data
70
76
 
71
77
 
72
- @pytest.mark.xfail(
73
- reason="Need to update to validate against new validation CDFs. See issue #1154."
74
- )
75
- def test_eu_hskp_data(
76
- decom_test_data: xr.Dataset,
77
- validation_data: pd.core.frame.DataFrame,
78
+ @pytest.mark.parametrize("apid, expected_num_packets", EXPECTED_RESULTS.items())
79
+ def test_expected_total_packets(
80
+ decom_test_data: xr.Dataset, apid, expected_num_packets
78
81
  ):
79
- """Compare the engineering unit (EU) housekeeping data to the validation data.
80
-
81
- Parameters
82
- ----------
83
- decom_test_data : xr.Dataset
84
- The decommutated housekeeping packet
85
- validation_data : pandas.core.frame.DataFrame
86
- The validation data to compare against
87
- """
88
-
89
- l1a_hk_ds = create_hskp_dataset(decom_test_data, "001")
90
- eu_hk_data = convert_raw_to_eu(
91
- l1a_hk_ds,
92
- imap_module_directory / "tests/codice/data/eu_unit_lookup_table.csv",
93
- "P_COD_NHK",
94
- )
95
-
96
- validation_row = validation_data.loc[decom_test_data.shcoarse]
97
-
98
- # Compare EU values of housekeeping data, skipping CCSDS header fields
99
- for field in eu_hk_data:
100
- # Skip header values
101
- if field in CCSDS_HEADER_FIELDS:
102
- continue
103
-
104
- eu_values = getattr(eu_hk_data, field).data
105
- validation_values = validation_row[field.upper()]
106
-
107
- # Compare each individual element
108
- for eu_val, validation_val in zip(eu_values, validation_values):
109
- assert round(eu_val, 5) == round(validation_val, 5)
110
-
111
-
112
- @pytest.mark.xfail(
113
- reason="Need to update to validate against new validation CDFs. See issue #1154."
114
- )
115
- def test_raw_hskp_data(
116
- decom_test_data: xr.Dataset,
117
- validation_data: pd.core.frame.DataFrame,
118
- ):
119
- """Compare the raw housekeeping data to the validation data.
120
-
121
- Parameters
122
- ----------
123
- decom_test_data : xr.Dataset
124
- The decommutated housekeeping packet
125
- validation_data : pandas.core.frame.DataFrame
126
- The validation data to compare against
127
- """
128
-
129
- validation_row = validation_data.loc[decom_test_data.shcoarse]
130
-
131
- # Compare raw values of housekeeping data
132
- for field in decom_test_data:
133
- if field not in CCSDS_HEADER_FIELDS:
134
- raw_values = getattr(decom_test_data, field).data
135
- validation_values = validation_row[field.upper()]
136
- for raw_value, validation_value in zip(raw_values, validation_values):
137
- assert raw_value == validation_value
138
-
139
-
140
- def test_total_packets_in_data_file(decom_test_data: xr.Dataset):
141
- """Test if total packets in data file is correct
142
-
143
- Parameters
144
- ----------
145
- decom_test_data : xr.Dataset
146
- The decommutated housekeeping packet
147
- """
82
+ """Test if total packets in the decommed data is correct"""
148
83
 
149
- total_packets = 31778
150
- assert len(decom_test_data.epoch) == total_packets
84
+ assert len(decom_test_data[apid].epoch) == expected_num_packets
@@ -7,6 +7,7 @@ import pytest
7
7
  import xarray as xr
8
8
 
9
9
  from imap_processing.cdf.utils import load_cdf, write_cdf
10
+ from imap_processing.codice import constants
10
11
  from imap_processing.codice.codice_l1a import process_codice_l1a
11
12
 
12
13
  from .conftest import TEST_L0_FILE, VALIDATION_DATA
@@ -14,18 +15,41 @@ from .conftest import TEST_L0_FILE, VALIDATION_DATA
14
15
  logger = logging.getLogger(__name__)
15
16
  logger.setLevel(logging.INFO)
16
17
 
18
+ pytestmark = pytest.mark.external_test_data
19
+
20
+ DESCRIPTORS = [
21
+ "hi-ialirt",
22
+ "lo-ialirt",
23
+ "hskp",
24
+ "lo-counters-aggregated",
25
+ "lo-counters-singles",
26
+ "lo-sw-priority",
27
+ "lo-nsw-priority",
28
+ "lo-sw-species",
29
+ "lo-nsw-species",
30
+ "lo-sw-angular",
31
+ "lo-nsw-angular",
32
+ "hi-counters-aggregated",
33
+ "hi-counters-singles",
34
+ "hi-omni",
35
+ "hi-sectored",
36
+ "hi-priority",
37
+ "lo-pha",
38
+ "hi-pha",
39
+ ]
40
+
17
41
  EXPECTED_ARRAY_SHAPES = [
18
42
  (), # hi-ialirt # TODO: Need to implement
19
43
  (), # lo-ialirt # TODO: Need to implement
20
44
  (31778,), # hskp
21
- (77, 128, 6, 6), # lo-counters-aggregated
22
- (77, 128, 24, 6), # lo-counters-singles
23
- (77, 128, 1, 12), # lo-sw-priority
24
- (77, 128, 1, 12), # lo-nsw-priority
25
- (77, 128, 1, 1), # lo-sw-species
26
- (77, 128, 1, 1), # lo-nsw-species
27
- (77, 128, 5, 12), # lo-sw-angular
28
- (77, 128, 19, 12), # lo-nsw-angular
45
+ (77, 6, 128), # lo-counters-aggregated
46
+ (77, 24, 6, 128), # lo-counters-singles
47
+ (77, 12, 128), # lo-sw-priority
48
+ (77, 12, 128), # lo-nsw-priority
49
+ (77, 1, 128), # lo-sw-species
50
+ (77, 1, 128), # lo-nsw-species
51
+ (77, 5, 12, 128), # lo-sw-angular
52
+ (77, 19, 12, 128), # lo-nsw-angular
29
53
  (77, 1, 6, 1), # hi-counters-aggregated
30
54
  (77, 1, 12, 1), # hi-counters-singles
31
55
  (77, 15, 4, 1), # hi-omni
@@ -35,43 +59,22 @@ EXPECTED_ARRAY_SHAPES = [
35
59
  (), # hi-pha # TODO: Need to implement
36
60
  ]
37
61
 
38
- EXPECTED_LOGICAL_SOURCES = [
39
- "imap_codice_l1a_hi-ialirt",
40
- "imap_codice_l1a_lo-ialirt",
41
- "imap_codice_l1a_hskp",
42
- "imap_codice_l1a_lo-counters-aggregated",
43
- "imap_codice_l1a_lo-counters-singles",
44
- "imap_codice_l1a_lo-sw-priority",
45
- "imap_codice_l1a_lo-nsw-priority",
46
- "imap_codice_l1a_lo-sw-species",
47
- "imap_codice_l1a_lo-nsw-species",
48
- "imap_codice_l1a_lo-sw-angular",
49
- "imap_codice_l1a_lo-nsw-angular",
50
- "imap_codice_l1a_hi-counters-aggregated",
51
- "imap_codice_l1a_hi-counters-singles",
52
- "imap_codice_l1a_hi-omni",
53
- "imap_codice_l1a_hi-sectored",
54
- "imap_codice_l1a_hi-priority",
55
- "imap_codice_l1a_lo-pha",
56
- "imap_codice_l1a_hi-pha",
57
- ]
58
-
59
62
  EXPECTED_NUM_VARIABLES = [
60
63
  0, # hi-ialirt # TODO: Need to implement
61
64
  0, # lo-ialirt # TODO: Need to implement
62
65
  148, # hskp
63
- 3, # lo-counters-aggregated
64
- 3, # lo-counters-singles
65
- 7, # lo-sw-priority
66
- 4, # lo-nsw-priority
67
- 18, # lo-sw-species
68
- 10, # lo-nsw-species
69
- 6, # lo-sw-angular
70
- 3, # lo-nsw-angular
66
+ 8 + len(constants.LO_COUNTERS_AGGREGATED_VARIABLE_NAMES), # lo-counters-aggregated
67
+ 9, # lo-counters-singles
68
+ 13, # lo-sw-priority
69
+ 10, # lo-nsw-priority
70
+ 24, # lo-sw-species
71
+ 16, # lo-nsw-species
72
+ 12, # lo-sw-angular
73
+ 9, # lo-nsw-angular
71
74
  1, # hi-counters-aggregated
72
75
  3, # hi-counters-singles
73
- 8, # hi-omni
74
- 4, # hi-sectored
76
+ 10, # hi-omni
77
+ 6, # hi-sectored
75
78
  0, # hi-priority # TODO: Need to implement
76
79
  0, # lo-pha # TODO: Need to implement
77
80
  0, # hi-pha # TODO: Need to implement
@@ -114,13 +117,27 @@ def test_l1a_data_array_shape(test_l1a_data, index):
114
117
  pytest.xfail("Data product is currently unsupported")
115
118
 
116
119
  for variable in processed_dataset:
120
+ # For variables with energy dimensions
117
121
  if variable in ["energy_table", "acquisition_time_per_step"]:
118
122
  assert processed_dataset[variable].data.shape == (128,)
123
+ # For "support" variables with epoch dimensions
124
+ elif variable in [
125
+ "rgfo_half_spin",
126
+ "nso_half_spin",
127
+ "sw_bias_gain_mode",
128
+ "st_bias_gain_mode",
129
+ "data_quality",
130
+ "spin_period",
131
+ ]:
132
+ assert processed_dataset[variable].data.shape == (
133
+ len(processed_dataset["epoch"].data),
134
+ )
135
+ # For counter variables
119
136
  else:
120
137
  assert processed_dataset[variable].data.shape == expected_shape
121
138
 
122
139
 
123
- @pytest.mark.parametrize("index", range(len(EXPECTED_LOGICAL_SOURCES)))
140
+ @pytest.mark.parametrize("index", range(len(DESCRIPTORS)))
124
141
  def test_l1a_logical_sources(test_l1a_data, index):
125
142
  """Tests that the Logical source of the dataset is what is expected.
126
143
 
@@ -136,11 +153,11 @@ def test_l1a_logical_sources(test_l1a_data, index):
136
153
  """
137
154
 
138
155
  processed_dataset = test_l1a_data[index]
139
- expected_logical_source = EXPECTED_LOGICAL_SOURCES[index]
156
+ expected_logical_source = f"imap_codice_l1a_{DESCRIPTORS[index]}"
140
157
 
141
158
  # Mark currently broken/unsupported datasets as expected to fail
142
159
  # TODO: Remove these once they are supported
143
- if index in [0, 1, 2, 15, 16, 17]:
160
+ if index in [0, 1, 15, 16, 17]:
144
161
  pytest.xfail("Data product is currently unsupported")
145
162
 
146
163
  # Write the dataset to a file to set the logical source attribute
@@ -150,9 +167,11 @@ def test_l1a_logical_sources(test_l1a_data, index):
150
167
 
151
168
 
152
169
  @pytest.mark.parametrize("index", range(len(EXPECTED_NUM_VARIABLES)))
153
- def test_l1a_num_variables(test_l1a_data, index):
154
- """Tests that the data arrays in the generated CDFs have the expected number
155
- of variables.
170
+ def test_l1a_num_data_variables(test_l1a_data, index):
171
+ """Tests that the generated CDFs have the expected number of data variables.
172
+
173
+ These data variables include counter data (e.g. hplus, heplus, etc.) as well
174
+ as any "support" variables (e.g. data_quality, spin_period, etc.).
156
175
 
157
176
  Parameters
158
177
  ----------
@@ -172,14 +191,9 @@ def test_l1a_num_variables(test_l1a_data, index):
172
191
  assert len(processed_dataset) == EXPECTED_NUM_VARIABLES[index]
173
192
 
174
193
 
175
- @pytest.mark.skip("Awaiting validation data")
176
194
  @pytest.mark.parametrize("index", range(len(VALIDATION_DATA)))
177
- def test_l1a_data_array_values(test_l1a_data: xr.Dataset, index):
178
- """Tests that the generated L1a CDF contents are valid.
179
-
180
- Once proper validation files are acquired, this test function should point
181
- to those. This function currently just serves as a framework for validating
182
- files, but does not actually validate them.
195
+ def test_l1a_validate_data_arrays(test_l1a_data: xr.Dataset, index):
196
+ """Tests that the generated L1a CDF data array contents are valid.
183
197
 
184
198
  Parameters
185
199
  ----------
@@ -189,15 +203,89 @@ def test_l1a_data_array_values(test_l1a_data: xr.Dataset, index):
189
203
  The index of the list to test
190
204
  """
191
205
 
192
- generated_dataset = test_l1a_data
193
- validation_dataset = load_cdf(VALIDATION_DATA[index])
206
+ descriptor = DESCRIPTORS[index]
207
+
208
+ if descriptor == "hskp":
209
+ pytest.skip("Housekeeping data is validated in a separate test")
210
+
211
+ # TODO: Currently only the following products can be validated, expand this
212
+ # to other data products as I can validate them.
213
+ able_to_be_validated = [
214
+ "lo-counters-aggregated",
215
+ "lo-counters-singles",
216
+ "lo-sw-angular",
217
+ "lo-nsw-angular",
218
+ "lo-sw-priority",
219
+ "lo-nsw-priority",
220
+ "lo-sw-species",
221
+ "lo-nsw-species",
222
+ ]
223
+ if descriptor in able_to_be_validated:
224
+ counters = getattr(
225
+ constants, f'{descriptor.upper().replace("-","_")}_VARIABLE_NAMES'
226
+ )
227
+ processed_dataset = test_l1a_data[index]
228
+ validation_dataset = load_cdf(VALIDATION_DATA[index])
229
+
230
+ for counter in counters:
231
+ # Ensure the data array shapes are equal
232
+ assert (
233
+ processed_dataset[counter].data.shape
234
+ == validation_dataset[counter].data.shape
235
+ )
194
236
 
195
- # Ensure the processed data matches the validation data
196
- for variable in validation_dataset:
197
- assert variable in generated_dataset
198
- if variable != "epoch":
237
+ # TODO: Once Joey and I figure out some small discrepancies with
238
+ # some data products, we should get matching data array shapes
239
+ # AND values (i.e. run assert_array_equal on the arrays,
240
+ # instead of just checking shape)
241
+
242
+ else:
243
+ pytest.xfail(f"Still need to implement validation for {descriptor}")
244
+
245
+
246
+ def test_l1a_validate_hskp_data(test_l1a_data):
247
+ """Tests that the L1a housekeeping data is valid"""
248
+
249
+ # Housekeeping data is the 2nd element in the list of test products
250
+ hskp_data = test_l1a_data[2]
251
+ validation_hskp_filepath = VALIDATION_DATA[2]
252
+
253
+ # Load the validation housekeeping data
254
+ validation_hskp_data = load_cdf(validation_hskp_filepath)
255
+
256
+ # These variables are present in the decommed test data, but not present in
257
+ # the validation data
258
+ # TODO: Ask Joey if these can be removed from the L1a housekeeping CDFs
259
+ exclude_variables = [
260
+ "spare_1",
261
+ "spare_2",
262
+ "spare_3",
263
+ "spare_4",
264
+ "spare_5",
265
+ "spare_6",
266
+ "spare_62",
267
+ "spare_68",
268
+ ]
269
+
270
+ # These variables are not present in the validation data
271
+ # TODO: Ask joey if this is expected
272
+ exclude_variables.extend(
273
+ [
274
+ "version",
275
+ "type",
276
+ "sec_hdr_flg",
277
+ "pkt_apid",
278
+ "seq_flgs",
279
+ "src_seq_ctr",
280
+ "pkt_len",
281
+ "chksum",
282
+ ]
283
+ )
284
+
285
+ for variable in hskp_data:
286
+ if variable not in exclude_variables:
199
287
  np.testing.assert_array_equal(
200
- validation_dataset[variable].data, generated_dataset[variable].data[0]
288
+ hskp_data[variable], validation_hskp_data[variable.upper()]
201
289
  )
202
290
 
203
291
 
@@ -14,10 +14,10 @@ import numpy as np
14
14
  import pandas as pd
15
15
  import pytest
16
16
  import requests
17
- import spiceypy as spice
17
+ import spiceypy
18
18
 
19
19
  from imap_processing import imap_module_directory
20
- from imap_processing.spice.time import met_to_j2000ns
20
+ from imap_processing.spice.time import met_to_ttj2000ns
21
21
 
22
22
 
23
23
  @pytest.fixture(autouse=True)
@@ -42,19 +42,20 @@ def _autoclear_spice():
42
42
  prevent the kernel pool from interfering with future tests. Option autouse
43
43
  ensures this is run after every test."""
44
44
  yield
45
- spice.kclear()
45
+ spiceypy.kclear()
46
46
 
47
47
 
48
48
  @pytest.fixture(scope="session")
49
49
  def _download_external_kernels(spice_test_data_path):
50
- """This fixture downloads the de440s.bsp and pck00011.tpc kernels into the
51
- tests/spice/test_data directory if they do not already exist there. The
52
- fixture is not intended to be used directly. It is automatically added to
53
- tests marked with "external_kernel" in the hook below."""
50
+ """This fixture downloads externally-located kernels into the tests/spice/test_data
51
+ directory if they do not already exist there. The fixture is not intended to be
52
+ used directly. It is automatically added to tests marked with "external_kernel"
53
+ in the hook below."""
54
54
  logger = logging.getLogger(__name__)
55
55
  kernel_urls = [
56
56
  "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de440s.bsp",
57
57
  "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00011.tpc",
58
+ "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/earth_1962_240827_2124_combined.bpc",
58
59
  ]
59
60
 
60
61
  for kernel_url in kernel_urls:
@@ -90,6 +91,56 @@ def _download_external_kernels(spice_test_data_path):
90
91
  raise
91
92
 
92
93
 
94
+ @pytest.fixture(scope="session")
95
+ def _download_test_data(test_data_paths):
96
+ """This fixture downloads externally-located test data files into a specific
97
+ location. The list of files and their storage locations are specified in
98
+ the `test_data_paths` parameter, which is a list of tuples; the zeroth
99
+ element being the source of the test file in the AWS S3 bucket, and the
100
+ first element being the location in which to store the downloaded file."""
101
+
102
+ logger = logging.getLogger(__name__)
103
+
104
+ for test_data_path in test_data_paths:
105
+ source = test_data_path[0]
106
+ destination = test_data_path[1]
107
+
108
+ # Download the test data if necessary and write it to the appropriate
109
+ # directory
110
+ if not destination.exists():
111
+ response = requests.get(source, timeout=60)
112
+ if response.status_code == 200:
113
+ with open(destination, "wb") as file:
114
+ file.write(response.content)
115
+ logger.info(f"Downloaded file: {source}")
116
+ else:
117
+ logger.error(f"Failed to download file: {response.status_code}")
118
+ else:
119
+ logger.info(f"File already exists: {destination}")
120
+
121
+
122
+ @pytest.fixture(scope="session")
123
+ def test_data_paths():
124
+ """Defines a list of test data files to download from the AWS S3 bucket
125
+ and the corresponding location in which to store the downloaded file"""
126
+ test_data_path_list = [
127
+ (
128
+ "https://api.dev.imap-mission.com/download/test_data/imap_codice_l0_raw_20241110_v001.pkts",
129
+ imap_module_directory
130
+ / "tests"
131
+ / "codice"
132
+ / "data"
133
+ / "imap_codice_l0_raw_20241110_v001.pkts",
134
+ ),
135
+ (
136
+ "https://api.dev.imap-mission.com/download/test_data/imap_hi_l1a_45sensor-de_20250415_v999.cdf",
137
+ imap_module_directory
138
+ / "tests/hi/data/l1/imap_hi_l1a_45sensor-de_20250415_v999.cdf",
139
+ ),
140
+ ]
141
+ return test_data_path_list
142
+
143
+
93
144
  def pytest_collection_modifyitems(items):
94
145
  """
95
146
  The use of this hook allows modification of test `Items` after tests have
@@ -100,6 +151,7 @@ def pytest_collection_modifyitems(items):
100
151
  | pytest mark | fixture added |
101
152
  +=====================+============================+
102
153
  | external_kernel | _download_external_kernels |
154
+ | external_test_data | _download_test_data |
103
155
  | use_test_metakernel | use_test_metakernel |
104
156
  +---------------------+----------------------------+
105
157
 
@@ -109,11 +161,16 @@ def pytest_collection_modifyitems(items):
109
161
  pytest hook:
110
162
  https://docs.pytest.org/en/stable/reference/reference.html#pytest.hookspec.pytest_collection_modifyitems
111
163
  """
164
+ markers_to_fixtures = {
165
+ "external_kernel": "_download_external_kernels",
166
+ "external_test_data": "_download_test_data",
167
+ "use_test_metakernel": "use_test_metakernel",
168
+ }
169
+
112
170
  for item in items:
113
- if item.get_closest_marker("external_kernel") is not None:
114
- item.fixturenames.append("_download_external_kernels")
115
- if item.get_closest_marker("use_test_metakernel") is not None:
116
- item.fixturenames.append("use_test_metakernel")
171
+ for marker, fixture in markers_to_fixtures.items():
172
+ if item.get_closest_marker(marker) is not None:
173
+ item.fixturenames.append(fixture)
117
174
 
118
175
 
119
176
  @pytest.fixture(scope="session")
@@ -124,22 +181,22 @@ def spice_test_data_path(imap_tests_path):
124
181
  @pytest.fixture()
125
182
  def furnish_time_kernels(spice_test_data_path):
126
183
  """Furnishes (temporarily) the testing LSK and SCLK"""
127
- spice.kclear()
184
+ spiceypy.kclear()
128
185
  test_lsk = spice_test_data_path / "naif0012.tls"
129
186
  test_sclk = spice_test_data_path / "imap_sclk_0000.tsc"
130
- spice.furnsh(str(test_lsk))
131
- spice.furnsh(str(test_sclk))
187
+ spiceypy.furnsh(str(test_lsk))
188
+ spiceypy.furnsh(str(test_sclk))
132
189
  yield test_lsk, test_sclk
133
- spice.kclear()
190
+ spiceypy.kclear()
134
191
 
135
192
 
136
193
  @pytest.fixture()
137
194
  def furnish_sclk(spice_test_data_path):
138
195
  """Furnishes (temporarily) the SCLK for JPSS stored in the package data directory"""
139
196
  test_sclk = spice_test_data_path / "imap_sclk_0000.tsc"
140
- spice.furnsh(str(test_sclk))
197
+ spiceypy.furnsh(str(test_sclk))
141
198
  yield test_sclk
142
- spice.kclear()
199
+ spiceypy.kclear()
143
200
 
144
201
 
145
202
  @pytest.fixture()
@@ -148,7 +205,9 @@ def furnish_kernels(spice_test_data_path):
148
205
 
149
206
  @contextmanager
150
207
  def furnish_kernels(kernels: list[Path]):
151
- with spice.KernelPool([str(spice_test_data_path / k) for k in kernels]) as pool:
208
+ with spiceypy.KernelPool(
209
+ [str(spice_test_data_path / k) for k in kernels]
210
+ ) as pool:
152
211
  yield pool
153
212
 
154
213
  return furnish_kernels
@@ -227,7 +286,7 @@ def session_test_metakernel(monkeypatch_session, tmpdir_factory, spice_test_data
227
286
  -----
228
287
  - This fixture needs to `scope=session` so that the SPICE_METAKERNEL
229
288
  environment variable is available for other fixtures that require time
230
- conversions using spice.
289
+ conversions using spiceypy.
231
290
  - No furnishing of kernels occur as part of this fixture. This allows other
232
291
  fixtures with lesser scope or individual tests to override the environment
233
292
  variable as needed. Use the `metakernel_path_not_set` fixture in tests that
@@ -239,7 +298,7 @@ def session_test_metakernel(monkeypatch_session, tmpdir_factory, spice_test_data
239
298
  make_metakernel_from_kernels(metakernel_path, kernels_to_load)
240
299
  monkeypatch_session.setenv("SPICE_METAKERNEL", str(metakernel_path))
241
300
  yield str(metakernel_path)
242
- spice.kclear()
301
+ spiceypy.kclear()
243
302
 
244
303
 
245
304
  @pytest.fixture()
@@ -289,7 +348,7 @@ def use_test_metakernel(
289
348
  make_metakernel_from_kernels(metakernel_path, kernels_to_load)
290
349
  monkeypatch.setenv("SPICE_METAKERNEL", str(metakernel_path))
291
350
  yield str(metakernel_path)
292
- spice.kclear()
351
+ spiceypy.kclear()
293
352
 
294
353
 
295
354
  @pytest.fixture()
@@ -404,7 +463,7 @@ def generate_spin_data():
404
463
  )
405
464
 
406
465
  # Convert spin_start_sec to datetime to set repointing times flags
407
- spin_start_dates = met_to_j2000ns(spin_start_sec + spin_start_subsec / 1000)
466
+ spin_start_dates = met_to_ttj2000ns(spin_start_sec + spin_start_subsec / 1000)
408
467
  spin_start_dates = cdflib.cdfepoch.to_datetime(spin_start_dates)
409
468
 
410
469
  # Convert DatetimeIndex to Series for using .dt accessor