Skip to content

Commit

Permalink
added support for new nirc2 real-time controller header keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter committed Nov 15, 2023
1 parent 9bd224d commit ee52669
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
26 changes: 26 additions & 0 deletions nirc2_reduce/data/header_kw_dicts/nirc2_newrtc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
object: OBJECT
instrument: INSTRUME
observer: OBSERVER
date: DATE-OBS
time: DATE-BEG
filter: FILTER
wl: EFFWAVE
subc: NAXIS1
itime: ITIME
coadds: COADDS
isdome:
kw: AXESTAT
yesdome: not controlling
nodome: tracking
lamps:
kw: FLSPECTR
lampon: "on"
lampoff: "off"
shutter:
kw: SHRNAME
shutopen: "open"
shutclose: "closed"
warpx_file: nirc2_distort_X_post20150413_v1.fits
warpy_file: nirc2_distort_Y_post20150413_v1.fits
dfits_kws: ["OBJECT", "DATE-OBS", "FILTER", "EFFWAVE", "NAXIS1", "ITIME", "COADDS", "AXESTAT", "FLSPECTR", "SHRNAME", "DATE-BEG", "OBSERVER"]
4 changes: 1 addition & 3 deletions nirc2_reduce/flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def __init__(self, fnames_off, fnames_on):
off = np.nanmedian(self.frames_off, axis=0)
on = np.nanmedian(self.frames_on, axis=0)
if (np.nanmean(on) - np.nanmean(off))/np.nanmean(on) < 0.01:
warnings.warn(f'brightness difference between domeflaton and domeflatoff is near zero \
for flat including fname {fnames_on[0]}. setting to off. \
if this is a thermal filter (lp, ms) then this is probably ok')
warnings.warn(f'brightness difference between domeflaton and domeflatoff is near zero for flat including fname {fnames_on[0]}. setting to off. if this is a thermal filter (lp, ms) then this is probably ok', stacklevel=2)
flat = off
else:
flat = on - off
Expand Down
6 changes: 5 additions & 1 deletion nirc2_reduce/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ def com_crop_final(self, wx, wy=None, cutoff=None):

data_to_calc = np.copy(self.final)
data_to_calc[data_to_calc < 10*cutoff] = 0.0
com = center_of_mass(data_to_calc)
if np.sum(data_to_calc) == 0.0:
# prevents failures when low SNR
com = (self.final.shape[0]/2, self.final.shape[1]/2)
else:
com = center_of_mass(data_to_calc)

self.final = self.final[int(com[0]-wy):int(com[0]+wy), int(com[1]-wx):int(com[1]+wx)]

Expand Down

0 comments on commit ee52669

Please sign in to comment.