File ~/gitrepos/gifts-6u/gifts-ground-software/gdt/missions/fermi/gbm/trigdat.py:171, in Trigdat.open(cls, file_path, **kwargs)
168 obj._rates = obj._data['RATE'].reshape(-1, 14, 8)
170 # store the position history
--> 171 idx, dt = obj._time_indices(1024)
172 eic = obj._data['EIC'][idx]
173 quat = obj._data['SCATTITD'][idx]
File ~/gitrepos/gifts-6u/gifts-ground-software/gdt/missions/fermi/gbm/trigdat.py:664, in Trigdat._time_indices(self, time_res)
662 cnt = len(idx)
663 # reconcile 8 s and 1 s data
--> 664 idx = self._reconcile_timescales(back_idx, idx)
666 # reconcile 8 s + 1 s and 256 ms data
667 if time_res <= 256:
File ~/gitrepos/gifts-6u/gifts-ground-software/gdt/missions/fermi/gbm/trigdat.py:703, in Trigdat._reconcile_timescales(self, idx1, idx2)
700 end_times2 = self._data['ENDTIME'][idx2]
702 # find where bracketing timescale ends and inserted timescale begins
--> 703 if mask.sum():
704 mask = end_times1 >= start_times2[0]
705 start_idx = (np.where(mask))[0][0]
UnboundLocalError: cannot access local variable 'mask' where it is not associated with a value
When loading a Trigdat file with
Trigdat.open()
:This appears to be related to the changes in https://github.com/USRA-STI/gdt-fermi/pull/22, where
mask
isn't declared prior to usage:https://github.com/USRA-STI/gdt-fermi/blob/ad6c3c3995efe8138ef170504ecf68a6786dc67e/src/gdt/missions/fermi/gbm/trigdat.py#L700-L712
It looks like moving the
mask
initialization to before the firstif mask.sum()
statement fixes it, i.e.: