-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
HelperIns: GLOWSRelated to the GLOWS instrumentRelated to the GLOWS instrumentLevel: L2Level 2 processingLevel 2 processingbugSomething isn't workingSomething isn't working
Milestone
Description
Description
The photon flux calculation currently checks if the exposure_times array has non-zero length, but should handle per-bin zero exposure times to avoid division by zero or invalid flux values for individual bins.
Location
imap_processing/glows/l2/glows_l2_data.py:80-83
Current Implementation
# TODO: Only where exposure counts != 0
if len(self.exposure_times) != 0:
self.photon_flux = self.raw_histograms / self.exposure_times
self.flux_uncertainties = raw_uncertainties / self.exposure_timesThis checks the array length, but doesn't handle individual bins where exposure_times[i] == 0.
Required Changes
Implement element-wise division that handles zero exposure times gracefully:
# Initialize with zeros or fill values
self.photon_flux = np.zeros(len(self.raw_histograms))
self.flux_uncertainties = np.zeros(len(self.raw_histograms))
# Only calculate where exposure_times > 0
mask = self.exposure_times > 0
self.photon_flux[mask] = self.raw_histograms[mask] / self.exposure_times[mask]
self.flux_uncertainties[mask] = raw_uncertainties[mask] / self.exposure_times[mask]Alternatively, use np.divide with appropriate handling for divide-by-zero.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
HelperIns: GLOWSRelated to the GLOWS instrumentRelated to the GLOWS instrumentLevel: L2Level 2 processingLevel 2 processingbugSomething isn't workingSomething isn't working
Type
Projects
Status
Todo