Skip to content

Commit

Permalink
Merge branch 'dev' into stf_parallelize
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimat authored May 13, 2024
2 parents 7782bf8 + dc2ff64 commit d6008bf
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
7 changes: 5 additions & 2 deletions kai/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def get_position_angle(self, hdr):
"""
# pa = float(hdr['ROTPOSN']) - self.get_instrument_angle(hdr)
pa = hdr['PA_IMAG']

#if in PCU mode, read the PCU rotation angle instead
if 'PCUZ' in hdr.keys():
if hdr['PCUZ'] > 20:
Expand Down Expand Up @@ -366,6 +366,10 @@ def flip_images(self, files, rootDir=''):
# hdu_list[hh].data = new_data[::-1, :]
hdu_list[hh].data = new_data[::-1, :]

# Need to modify PA_IMAG to account for the flip. Added 2023-10-30 by J. Lu.
pa_orig = hdu_list[0].header['PA_IMAG']
hdu_list[0].header['PA_IMAG'] = 360.0 - pa_orig

hdu_list.writeto(new_file, overwrite=True)

# Add header values.
Expand Down Expand Up @@ -415,7 +419,6 @@ def get_saturation_level(self):
Set to the 95% saturation threshold in DN.
"""
return 17000.0


##################################################
#
Expand Down
12 changes: 10 additions & 2 deletions kai/reduce/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(self, epoch, rootDir='/g/lu/data/orion/', filt='kp',

self.starlist = rootDir + 'source_list/psf_central.dat'
self.labellist = rootDir+ 'source_list/label.dat'
self.labellist_accel = True
self.orbitlist = rootDir+ 'source_list/orbits.dat'
self.calFile = rootDir + 'source_list/photo_calib.dat'

Expand Down Expand Up @@ -780,11 +781,18 @@ def alignCombo(self):

# Make a named/labeled version
cmd = 'java -Xmx1024m align %s ' % (self.alignFlags)
#cmd += '-N %s ' % self.labellist
cmd += '-accel_file %s ' % self.labellist

# Support label.dat files with or without accelerations.
if self.labellist_accel:
cmd += '-accel_file %s ' % self.labellist
else:
cmd += '-N %s ' % self.labellist

if (self.orbitlist != None) and (self.orbitlist != ''):
cmd += '-o %s ' % self.orbitlist

cmd += '-r align%s%s_%3.1f_named ' % (self.imgSuffix, file_ext, self.corrMain[0])

cmd += alnList2
print(cmd)

Expand Down
18 changes: 10 additions & 8 deletions kai/reduce/calib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datetime import datetime
from pkg_resources import parse_version
import warnings
import pdb

module_dir = os.path.dirname(__file__)

Expand Down Expand Up @@ -225,14 +226,15 @@ def makeflat(

warnings.warn(warning_message)

# Perform linearity correction
for i in range(len(lampson_copied)):
lin_correction.lin_correction(lampson_copied[i],
instrument=instrument)

for i in range(len(lampsoff_copied)):
lin_correction.lin_correction(lampsoff_copied[i],
instrument=instrument)
# Perform linearity correction [only NIRC2]
if instrument is 'NIRC2':
for i in range(len(lampson_copied)):
lin_correction.lin_correction(lampson_copied[i],
instrument=instrument)

for i in range(len(lampsoff_copied)):
lin_correction.lin_correction(lampsoff_copied[i],
instrument=instrument)

if (len(offFiles) != 0):
f_on = open(_onlis, 'w')
Expand Down
3 changes: 2 additions & 1 deletion kai/reduce/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ def clean(
overwrite=True)

# Linearity correction
lin_correction.lin_correction(_cp, instrument=instrument)
if instrument is 'NIRC2':
lin_correction.lin_correction(_cp, instrument=instrument)

### Sky subtract ###
# Get the proper sky for this science frame.
Expand Down
2 changes: 1 addition & 1 deletion kai/reduce/masks/osiris_img_mask.fits

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions kai/reduce/sky.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def makesky(


# Perform linearity correction
for i in range(len(skies)):
lin_correction.lin_correction(nn[i], instrument=instrument)
if instrument is 'NIRC2':
for i in range(len(skies)):
lin_correction.lin_correction(nn[i], instrument=instrument)

# scale skies to common median
if skyscale:
Expand Down Expand Up @@ -306,8 +307,9 @@ def makesky_lp(
warnings.warn(warning_message)

# Perform linearity correction
for i in range(len(skies)):
lin_correction.lin_correction(skies[i], instrument=instrument)
if instrument is 'NIRC2':
for i in range(len(skies)):
lin_correction.lin_correction(skies[i], instrument=instrument)

# Read in the list of files and rotation angles
files, angles = read_sky_rot_file(_skyRot)
Expand Down

0 comments on commit d6008bf

Please sign in to comment.