diff --git a/imap_processing/hit/l1b/hit_l1b.py b/imap_processing/hit/l1b/hit_l1b.py index b170a1799a..0663ce37a0 100644 --- a/imap_processing/hit/l1b/hit_l1b.py +++ b/imap_processing/hit/l1b/hit_l1b.py @@ -16,7 +16,6 @@ from imap_processing.hit.l1b.constants import ( FILLVAL_FLOAT32, FILLVAL_INT64, - LIVESTIM_PULSES, SECTORS, SUMMED_PARTICLE_ENERGY_RANGE_MAPPING, ) @@ -108,8 +107,18 @@ def process_science_data( logical_source = None # Calculate fractional livetime from the livetime counter - livetime = l1a_counts_dataset["livetime_counter"] / LIVESTIM_PULSES - livetime = livetime.rename("livetime") + livetime = l1a_counts_dataset["livetime_counter"] + livetime_fraction = xr.zeros_like(livetime, dtype=np.float32) + + # Equation 8 in section 6.2 of the algorithm document + livetime1 = livetime <= 4101 + livetime2 = (livetime > 4101) & (livetime <= 16000) + livetime3 = livetime > 16000 + livetime_fraction[livetime1] = livetime[livetime1] * 3.41e-5 + 0.14 + livetime_fraction[livetime2] = livetime[livetime2] * 6.827e-5 + livetime_fraction[livetime3] = livetime[livetime3] * 1.04e-9 + + livetime = livetime_fraction.rename("livetime") # Process counts data to an L1B dataset based on the descriptor if descriptor == "standard-rates":