Skip to content
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

setup_sim_to_match_file: Not properly reading NIRCam F323N? #806

Closed
mwhosek opened this issue Feb 17, 2024 · 4 comments
Closed

setup_sim_to_match_file: Not properly reading NIRCam F323N? #806

mwhosek opened this issue Feb 17, 2024 · 4 comments

Comments

@mwhosek
Copy link

mwhosek commented Feb 17, 2024

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
@JarronL
Copy link
Collaborator

JarronL commented Feb 21, 2024

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.

@mwhosek
Copy link
Author

mwhosek commented Mar 1, 2024

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.

@mperrin
Copy link
Collaborator

mperrin commented Mar 22, 2024

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
Copy link
Collaborator

mperrin commented May 16, 2024

This was closed in PR #768

@mperrin mperrin closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants