Skip to content

Commit

Permalink
Merge pull request #3 from radicamc/dev
Browse files Browse the repository at this point in the history
Small bug fixes
  • Loading branch information
radicamc authored Apr 29, 2024
2 parents 53a841a + 5107f03 commit 74bb94a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions exotedrf/stage2.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ def badpixstep(datafiles, baseline_ints, space_thresh=15, time_thresh=10,
fancyprint('Starting temporal outlier flagging...')
# Median filter the data.
cube_filt = medfilt(newdata, (5, 1, 1))
cube_filt[:1] = cube_filt[2]
cube_filt[-2:] = cube_filt[-3]
cube_filt[:2] = np.median(cube_filt[2:7], axis=0)
cube_filt[-2:] = np.median(cube_filt[-8:-3], axis=0)
# Check along the time axis for outlier pixels.
std_dev = bn.nanmedian(np.abs(0.5*(newdata[0:-2] + newdata[2:]) - newdata[1:-1]), axis=0)
std_dev = np.where(std_dev == 0, np.nanmedian(std_dev), std_dev)
Expand Down Expand Up @@ -890,8 +890,8 @@ def tracingstep(datafiles, deepframe=None, calculate_stability=True,
# Combine with existing flags and overwrite old file.
for flag_file in pixel_flags:
with fits.open(flag_file) as old_flags:
old_flags[0].data = old_flags[0].data.astype(bool) | order0mask.astype(bool)
old_flags.writeto(flag_file, overwrite=True)
old_flags[1].data = (old_flags[1].data.astype(bool) | order0mask.astype(bool)).astype(int)
old_flags.writeto(flag_file, overwrite=True)
# Overwrite old flags file.
parts = pixel_flags[0].split('seg')
outfile = parts[0] + 'seg' + 'XXX' + parts[1][3:]
Expand Down
4 changes: 3 additions & 1 deletion exotedrf/stage3.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ def run(self, soss_width=40, specprofile=None, centroids=None,
if centroids is None:
raise ValueError('Centroids must be provided for box '
'extraction.')
centroids = pd.read_csv(centroids, comment='#')
# If file path is passed, open it.
if isinstance(centroids, str):
centroids = pd.read_csv(centroids, comment='#')
results = box_extract_soss(self.datafiles, centroids,
soss_width, do_plot=do_plot,
show_plot=show_plot,
Expand Down
2 changes: 1 addition & 1 deletion exotedrf/stage4.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def save_transmission_spectrum(wave, wave_err, dppm, dppm_err, order, outdir,
f.write('# Instrument: NIRISS/SOSS\n')
f.write('# Pipeline: exoTEDRF\n')
f.write('# 1D Extraction: {}\n'.format(extraction_type))
f.write('# Spectral Resoluton: {}\n'.format(resolution))
f.write('# Spectral Resolution: {}\n'.format(resolution))
f.write('# Author: {}\n'.format(os.environ.get('USER')))
f.write('# Date: {}\n'.format(datetime.utcnow().replace(microsecond=0).isoformat()))
f.write(fit_meta)
Expand Down

0 comments on commit 74bb94a

Please sign in to comment.