@@ -128,10 +128,10 @@ def sample_map_dataset():
128128 "ena_intensity_sys_err" : xr .DataArray (
129129 np .random .rand (* shape ) * 5 + 1 , dims = list (coords .keys ())
130130 ),
131- "bg_rates " : xr .DataArray (
131+ "bg_rate " : xr .DataArray (
132132 np .random .rand (* shape ) * 20 + 5 , dims = list (coords .keys ())
133133 ),
134- "bg_rates_unc " : xr .DataArray (
134+ "bg_rate_sys_err " : xr .DataArray (
135135 np .random .rand (* shape ) * 2 + 1 , dims = list (coords .keys ())
136136 ),
137137 "exposure_factor" : xr .DataArray (
@@ -301,10 +301,10 @@ def test_calculate_ena_signal_rates(empty_rectangular_map_dataset):
301301 name = "exposure_factor" ,
302302 dims = list (exposure_sizes .keys ()),
303303 ),
304- "bg_rates " : xr .DataArray (
304+ "bg_rate " : xr .DataArray (
305305 np .arange (np .prod (tuple (map_ds .sizes .values ()))).reshape (counts_shape )
306306 % 2 ,
307- name = "bg_rates " ,
307+ name = "bg_rate " ,
308308 dims = list (map_ds .sizes .keys ()),
309309 ),
310310 }
@@ -316,7 +316,7 @@ def test_calculate_ena_signal_rates(empty_rectangular_map_dataset):
316316 assert var_name in result_ds
317317 assert result_ds [var_name ].shape == counts_shape
318318 # Verify that there are no negative signal rates. The synthetic data combination
319- # where counts = 0, exposure_factor = 1, and bg_rates = 1 would result in
319+ # where counts = 0, exposure_factor = 1, and bg_rate = 1 would result in
320320 # an ena_signal_rate of (0 / 1) - 1 = -1
321321 assert np .nanmin (result_ds ["ena_signal_rates" ].values ) >= 0
322322 # Verify that the minimum finite uncertainty is sqrt(1) / exposure_factor.
@@ -345,9 +345,9 @@ def ena_intensity_map_ds(empty_rectangular_map_dataset):
345345 name = "ena_signal_rate_stat_unc" ,
346346 dims = list (map_ds .sizes .keys ()),
347347 ),
348- "bg_rates_unc " : xr .DataArray (
348+ "bg_rate_sys_err " : xr .DataArray (
349349 np .arange (np .prod (tuple (map_ds .sizes .values ()))).reshape (var_shape ) % 3 ,
350- name = "bg_rates_unc " ,
350+ name = "bg_rate_sys_err " ,
351351 dims = list (map_ds .sizes .keys ()),
352352 ),
353353 }
@@ -359,7 +359,7 @@ def ena_intensity_map_ds(empty_rectangular_map_dataset):
359359 )
360360 map_ds .update (
361361 {
362- "bg_rates " : xr .DataArray (
362+ "bg_rate " : xr .DataArray (
363363 np .ones (bg_shape ) * 5.0 ,
364364 dims = [d for d in map_ds .sizes .keys () if d != "calibration_prod" ],
365365 ),
@@ -566,7 +566,7 @@ def test_weighted_average_mathematical_correctness():
566566 np .array ([100.0 , 400.0 ]).reshape (1 , 1 , 2 , 1 , 1 ),
567567 dims = list (coords .keys ()),
568568 ),
569- "bg_rates " : xr .DataArray (
569+ "bg_rate " : xr .DataArray (
570570 np .array ([5.0 ]).reshape (1 , 1 , 1 , 1 ),
571571 dims = [d for d in coords .keys () if d != "calibration_prod" ],
572572 ),
@@ -624,7 +624,7 @@ def test_statistical_uncertainty_combination_correctness():
624624 sys_err_values , dims = list (coords .keys ())
625625 ),
626626 "ena_signal_rates" : xr .DataArray (flux_values , dims = list (coords .keys ())),
627- "bg_rates " : xr .DataArray (
627+ "bg_rate " : xr .DataArray (
628628 np .array ([1.0 , 2.0 ]).reshape (1 , 1 , 2 , 1 , 1 ), dims = list (coords .keys ())
629629 ),
630630 "exposure_factor" : xr .DataArray (
@@ -783,8 +783,8 @@ def test_process_single_pset_renames_variables(
783783
784784 # Check that variables were renamed
785785 assert "exposure_factor" in result
786- assert "bg_rates " in result
787- assert "bg_rates_unc " in result
786+ assert "bg_rate " in result
787+ assert "bg_rate_sys_err " in result
788788 # Original names should not exist
789789 assert "exposure_times" not in result
790790 assert "background_rates" not in result
@@ -834,16 +834,16 @@ def test_process_single_pset_exposure_time_weighting(
834834 descriptor = MapDescriptor .from_string ("h90-ena-h-sf-nsp-full-gcs-6deg-3mo" )
835835 energy_kev = xr .DataArray ([0.5 , 0.75 , 1.1 ], dims = ["esa_energy_step" ])
836836
837- # bg_rates should be multiplied by exposure_factor
837+ # bg_rate should be multiplied by exposure_factor
838838 result = process_single_pset (
839839 mock_pset_dataset ,
840840 energy_kev ,
841841 descriptor ,
842- vars_to_exposure_time_average = {"bg_rates " },
842+ vars_to_exposure_time_average = {"bg_rate " },
843843 )
844844
845- # bg_rates was 5.0, exposure_factor is 100.0, so result should be 500.0
846- assert np .allclose (result ["bg_rates " ].values , 500.0 )
845+ # bg_rate was 5.0, exposure_factor is 100.0, so result should be 500.0
846+ assert np .allclose (result ["bg_rate " ].values , 500.0 )
847847
848848
849849@mock .patch ("imap_processing.hi.hi_l2.calculate_ram_mask" )
@@ -973,10 +973,8 @@ def mock_map_dataset_for_rates():
973973 np .ones (exposure_shape ) * 10.0 ,
974974 dims = ["epoch" , "esa_energy_step" , "longitude" , "latitude" ],
975975 ),
976- "bg_rates" : xr .DataArray (
977- np .ones (shape ) * 2.0 , dims = list (coords .keys ())[:5 ]
978- ),
979- "bg_rates_unc" : xr .DataArray (
976+ "bg_rate" : xr .DataArray (np .ones (shape ) * 2.0 , dims = list (coords .keys ())[:5 ]),
977+ "bg_rate_sys_err" : xr .DataArray (
980978 np .ones (shape ) * 0.5 , dims = list (coords .keys ())[:5 ]
981979 ),
982980 "obs_date" : xr .DataArray (
0 commit comments