def test_interp(): trigdat = get_path_of_data_file("glg_trigdat_all_bn080916009_v02.fit") interp_trig = PositionInterpolator.from_trigdat(trigdat) interp_trig.quaternion(0) interp_trig.sc_pos(0) assert interp_trig.is_fermi_active(1) == True trigdat_h5 = get_path_of_data_file("trigdat.h5") interp_trig_h5 = PositionInterpolator.from_trigdat_hdf5(trigdat_h5) assert np.all(interp_trig_h5.quaternion(0) == interp_trig.quaternion(0)) assert np.all(interp_trig_h5.sc_pos(0) == interp_trig.sc_pos(0)) assert interp_trig_h5.is_fermi_active(1) == True poshist = get_path_of_data_file("glg_poshist_all_151013_v00.fit") interp_pos = PositionInterpolator.from_poshist(poshist) tmin, tmax = interp_pos.minmax_time() interp_pos.is_fermi_active(tmin) interp_pos.is_fermi_active([tmin, tmax]) interp_pos.quaternion(interp_pos.time[0]) interp_pos.sc_pos(interp_pos.time[0]) poshist_h5 = get_path_of_data_file("posthist.h5") interp_pos_h5 = PositionInterpolator.from_poshist_hdf5(poshist_h5) assert np.all( interp_pos_h5.quaternion(interp_pos_h5.time[0]) == interp_pos.quaternion(interp_pos.time[0]) ) assert np.all( interp_pos_h5.sc_pos(interp_pos_h5.time[0]) == interp_pos.sc_pos(interp_pos.time[0]) )
def __init__(self): self._minimum_met = 576201540.940077 self._maximum_time = 86519.99999904633 self._T0 = self._minimum_met self._used_times = [] logger.debug("Setting up the GBM orbit") self._interpolator = PositionInterpolator.from_poshist_hdf5( get_path_of_data_file("posthist.h5"), T0=self._T0) self._tmin, self._tmax = self._interpolator.minmax_time() self._delta_time = self._tmax - self._tmin