webbpsf
webbpsf copied to clipboard
setup_sim_to_match_file: Not properly reading NIRCam F323N?
Hello,
I am using webbpsf to generate PSFs for NIRCam F323N images. However, where I use the function setup_sim_to_match_file
, it returns the F322W2 PSF instead, which is quite different.
Looking at the header of the F323N images, I see that the filter keyword is specified as "F322W2" while the pupil keyword is specified as "F323N" (see below). Could it be that setup_sim_to_match_file
isn't parsing this header info correctly?
I am using webbpsf version 1.2.1.
Thanks!
There are some filters (some narrowbands and one medium band) that exist in the pupil wheels and are usually paired with a wider blocking filter in the filter wheel. These filters therefore get populated in the PUPIL header keyword. In order to capture this in setup_sim_to_match_file
, one could modify the filter setting code like so:
if inst.name=='MIRI' and header['FILTER']=='P750L':
# webbpsf doesn't model the MIRI LRS prism spectral response
print("Please note, webbpsf does not currently model the LRS spectral response. Setting filter to F770W instead.")
inst.filter='F770W'
elif (inst.name=='NIRCam') and (header['PUPIL'][0]=='F') and (header['PUPIL'][-1] in ['N', 'M']):
# Grab filter from PUPIL keyword instead
inst.filter=header['PUPIL']
else:
inst.filter=header['filter']
Edit: Although, there are no other pupil wheel elements that start with "F" so perhaps the final condition of and (header['PUPIL'][-1] in ['N', 'M'])
isn't necessary.
Thanks @JarronL, the fix you suggested seems to work! I haven't tested it for all possible NIRCam filters, but it worked for F323N and F405N.
I added the provided fix from @JarronL to the existing PR branch #768. Confirmed that for the input file jw01939001001_02101_00007_nrcblong_cal.fits
, the code in that PR branch gets both the filter name and detector name correct to
Filter: F323N
Detector: NRCB5
This was closed in PR #768