Skip to content

Commit

Permalink
Save file origin date
Browse files Browse the repository at this point in the history
  • Loading branch information
Nschanche committed Aug 30, 2024
1 parent 562dec3 commit 848dff6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/lkprf/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/lkprf/prfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
14 changes: 8 additions & 6 deletions tests/test_prf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

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'

0 comments on commit 848dff6

Please sign in to comment.