-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #728 from kevin218/kbs
Stage 4cal (Calibrated Stellar Spectra)
- Loading branch information
Showing
36 changed files
with
1,000 additions
and
32,916 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
demos/JWST/CalibratedStellarSpectra/S2_nircam_wfss_template.ecf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Eureka! Control File for Stage 2: Data Reduction | ||
|
||
# Stage 2 Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-2 | ||
|
||
suffix rateints # Data file suffix | ||
|
||
# Controls the cross-dispersion extraction | ||
tsgrism_extract_height None # Use None to rely on the default parameters | ||
|
||
# Note: different instruments and modes will use different steps by default | ||
skip_flat_field False | ||
skip_photom False # Recommended to skip to get better uncertainties out of Stage 3. Set this to False if you want to compute calibrated stellar spectra. | ||
skip_extract_1d True | ||
|
||
# Diagnostics | ||
hide_plots True # If True, plots will automatically be closed rather than popping up | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRCam/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage1 | ||
outputdir Stage2 |
21 changes: 21 additions & 0 deletions
21
demos/JWST/CalibratedStellarSpectra/S2_nirspec_fs_template.ecf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Eureka! Control File for Stage 2: Data Reduction | ||
|
||
# Stage 2 Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-2 | ||
|
||
suffix rateints # Data file suffix | ||
|
||
# Note: different instruments and modes will use different steps by default | ||
skip_wavecorr True # By default is skipped for TSO data | ||
skip_flat_field False # Set this to False if you want to compute calibrated stellar spectra. | ||
skip_photom False # Recommended to skip to get better uncertainties out of Stage 3. Set this to False if you want to compute calibrated stellar spectra. | ||
skip_extract_1d True | ||
|
||
# Diagnostics | ||
hide_plots True # If True, plots will automatically be closed rather than popping up | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRSpec/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage1 | ||
outputdir Stage2 |
66 changes: 66 additions & 0 deletions
66
demos/JWST/CalibratedStellarSpectra/S3_nircam_wfss_template.ecf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Eureka! Control File for Stage 3: Data Reduction | ||
|
||
# Stage 3 Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-3 | ||
|
||
ncpu 4 # Number of CPUs | ||
nfiles 1 # The number of data files to analyze simultaneously | ||
max_memory 0.5 # The maximum fraction of memory you want utilized by read-in frames (this will reduce nfiles if need be) | ||
indep_batches False # Independently treat each batch of files? Strongly recommended to leave this as False unless you have a clear reason to set it to True. | ||
suffix calints # Data file suffix | ||
|
||
calibrated_spectra True # Set True to generate flux-calibrated spectra/photometry in mJy | ||
# Set False to convert to electrons | ||
|
||
# Subarray region of interest | ||
ywindow [5,64] # Vertical axis as seen in DS9 | ||
xwindow [790, 1950] # 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 False # Option to record the y position and width for each integration (only records if src_pos_type is gaussian) | ||
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 | ||
ff_outlier False # Set False to use only background region (recommended for deep transits) | ||
# Set True to use full frame (works well for shallow transits/eclipses) | ||
bg_thresh [4,4] # Double-iteration X-sigma threshold for outlier rejection along time axis | ||
|
||
# Background parameters | ||
bg_hw 20 # Half-width of exclusion region for BG subtraction (relative to source position) | ||
bg_deg 0 # Polynomial order for column-by-column background subtraction, -1 for median of entire frame | ||
bg_method median # Options: std (Standard Deviation), median (Median Absolute Deviation), mean (Mean Absolute Deviation) | ||
p3thresh 5 # X-sigma threshold for outlier rejection during background subtraction | ||
bg_row_by_row False # Row-by-row BG subtraction (only useful for NIRCam) | ||
bg_x1 None # Left edge of exclusion region for row-by-row BG subtraction | ||
bg_x2 None # Right edge of exclusion region for row-by-row BG subtraction | ||
|
||
# Spectral extraction parameters | ||
spec_hw 12 # Half-width of aperture region for spectral extraction (relative to source position) | ||
fittype meddata # Method for constructing spatial profile (Options: smooth, meddata, poly, gauss, wavelet, or wavelet2D) | ||
median_thresh 10 # Sigma threshold when flagging outliers in median frame, when fittype=meddata and window_len > 1 | ||
window_len 7 # Smoothing window length, for median frame or when fittype = smooth or meddata (when computing median frame). Can set to 1 for no smoothing when computing median frame for fittype=meddata. | ||
prof_deg 3 # Polynomial degree, when fittype = poly | ||
p5thresh 10 # X-sigma threshold for outlier rejection while constructing spatial profile | ||
p7thresh 7 # X-sigma threshold for outlier rejection during optimal spectral extraction | ||
|
||
# Curvature treatment | ||
curvature correct # How to manage the curved trace on the detector (Options: None, correct) | ||
|
||
# Diagnostics | ||
isplots_S3 3 # Generate few (1), some (3), or many (5) figures (Options: 1 - 5) | ||
nplots 5 # How many of each type of figure do you want to make per file? | ||
vmin 0.97 # Sets the vmin of the color bar for Figure 3101. | ||
vmax 1.03 # Sets the vmax of the color bar for Figure 3101. | ||
time_axis 'y' # Determines whether the time axis in Figure 3101 is along the y-axis ('y') or the x-axis ('x') | ||
testing_S3 False # Boolean, set True to only use last file and generate select figures | ||
hide_plots True # If True, plots will automatically be closed rather than popping up | ||
save_output True # Save outputs for use in S4 | ||
save_fluxdata False # Save the much larger FluxData.h5 outputs which can be useful for debugging or comparisons between different pipelines | ||
verbose True # If True, more details will be printed about steps | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRCam/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage2 # The folder containing the outputs from Eureka!'s S2 or JWST's S2 pipeline (will be overwritten if calling S2 and S3 sequentially) | ||
outputdir Stage3 |
63 changes: 63 additions & 0 deletions
63
demos/JWST/CalibratedStellarSpectra/S3_nirspec_fs_template.ecf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Eureka! Control File for Stage 3: Data Reduction | ||
|
||
# Stage 3 Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-3 | ||
|
||
ncpu 4 # Number of CPUs | ||
nfiles 1 # The number of data files to analyze simultaneously | ||
max_memory 0.5 # The maximum fraction of memory you want utilized by read-in frames (this will reduce nfiles if need be) | ||
indep_batches False # Independently treat each batch of files? Strongly recommended to leave this as False unless you have a clear reason to set it to True. | ||
suffix calints # Data file suffix | ||
|
||
calibrated_spectra True # Set True to generate flux-calibrated spectra/photometry in mJy | ||
# Set False to convert to electrons | ||
|
||
# Subarray region of interest | ||
ywindow [2,28] # Vertical axis as seen in DS9 | ||
xwindow [804,2042] # NRS1, Horizontal axis as seen in DS9 | ||
# xwindow [5,2028] # NRS2, 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 False # 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 | ||
expand 1 # Super-sampling factor along cross-dispersion direction | ||
|
||
# Outlier rejection along time axis | ||
ff_outlier False # Set False to use only background region (recommended for deep transits) | ||
# Set True to use full frame (works well for shallow transits/eclipses) | ||
bg_thresh [6,6] # Double-iteration X-sigma threshold for outlier rejection along time axis | ||
|
||
# Background parameters | ||
bg_hw 9 # Half-width of exclusion region for BG subtraction (relative to source position) | ||
bg_deg None # Polynomial order for column-by-column background subtraction, -1 for median of entire frame | ||
bg_method median # Options: std (Standard Deviation), median (Median Absolute Deviation), mean (Mean Absolute Deviation) | ||
p3thresh 10 # X-sigma threshold for outlier rejection during background subtraction | ||
|
||
# Spectral extraction parameters | ||
spec_hw 6 # Half-width of aperture region for spectral extraction (relative to source position) | ||
fittype meddata # Method for constructing spatial profile (Options: smooth, meddata, poly, gauss, wavelet, or wavelet2D) | ||
median_thresh 5 # Sigma threshold when flagging outliers in median frame, when fittype=meddata and window_len > 1 | ||
window_len 13 # Smoothing window length, for median frame or when fittype = smooth or meddata (when computing median frame). Can set to 1 for no smoothing when computing median frame for fittype=meddata. | ||
prof_deg 3 # Polynomial degree, when fittype = poly | ||
p5thresh 10 # X-sigma threshold for outlier rejection while constructing spatial profile | ||
p7thresh 10 # X-sigma threshold for outlier rejection during optimal spectral extraction | ||
|
||
# Curvature treatment | ||
curvature correct # How to manage the curved trace on the detector (Options: None, correct) | ||
|
||
# Diagnostics | ||
isplots_S3 3 # Generate few (1), some (3), or many (5) figures (Options: 1 - 5) | ||
nplots 1 # How many of each type of figure do you want to make per file? | ||
vmin 0.97 # Sets the vmin of the color bar for Figure 3101. | ||
vmax 1.03 # Sets the vmax of the color bar for Figure 3101. | ||
time_axis 'y' # Determines whether the time axis in Figure 3101 is along the y-axis ('y') or the x-axis ('x') | ||
testing_S3 False # Boolean, set True to only use last file and generate select figures | ||
hide_plots True # If True, plots will automatically be closed rather than popping up | ||
save_output True # Save outputs for use in S4 | ||
save_fluxdata False # Save the much larger FluxData.h5 outputs which can be useful for debugging or comparisons between different pipelines | ||
verbose True # If True, more details will be printed about steps | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRSpec/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage2 # The folder containing the outputs from Eureka!'s S2 or JWST's S2 pipeline (will be overwritten if calling S2 and S3 sequentially) | ||
outputdir Stage3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Eureka! Control File for Stage 4cal: Calibrated Stellar Spectra | ||
|
||
# Stage 4cal Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-4cal | ||
|
||
# Transit/Eclipse time | ||
t0 110.810782 # BJD | ||
time_offset 60000 # Optional; time offset | ||
|
||
# Orbital parameters | ||
rprs 0.07194 # Planet-star radius ratio | ||
period 4.2344923 # Orbital period (in Days) | ||
inc 87.799 # orbital inclination (in degrees) | ||
ars 12.518 # Semi-major axis to stellar radius ratio | ||
# Transit durations. When given, the orbital parameters are ignored. | ||
# t14 None # Total transit duration, from t1 to t4 | ||
# t23 None # Full transit duration, from t2 to t3 | ||
|
||
# Light curve to be used before t1 and after t4 for the baseline flux, | ||
# which includes flux from (t1 - base_dur) to t1 and t4 to (t4 + base_dur). | ||
base_dur 0.1 # Days | ||
|
||
# Outlier detection | ||
smoothing 1000 # A good starting point is the number of datapoints (i.e. wavelengths). A value of 0 will apply interpolation. | ||
sigma_thresh [4,4,4] # Three rounds of 4-sigma clipping ([4,4,4]) | ||
|
||
# Diagnostics | ||
isplots_S4cal 3 # Generate few (1), some (3), or many (5) figures (Options: 1 - 5) | ||
nbin_plot 200 # The number of time bins that should be used for figure 4202 | ||
hide_plots False # If True, plots will automatically be closed rather than popping up | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRSpec/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage3 # The folder containing the calibrated stellar spectra from Eureka!'s S3 pipeline | ||
outputdir Stage4cal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import eureka.lib.plots | ||
import eureka.S1_detector_processing.s1_process as s1 | ||
import eureka.S2_calibrations.s2_calibrate as s2 | ||
import eureka.S3_data_reduction.s3_reduce as s3 | ||
import eureka.S4cal_StellarSpectra.s4cal_StellarSpec as s4cal | ||
|
||
# Set up some parameters to make plots look nicer. | ||
# You can set usetex=True if you have LaTeX installed | ||
eureka.lib.plots.set_rc(style='eureka', usetex=False, filetype='.png') | ||
|
||
# eventlabel = 'imaging_template' | ||
# eventlabel = 'miri_lrs_template' | ||
eventlabel = 'nirspec_fs_template' | ||
# eventlabel = 'nircam_wfss_template' | ||
ecf_path = '.'+os.sep | ||
|
||
if __name__ == '__main__': | ||
# To skip one or more stages that were already run, | ||
# just comment them out below | ||
|
||
meta = s1.rampfitJWST(eventlabel, ecf_path=ecf_path) | ||
|
||
meta = s2.calibrateJWST(eventlabel, ecf_path=ecf_path) | ||
|
||
spec, meta = s3.reduce(eventlabel, ecf_path=ecf_path) | ||
|
||
meta, spec, ds = s4cal.medianCalSpec(eventlabel, ecf_path=ecf_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Eureka! Control File for Stage 4cal: Calibrated Stellar Spectra | ||
|
||
# Stage 4cal Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-4cal | ||
|
||
# Transit/Eclipse time | ||
t0 110.810782 # BJD | ||
time_offset 60000 # Optional; time offset | ||
|
||
# Orbital parameters | ||
rprs 0.07194 # Planet-star radius ratio | ||
period 4.2344923 # Orbital period (in Days) | ||
inc 87.799 # orbital inclination (in degrees) | ||
ars 12.518 # Semi-major axis to stellar radius ratio | ||
# Transit durations. When given, the orbital parameters are ignored. | ||
# t14 None # Total transit duration, from t1 to t4 | ||
# t23 None # Full transit duration, from t2 to t3 | ||
|
||
# Light curve to be used before t1 and after t4 for the baseline flux, | ||
# which includes flux from (t1 - base_dur) to t1 and t4 to (t4 + base_dur). | ||
base_dur 0.1 # Days | ||
|
||
# Outlier detection | ||
smoothing 1000 # A good starting point is the number of datapoints (i.e. wavelengths). A value of 0 will apply interpolation. | ||
sigma_thresh [4,4,4] # Three rounds of 4-sigma clipping ([4,4,4]) | ||
|
||
# Diagnostics | ||
isplots_S4cal 3 # Generate few (1), some (3), or many (5) figures (Options: 1 - 5) | ||
nbin_plot 200 # The number of time bins that should be used for figure 4202 | ||
hide_plots False # If True, plots will automatically be closed rather than popping up | ||
|
||
# Project directory | ||
topdir /home/User/Data/JWST-Sim/NIRSpec/ | ||
|
||
# Directories relative to topdir | ||
inputdir Stage3 # The folder containing the calibrated stellar spectra from Eureka!'s S3 pipeline | ||
outputdir Stage4cal |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.