Skip to content

Commit

Permalink
Merge pull request #705 from kevin218/tjb_working
Browse files Browse the repository at this point in the history
Minor bug patches before v1.0
  • Loading branch information
taylorbell57 authored Sep 28, 2024
2 parents b797446 + 749ccf2 commit f09c39a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
1 change: 0 additions & 1 deletion demos/JWST/S3_miri_photometry_template.ecf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interp_method linear # Interpolate bad pixels. Options: None (if no inter
ctr_guess [698, 516] # Initial guess of centroid position. If None, will first perform centroiding on whole frame (can sometimes fail)
ctr_cutout_size 10 # Cutoff size all around the centroid after the coarse centroid calculation or first centroid guess when using the mgmc method.
centroid_method mgmc # Method used for centroiding. Options: mgmc, fgc
oneoverf_corr None # Options: None, meanerr, median
skip_apphot_bg False # Skips the background subtraction during the aperture photometry step
photap 5 # Size of photometry aperture in pixels
skyin 12 # Inner sky annulus edge, in pixels
Expand Down
3 changes: 2 additions & 1 deletion demos/JWST/S3_nircam_wfss_template.ecf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ ywindow [5,64] # Vertical axis as seen in DS9
xwindow [100,1700] # Horizontal axis as seen in DS9
src_pos_type gaussian # Determine source position when not given in header (Options: header, gaussian, weighted, max, hst, or a numeric value)
record_ypos True # Option to record the y position and width for each integration (only records if src_pos_type is gaussian)
dqmask False # Mask pixels with an odd entry in the DQ array
poly_wavelength True # Use an updated polynomial wavelength solution for NIRCam longwave spectroscopy instead of the linear wavelength solution currently assumed by STScI
dqmask True # Mask pixels with an odd entry in the DQ array
expand 1 # Super-sampling factor along cross-dispersion direction

# Outlier rejection along time axis
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
- pip:
- astraeus@git+https://github.com/kevin218/Astraeus@main
- celerite2 # Needed for GP
- crds
- crds<12 # Upper limit needed to avoid bugs with crds.get_context_name
- exotic-ld==3.2.0 # Lower limit needed for updated JWST sensitivity files, upper limit needed for breaking changes
- fleck
- image_registration@git+https://github.com/keflavich/image_registration@master # Need GitHub version to avoid np.float issue
Expand Down
2 changes: 1 addition & 1 deletion environment_pymc3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- arviz==0.12.1
- astraeus@git+https://github.com/kevin218/Astraeus@main
- celerite2 # Needed for GP
- crds
- crds<12 # Upper limit needed to avoid bugs with crds.get_context_name
- exoplanet
- exoplanet-core
- exotic-ld==3.2.0 # Lower limit needed for updated JWST sensitivity files, upper limit needed for breaking changes
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ install_requires =
ccdproc
celerite2 # Needed for GP
corner
crds
crds<12 # Upper limit needed to avoid bugs with crds.get_context_name
dynesty>1.0 # Lower limit needed for specific arguments
emcee>3.0.0 # Lower limit needed for specific arguments
exotic-ld==3.2.0 # Lower limit needed for updated JWST sensitivity files, upper limit needed for breaking changes
Expand Down
4 changes: 2 additions & 2 deletions src/eureka/S1_detector_processing/group_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def custom_ref_pixel(input_model, log, meta):
for nint in range(all_data.shape[0]):
for ngrp in range(all_data.shape[1]):
intgrp_data = all_data[nint, ngrp, :, :]
dqmask = np.where((dq[nint, ngrp, :, :] % 2 == 1) |
(dq[nint, ngrp, :, :] == 2))
dqmask = ((dq[nint, ngrp, :, :] % 2 == 1) |
(dq[nint, ngrp, :, :] == 2))
intgrp_data = np.ma.masked_where(dqmask, intgrp_data)

if meta.masktrace:
Expand Down
8 changes: 7 additions & 1 deletion src/eureka/S3_data_reduction/plots_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def phot_npix(data, meta):
plt.pause(0.2)


def phot_centroid_fgc(img, x, y, sx, sy, i, m, meta):
def phot_centroid_fgc(img, mask, x, y, sx, sy, i, m, meta):
"""
Plot of the gaussian fit to the centroid cutout. (Fig 3503)
Expand All @@ -845,6 +845,9 @@ def phot_centroid_fgc(img, x, y, sx, sy, i, m, meta):
img : 2D numpy array
Cutout of the center of the target which is used to determine the
centroid position.
mask: 2D numpy array
A False indicates the corresponding element of Data is good, a
True indicates it is bad, same shape as data.
x : float
Centroid position in x direction.
y : float
Expand All @@ -870,6 +873,9 @@ def phot_centroid_fgc(img, x, y, sx, sy, i, m, meta):
Cleaned up plot &
corrected plotting feature
"""
img = np.ma.copy(img)
img = np.ma.masked_where(mask, img)

plt.figure(3503)
plt.clf()
fig, ax = plt.subplots(2, 2, num=3503, figsize=(8, 8))
Expand Down
15 changes: 8 additions & 7 deletions src/eureka/S6_planet_spectra/s6_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,18 @@ def plot_spectra(eventlabel, ecf_path=None, s5_meta=None, input_meta=None):
# Phase Curve Amplitude, first order
suffix = planetSuffix+channelSuffix
meta.y_label = 'Phase Curve Amplitude'+suffix
elif meta.y_param_basic == 'pc_offset2':
# Phase Curve Offset, second order
elif meta.y_param_basic[:12] == 'offset_order':
# Phase Curve Offset, nth order
suffix = planetSuffix+channelSuffix
meta.y_label = 'Second Order Phase Curve Offset'+suffix
meta.y_label = (f'Order {meta.y_param_basic[12:]}\n' +
'Phase Curve Offset' + suffix)
if meta.y_label_unit is None:
meta.y_label_unit = '($^{\\circ}$E)'
elif meta.y_param_basic == 'pc_amp2':
# Phase Curve Amplitude, second order
elif meta.y_param_basic[:9] == 'amp_order':
# Phase Curve Amplitude, nth order
suffix = planetSuffix+channelSuffix
meta.y_label = ('Second Order Phase Curve Amplitude' +
suffix)
meta.y_label = (f'Order {meta.y_param_basic[9:]}\n' +
'Phase Curve Amplitude' + suffix)
elif meta.y_param_basic in [f'u{i}' for i in range(1, 5)]:
# Limb darkening parameter
suffix = channelSuffix
Expand Down
2 changes: 1 addition & 1 deletion src/eureka/lib/centerdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def centerdriver(method, data, guess, trim, radius, size, i, m, meta,

# only plot when we do the second fit
if (meta.isplots_S3 >= 5 and method[-4:] == '_sec' and i < meta.nplots):
plots_s3.phot_centroid_fgc(img, x, y, sx, sy, i, m, meta)
plots_s3.phot_centroid_fgc(img, msk, x, y, sx, sy, i, m, meta)

# Make trimming correction and return
return ((y, x) + cen - trim), extra, refrence_median_frame

0 comments on commit f09c39a

Please sign in to comment.