webbpsf icon indicating copy to clipboard operation
webbpsf copied to clipboard

setup_sim_to_match_file: Not properly reading NIRCam F323N?

Open mwhosek opened this issue 1 year ago • 3 comments

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!

header_info

mwhosek avatar Feb 17 '24 00:02 mwhosek

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.

JarronL avatar Feb 21 '24 02:02 JarronL

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.

mwhosek avatar Mar 01 '24 18:03 mwhosek

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

mperrin avatar Mar 22 '24 15:03 mperrin

This was closed in PR #768

mperrin avatar May 16 '24 12:05 mperrin