-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infrastructure improvements for improved IFU sims #770
Conversation
FYI @patapisp @tracy-beck |
fed9c1b
to
f744096
Compare
Hello @mperrin, Thank you for updating !
Comment last updated at 2024-05-15 17:34:45 UTC |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #770 +/- ##
===========================================
+ Coverage 59.20% 60.85% +1.64%
===========================================
Files 16 16
Lines 6955 6708 -247
===========================================
- Hits 4118 4082 -36
+ Misses 2837 2626 -211 ☔ View full report in Codecov by Sentry. |
Here's a general question for @patapisp @tracy-beck and anyone else thinking about IFU mode PSF characterization. IFU pixel scales are irregular, and in general not square. How should we approach this in sim PSFs for the IFU? I can imaging cases being made for trying to simulate on the native sampled spaxels, or on the pixel scale that the pipeline makes drizzled datacubes. (in principle it seems better to simulate on the native detector sampling, but those are in general not square! Would need a bunch of effort to simulate different pixel scales in the alpha and beta directions.) My hand waved suggestion is to, for now, simulate by default at the pipeline output pixel size (and, as usual, potentially oversampled relative to that scale). That at least gives us an isotropic pixel scale, avoiding the complexity of different X and Y scales. In principle we could then handle the different X and Y scales as a distortion effect, applied by interpolation after the optical propagation calculation. Thoughts? |
78dfcd3
to
2a1e5e5
Compare
@mperrin, regarding pixel sizes. My thoughts are as follows:
I am looking into the PR now to try to catch up to the new features you implemented! :) |
Hi @patapisp - I wanted to check in since it's been a while since we chatted. Did you happen to have any time to work more on any code for MRS in webbpsf? |
32f6cc7
to
5a6158f
Compare
5a6158f
to
bcfa0ae
Compare
…urename functionality (and tests)
… get_IFU_wavelengths functions
bcfa0ae
to
569d51e
Compare
@obi-wan76 @tracy-beck the webbpsf IFU-mode PR is ready for review. I added the new v1.3.0 data files to Box which are needed for testing this, and the tests pass here on Github so that part seems good. I'd still like to add in some more user documentation of this, but I think that might best be left for a separate PR. |
The example code above works for me with the relevant files from the webbpsf-data 1.3. I tried to save the cube via the outfile option,
|
Nice catch on the outfile parameter not being implemented for that method. Added. Grab the latest and try again now, please. |
The save file is working as intended. Thanks! Looking at some of the MIRI cubes, inside the fits file header, there are a few places that refers to the mean wavelength and the wavelength "0" that show a value of 2um, i.e., WAVELEN and WAVE0. Also the history shows that it was created with a wavefront at 2um. This seems to be very NIRSpec specific, so I am wondering if the header keywords are not being updated correctly for MIRI. I think it is only an issue with some of the header information because the wave parameter is set correctly for the MIRI calculation, from 7.51 to 8.7697um, and the keyword WVLN0000 is correct for both MIRI and NIRSpec. |
Good catch with the wavelengths in the headers. I think actually there may indeed be some bug with that. I'll take a look! |
28083e8
to
62c6d66
Compare
…p some redundant FITS header keywords
62c6d66
to
a8416a1
Compare
I pushed some improvements to the wavelength handling in the calc_datacube_fast code, so (a) now it will use a more reasonable wavelength for MIRI calculations for the initial optical propagation, and (b) the redundant WAVE0 keyword is deleted, and instead there are WAVELN00, WAVELN01 etc. (consistent with the keywords from the regular calc_datacube output.) |
Should be ready for re-test now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, it looks good now. Thanks!
minor bug fix to IFU mode after #770
Work in progress for adding infrastructure for better IFU simulations, shared between NIRSpec and MIRI classes.
This PR is heavily inspired by #691 by @patapisp, but has generalized much of the implementation to work across both NIRSpec and MIRI.
This adds a new intermediate abstract subclass
JWInstrument_with_IFU
, and changes the NIRSpec and MIRI classes to subclass from that. The benefit will be to allow adding IFU-specialized code shared between the two instruments, but not needed in the other three JW SIs.That shared code includes:
mode
attribute to indicated imaging or IFU major mode.band
attribute to specify IFU bandpass. The implementation and behavior differs for the two classes, following the instrument designs. For NIRSpec theband
is like"G295H/F290LP"
, derived from the.disperser
andfilter
attributes. For MIRI theband
is an MRS sub-band, like3A
.mode='IFU'
explicitly will change the aperturename to a relevant IFU aperture. Setting the aperture name to an IFU aperture will invoke IFU mode. The intent is to make it seamless and as automatic as possible for the user to set up a self-consistent calculation.._IFU_bands_cubepars
, derived from current CRDS cubepar files, which gives the wavelength range, wavelength sampling, and spaxel size for all bands.get_IFU_wavelengths()
that returns the wavelength sampling for the selected band, based on the cubers values. This function takes an optionalnlambda
argument to specify some desired sampling across the band; by default it matches the wave step from cubepars, which can be >1000 wavelengths depending on mode.nrs.pixelscale=0.1
Example code:
MIRI:
NIRSpec: