Skip to content

Commit

Permalink
Merge pull request #137 from kammerje/starfile_analysis_hotfix
Browse files Browse the repository at this point in the history
Starfile analysis hotfix
  • Loading branch information
wbalmer authored Jan 8, 2024
2 parents 82b4e10 + f7e8b9c commit 64f86e2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions spaceKLIP/analysistools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ def raw_contrast(self,

# Copy the starfile that will be used into this directory
starfile_ext = os.path.splitext(starfile)[1]
new_starfile_path = output_dir+'/user_starfile'+starfile_ext
new_starfile_path = output_dir+'/'+starfile.split('/')[-1]
new_header = '#'+starfile.split('/')[-1] + ' /// {}'.format(spectral_type)+'\n'
write_starfile(starfile, new_starfile_path, new_header)
contrast_curve_info_path = output_dir+'/contrast_curve_info.txt'
with open(contrast_curve_info_path, 'w') as ccinfo:
ccinfo.write(new_header)
log.info('Copying starfile {} to {}'.format(starfile, new_starfile_path))
write_starfile(starfile, new_starfile_path)

# Loop through concatenations.
for i, key in enumerate(self.database.red.keys()):
Expand Down Expand Up @@ -538,12 +542,13 @@ def calibrate_contrast(self,
resolution_fwhm = 1.025*resolution

# Get stellar magnitudes and filter zero points, but use the same file as rawcon
starfile = os.path.join(rawcon_dir, 'user_starfile.txt')
with open(starfile) as sf:
spectral_type = sf.readline().strip('\n').split(' /// ')[-1]
mstar, fzero = get_stellar_magnitudes(starfile,
spectral_type,
self.database.red[key]['INSTRUME'][j],
ccinfo = os.path.join(rawcon_dir, 'contrast_curve_info.txt')
with open(ccinfo) as cci:
starfile, spectral_type = cci.readline().strip('\n').split(' /// ')
starfile = os.path.join(rawcon_dir, starfile.replace('#',''))
mstar, fzero = get_stellar_magnitudes(starfile,
spectral_type,
self.database.red[key]['INSTRUME'][j],
output_dir=output_dir) # vegamag, Jy
filt = self.database.red[key]['FILTER'][j]
fstar = fzero[filt] / 10.**(mstar[filt] / 2.5) / 1e6 * np.max(offsetpsf) # MJy
Expand Down

0 comments on commit 64f86e2

Please sign in to comment.