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

add setup_sim_to_match_data function #706

Conversation

mperrin
Copy link
Collaborator

@mperrin mperrin commented Aug 1, 2023

Another simple PR adding a single-purpose utility function that I wrote a while ago.

The function setup_sim_to_match_data takes the filename of some observed JWST data, and sets up a simulated instrument instance to match it. The match includes choice of instrument, detector and detector position based on APERNAME, filter, any image or pupil masks relevant, and the closest available WFS.

This is all straightforward, it just provides convenience to have a function that automates this setup.

Example usage:

example_output_setup_sim

@mperrin mperrin requested a review from obi-wan76 August 1, 2023 20:56
@mperrin mperrin added this to the Release 1.2 milestone Aug 1, 2023
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Patch coverage: 18.42% and project coverage change: -0.23% ⚠️

Comparison is base (081584d) 55.94% compared to head (d5d9ec5) 55.72%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #706      +/-   ##
===========================================
- Coverage    55.94%   55.72%   -0.23%     
===========================================
  Files           15       16       +1     
  Lines         6281     6319      +38     
===========================================
+ Hits          3514     3521       +7     
- Misses        2767     2798      +31     
Files Changed Coverage Δ
webbpsf/match_data.py 16.21% <16.21%> (ø)
webbpsf/__init__.py 96.77% <100.00%> (+0.10%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@obi-wan76
Copy link
Collaborator

Looks good, and very useful. I tried it with a NIRCam LW observation.

Setting up sim to match jw02787001001_03101_00001_nrcblong_cal.fits
iterating query, tdelta=3.0

MAST OPD query around UTC: 2023-03-23T01:16:55.666
                        MJD: 60026.053422060184

OPD immediately preceding the given datetime:
	URI:	 mast:JWST/product/R2023032202-NRCA3_FP1-1.fits
	Date (MJD):	 60025.1392
	Delta time:	 -0.9142 days

OPD immediately following the given datetime:
	URI:	 mast:JWST/product/R2023032504-NRCA3_FP1-1.fits
	Date (MJD):	 60027.8043
	Delta time:	 1.7508 days
User requested choosing OPD time closest in time to 2023-03-23T01:16:55.666, which is R2023032202-NRCA3_FP1-1.fits, delta time -0.914 days
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:JWST/product/R2023032202-NRCA3_FP1-1.fits to /Users/melendez/WFSC_Flight/webbpsf-data-1_2_0/MAST_JWST_WSS_OPDs/R2023032202-NRCA3_FP1-1.fits ... [Done]
Importing and format-converting OPD from /Users/melendez/WFSC_Flight/webbpsf-data-1_2_0/MAST_JWST_WSS_OPDs/R2023032202-NRCA3_FP1-1.fits
Backing out SI WFE and OTE field dependence at the WF sensing field point

Configured simulation instrument for:
    Instrument: NIRCam
    Filter: F277W
    Detector: NRCB5
    Apername: NRCB5_FULL
    Det. Pos.: (1024, 1024) 
    Image plane mask: None
    Pupil plane mask: None

image

Copy link
Collaborator

@obi-wan76 obi-wan76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. NIRCam LW test in the comments.

@obi-wan76
Copy link
Collaborator

@BradleySappington Let's try to get this into the next release.

@BradleySappington BradleySappington merged commit c787fcf into spacetelescope:develop Aug 2, 2023
6 of 8 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants