Skip to content

Commit

Permalink
Merge pull request #40 from CheerfulUser/dev
Browse files Browse the repository at this point in the history
Merging in from dev to fix ps1 calibration error
  • Loading branch information
CheerfulUser authored Nov 4, 2024
2 parents 6083c9f + 24af5ba commit f4cf9f0
Show file tree
Hide file tree
Showing 10 changed files with 11,671 additions and 9,560 deletions.
89 changes: 63 additions & 26 deletions examples/Aperture_vs_PSF.ipynb

Large diffs are not rendered by default.

5,321 changes: 5,281 additions & 40 deletions examples/SN_Example.ipynb

Large diffs are not rendered by default.

12,246 changes: 2,960 additions & 9,286 deletions paper_figs/Example_figures.ipynb

Large diffs are not rendered by default.

Binary file modified paper_figs/background_example_fqv.pdf
Binary file not shown.
3,546 changes: 3,344 additions & 202 deletions paper_figs/background_fqv.ipynb

Large diffs are not rendered by default.

Binary file added paper_figs/fqv_mask.pdf
Binary file not shown.
Binary file modified paper_figs/sn2018fub_diff_diag.pdf
Binary file not shown.
Binary file modified paper_figs/sn2020adw.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions tessreduce/catalog_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def Get_Catalogue(tpf, Catalog = 'gaia'):
raise no_targets_found_message
if Catalog != 'skymapper':
result = result[catalog].to_pandas()
if Catalog == 'ps1':
result = result[np.isfinite(result.rmag) & np.isfinite(result.imag)]
result = PS1_to_TESS_mag(result)

return result

Expand Down
26 changes: 20 additions & 6 deletions tessreduce/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def par_psf_source_mask(data,prf,sigma=5):
return m


def par_psf_initialise(flux,camera,ccd,sector,column,row,cutoutSize,loc,time_ind=None,ref=False):
def par_psf_initialise(flux,camera,ccd,sector,column,row,cutoutSize,loc,time_ind=None,ref=False,ffi=False):
"""
For gathering the cutouts and PRF base.
"""
Expand All @@ -677,14 +677,28 @@ def par_psf_initialise(flux,camera,ccd,sector,column,row,cutoutSize,loc,time_ind
loc[0] = int(loc[0]+0.5)
if (type(loc[1]) == float) | (type(loc[1]) == np.float64) | (type(loc[1]) == np.float32):
loc[1] = int(loc[1]+0.5)
col = column - int(flux.shape[2]/2-1) + loc[0] # find column and row, when specifying location on a *say* 90x90 px cutout
row = row - int(flux.shape[1]/2-1) + loc[1]

prf = TESS_PRF(camera,ccd,sector,col,row) # initialise psf kernel
if ffi:
col = column
else:
col = column - int(flux.shape[2]/2-1) + loc[0] # find column and row, when specifying location on a *say* 90x90 px cutout
row = row - int(flux.shape[1]/2-1) + loc[1]
try:
prf = TESS_PRF(camera,ccd,sector,col,row) # initialise psf kernel
except:
return np.nan
if ref:
cutout = (flux+ref)[time_ind,loc[1]-cutoutSize//2:loc[1]+1+cutoutSize//2,loc[0]-cutoutSize//2:loc[0]+1+cutoutSize//2] # gather cutouts
else:
cutout = flux[time_ind,loc[1]-cutoutSize//2:loc[1]+1+cutoutSize//2,loc[0]-cutoutSize//2:loc[0]+1+cutoutSize//2] # gather cutouts
if ffi:
cutout = flux[loc[1]-cutoutSize//2:loc[1]+1+cutoutSize//2,loc[0]-cutoutSize//2:loc[0]+1+cutoutSize//2] # gather cutouts
prf = create_psf(prf,cutoutSize)
try:
flux,pos = par_psf_full(cutout,prf,xlim=0.5,ylim=0.5)
except:
flux = np.nan
return flux
else:
cutout = flux[time_ind,loc[1]-cutoutSize//2:loc[1]+1+cutoutSize//2,loc[0]-cutoutSize//2:loc[0]+1+cutoutSize//2] # gather cutouts
prf = create_psf(prf,cutoutSize)
return prf, cutout

Expand Down

0 comments on commit f4cf9f0

Please sign in to comment.