def test_get_hk_thermal_correction(time_corr): dic, slit2 = time_corr months = [(2007, 8), (2008, 5), (2008, 9), (2008, 10)] arrs = {m: {d: dic[d] for d in filter(lambda t: (t.year, t.month) == m, dic)} for m in months} for month in arrs: dates = np.array(arrs[month].keys()) expecteds = np.array(arrs[month].values()) actuals = eu.calc_hk_thermal_corrections(dates, slit2) print expecteds print actuals print expecteds - actuals assert np.allclose(expecteds, actuals) print "month " + str(month) + " passed"
def test_get_hk_thermal_correction(time_corr): dic, slit2 = time_corr months = [(2007, 8), (2008, 5), (2008, 9), (2008, 10)] arrs = { m: {d: dic[d] for d in filter(lambda t: (t.year, t.month) == m, dic)} for m in months } for month in arrs: dates = np.array(list(arrs[month].keys())) expecteds = np.array(list(arrs[month].values())) actuals = eu.calc_hk_thermal_corrections(dates, slit2) assert np.allclose(expecteds, actuals)
def orbital_correction_new(self): """ Calculates the orbital corrections using the new housekeeping method, downloading the data if the fils are not found in the sunpy data folder """ slit = 2 if self.meta['SLIT_IND'] == 2 else 0 # 1" slit has index 0 # sit_and_stare = self.meta['FMIR_SS'] == 0 slit_tilt_corr = self._get_slit_tilt() times = self.get_exposure_times() thermal_corr = eu.calc_hk_thermal_corrections(times, slit == 2) doppler_corr = eu.calc_doppler_shift(times) time_corr = thermal_corr + doppler_corr time_corr -= eu.wavelength_to_ccd_pixel(195.12 * u.Angstrom) time_corr *= 0.022317 time_corr *= u.Angstrom corrections = [slit_tilt_corr + t for t in time_corr] return u.Quantity(corrections) * -1.