diff --git a/src/lkprf/data.py b/src/lkprf/data.py index 090fa17..fddf20f 100644 --- a/src/lkprf/data.py +++ b/src/lkprf/data.py @@ -170,6 +170,7 @@ def get_kepler_prf_file(module: int, output: int): ) download_kepler_prf_file(module=module, output=output) file_path = f"{PACKAGEDIR}/data/{filename}" + hdulist = fitsio.FITS(file_path) return hdulist @@ -186,6 +187,7 @@ def get_tess_prf_file(camera: int, ccd: int, sector: int = 4): f"No local files found, building TESS PRF for Camera {camera}, CCD {ccd}." ) build_tess_prf_file(camera=camera, ccd=ccd, sector=sector) + hdulist = fitsio.FITS(file_path) return hdulist diff --git a/src/lkprf/prfmodel.py b/src/lkprf/prfmodel.py index 71609a1..ecf8d7f 100644 --- a/src/lkprf/prfmodel.py +++ b/src/lkprf/prfmodel.py @@ -193,6 +193,7 @@ def _prepare_prf(self): """ hdulist = self._get_prf_data() + self.date = hdulist[0].read_header()['DATE'] PRFdata, crval1p, crval2p, cdelt1p, cdelt2p = [], [], [], [], [] for hdu in hdulist[1:]: PRFdata.append(hdu.read()) diff --git a/tests/test_prf.py b/tests/test_prf.py index 6a6d65a..59e6334 100644 --- a/tests/test_prf.py +++ b/tests/test_prf.py @@ -60,12 +60,14 @@ def test_prfs(): def test_prf_version(): + # TESS has a different set of measurements for early (1-3) sectors. + # Check to make sure it is reading out different files. + prf_sec1_3 = lkprf.TESSPRF(camera=1, ccd=1, sector= 1) prf_sec4_plus = lkprf.TESSPRF(camera=1, ccd=1, sector= 14) # If not specified, should default to sector 4+ measurements - prf_sec4_plus2 = lkprf.TESSPRF(camera=1, ccd=1) - - assert prf_sec1_3[1].read_header()['DATE'] == '30-Jan-2019' - assert prf_sec4_plus[1].read_header()['DATE'] == '01-May-2019' - assert prf_sec4_plus2[1].read_header()['DATE'] == '01-May-2019' - \ No newline at end of file + prf_sec4_notspecified = lkprf.TESSPRF(camera=1, ccd=1) + + assert prf_sec1_3.date == '30-Jan-2019' + assert prf_sec4_plus.date == '01-May-2019' + assert prf_sec4_notspecified == '01-May-2019'