Skip to content

Commit 1c6a8fd

Browse files
author
Menlo Innovations - CAVA Project
committed
Harrison L3 - KJON/LFAR - CoDICE Lo: Updated direct events to use apd_energy from L2 when calculating the mass_per_charge, updated coefficients in the mass_coefficient_lookup.
1 parent 0ce3e3f commit 1c6a8fd

7 files changed

Lines changed: 12 additions & 11 deletions

File tree

imap_l3_processing/codice/l3/lo/codice_lo_l3a_direct_events_dependencies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ def fetch_dependencies(cls, dependencies: ProcessingInputCollection):
5858
direct_events_downloaded_path = download(direct_events_path)
5959

6060
mass_coefficients_file_downloaded_path = download(mass_coefficients_file_path.name)
61-
energy_per_charge_lookup_donwloaded_path = download(energy_per_charge_file_path.name)
61+
energy_per_charge_lookup_downloaded_path = download(energy_per_charge_file_path.name)
6262

6363
return cls.from_file_paths(
6464
sw_priority_rates_downloaded_path,
6565
nsw_priority_rates_downloaded_path,
6666
direct_events_downloaded_path,
6767
mass_coefficients_file_downloaded_path,
68-
energy_per_charge_lookup_donwloaded_path
68+
energy_per_charge_lookup_downloaded_path
6969
)
7070

7171
@classmethod

imap_l3_processing/codice/l3/lo/codice_lo_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def process_l3a_direct_event_data_product(self, dependencies: CodiceLoL3aDirectE
191191
esa_energy_per_charge_lookup.num_bins, spin_angle_lut.num_bins), np.nan)
192192

193193
try:
194-
mass_per_charge = calculate_mass_per_charge(codice_direct_events.energy_step, codice_direct_events.tof)
194+
mass_per_charge = calculate_mass_per_charge(codice_direct_events.apd_energy, codice_direct_events.tof)
195195
mass = calculate_mass(codice_direct_events.apd_energy, codice_direct_events.tof, mass_coefficient_lookup)
196196

197197
spin_angle = (codice_direct_events.spin_angle + CODICE_SPIN_ANGLE_OFFSET_FROM_MAG_BOOM) % 360

tests/codice/l3/lo/science/test_codice_lo_calculations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_calculate_mass(self):
7575

7676
def test_calculate_mass_per_charge(self):
7777
tof = np.array([[5], [6]])
78-
energy_step = np.array([[1], [2]])
78+
apd_energy = np.array([[1], [2]])
7979

8080
POST_ACCELERATION_VOLTAGE_IN_KV = 15
8181
ENERGY_LOST_IN_CARBON_FOIL = 0
@@ -87,14 +87,14 @@ def test_calculate_mass_per_charge(self):
8787
mass_per_charge_2 = (2 + POST_ACCELERATION_VOLTAGE_IN_KV - ENERGY_LOST_IN_CARBON_FOIL) * (
8888
6 ** 2) * CONVERSION_CONSTANT_K
8989

90-
actual_mass_per_charge = calculate_mass_per_charge(energy_step, tof)
90+
actual_mass_per_charge = calculate_mass_per_charge(apd_energy, tof)
9191
np.testing.assert_array_equal(actual_mass_per_charge, np.array([[mass_per_charge_1], [mass_per_charge_2]]))
9292

9393
def test_calculate_mass_per_charge_handles_fill_value(self):
9494
tof = np.ma.masked_array([[432, 234], [434, 347]], mask=[[False, True], [True, False]])
95-
energy_step = np.array([[np.nan, 2342.2], [4324.8, np.nan]])
95+
apd_energy = np.array([[np.nan, 2342.2], [4324.8, np.nan]])
9696

97-
actual_mass_per_charge = calculate_mass_per_charge(energy_step, tof)
97+
actual_mass_per_charge = calculate_mass_per_charge(apd_energy, tof)
9898

9999
self.assertIsInstance(actual_mass_per_charge, np.ma.masked_array)
100100
actual_filled_with_nan = np.ma.filled(actual_mass_per_charge, np.nan)

tests/codice/l3/lo/test_codice_lo_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def test_process_l3a_direct_events(self, mock_calculate_mass, mock_calculate_mas
522522
np.testing.assert_equal(mock_calculate_mass.call_args.args[2], dependencies.mass_coefficient_lookup)
523523

524524
self.assertEqual(1, mock_calculate_mass_per_charge.call_count)
525-
np.testing.assert_equal(mock_calculate_mass_per_charge.call_args.args[0], expected_energy_step)
525+
np.testing.assert_equal(mock_calculate_mass_per_charge.call_args.args[0], expected_apd_energy)
526526
np.testing.assert_equal(mock_calculate_mass_per_charge.call_args.args[1], expected_tof)
527527

528528
expected_spin_angles = (codice_l2_variables['spin_angle'] + 316) % 360

tests/integration/test_codice_processor_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CodiceProcessorIntegration(unittest.TestCase):
2020
@patch("imap_l3_data_processor._parse_cli_arguments")
2121
def test_codice_processor_integration(self, mock_parse_cli_arguments):
2222
energy_per_charge_path = get_test_data_path('codice/imap_codice_lo-energy-per-charge_20241110_v001.csv')
23-
mass_coefficient_path = get_test_data_path('codice/imap_codice_mass-coefficient-lookup_20241110_v002.csv')
23+
mass_coefficient_path = get_test_data_path('codice/imap_codice_mass-coefficient-lookup_20241110_v003.csv')
2424
input_files = [
2525
self.TEST_DATA_DIR / 'imap_codice_l2_lo-direct-events_20250814_v001.cdf',
2626
self.TEST_DATA_DIR / 'imap_codice_l1a_lo-nsw-priority_20250814_v001.cdf',
@@ -64,7 +64,7 @@ def test_codice_processor_integration(self, mock_parse_cli_arguments):
6464
'imap_codice_l1a_lo-nsw-priority_20250814_v001.cdf',
6565
'imap_codice_l1a_lo-sw-priority_20250814_v001.cdf',
6666
'imap_codice_lo-energy-per-charge_20241110_v001.csv',
67-
'imap_codice_mass-coefficient-lookup_20241110_v002.csv'}
67+
'imap_codice_mass-coefficient-lookup_20241110_v003.csv'}
6868

6969
with CDF(str(expected_map_path)) as cdf:
7070
self.assertEqual(expected_parents, set(cdf.attrs["Parents"]))

tests/periodically_run_tests.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"test_l3bcde_first_time_processing": "2026-01-12T15:52:36.971070",
33
"test_spectral_fit_against_validation_data": "2026-01-13T13:11:14.411186",
4-
"test_calculate_pickup_ions_with_minimize": "2026-01-12T15:32:27.729881",
4+
"test_calculate_pickup_ions_with_minimize": "2026-01-19T15:33:51.973761",
55
"test_ultra_all_sp_maps": "2026-01-19T13:12:39.624757",
66
"test_ultra_combined_maps": null,
77
"test_ultra_combined_nsp_maps": "2026-01-13T12:56:50.237322",

tests/test_data/codice/imap_codice_mass-coefficient-lookup_20241110_v003.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-0.85674-0.363739-1.366120.303470.02904190.0557362

0 commit comments

Comments
 (0)