Conversation
|
Hey Kayli, This looks great - thanks for taking a look! My only major comment is that we're sort of jumping over ourselves to assign the IWA value. If you look at the pyKLIP for JWSTData here: You'll see that we have an automatic calculation for the IWA based on the wavelength and mode being used, and we don't want to replace it entirely with a separate hardcoded value in spaceKLIP. Instead, I'd suggest we leave the IWA as is unless the user provides a value. Perhaps we could have an The other alternative is we edit pyKLIP and pull the IWA out entirely, but I think there's some value to keeping it in there. |
JWSTData, thepyKLIPinstrument class used for JWST observations, accepts several parameters, includingfilepaths,psflib_filepaths,center_keywords,center_include_offset, andhighpass.Inrun_obs(), the dataset is initialized as:JWSTDataassigns a default value for IWA, butrun_obs()overwrites this with the user-specified value, defaulting to 1.0 if none is provided.Currently, this
JWSTDataconfiguration is not fully propagated to downstream contrast-analysis routines. For example,calibrate_contrast()andextract_companions()initialized the dataset with only:This PR updates these routines so that the downstream
JWSTDatainstances use the samehighpass,center_include_offset,center_keywords, andIWAvalues as the original dataset created inrun_obs(). TheIWAandHIGHPASSvalues are also now tracked in the spaceKLIP database and written to the FITS headers.This PR also adds support for the
annuli_spacingparameter inrun_obs(). This controls how the KLIP subtraction annuli are distributed radially and can be set to 'constant', 'log', or 'linear'. Previously,annuli_spacingcould not be passed throughrun_obs(), sopyKLIPalways used its default 'constant' spacing. The selected value is now stored in the spaceKLIP database asANNSPACE, and used in downstream routinescalibrate_contrast()andextract_companions().The slides attached to this PR compare the Stage 3 PSF-subtracted products with products generated during contrast analysis after injecting a zero-flux companion. Since a zero-flux injection should leave the data unchanged, we should see no differences when comparing the klipped products. The comparisons include ADI, RDI, and ADI+RDI reductions for both the NIRCam and MIRI demo datasets. The "After" images in the slides show that the same KLIP parameters are now getting passed downstream.
klip_before_after.pptx
When comparing the
extract_companions()results from the currentdevelopbranch with those produced using the fixes in this PR (using the same set up as in the tutorial notebooks), the best-fit companion parameters show small differences. Across the fitted parameters, the median percent difference is ~ 0.025% for NIRCam and 0.43% for MIRI params. The largest percent differences are generally associated with the uncertainty (*_ERR) values.This should address the concerns brought up in the following other issues: #148 and #305
This PR also includes a small edit to
plotting.py, sinceget_fits_wcshas been deprecated instdatamodels. This update is needed for the plotting routines used in the tutorials to run.