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

Enable resample_spec for NIRSpec line lamp exposures #5484

Merged
merged 8 commits into from Dec 8, 2020

Conversation

stscirij
Copy link
Contributor

@stscirij stscirij commented Nov 16, 2020

Addresses JP-1733

Fixes #5366

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #5484 (cbd5cc7) into master (0c9fa57) will increase coverage by 0.38%.
The diff coverage is 78.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5484      +/-   ##
==========================================
+ Coverage   71.13%   71.51%   +0.38%     
==========================================
  Files         410      410              
  Lines       36278    37392    +1114     
  Branches     5883     6212     +329     
==========================================
+ Hits        25805    26741     +936     
- Misses       8833     8983     +150     
- Partials     1640     1668      +28     
Flag Coverage Δ *Carryforward flag
nightly 71.07% <90.32%> (-0.05%) ⬇️ Carriedforward from 7f3b2d0
unit 51.45% <52.77%> (+0.35%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
jwst/resample/resample_utils.py 77.60% <60.00%> (+8.08%) ⬆️
jwst/lib/exposure_types.py 65.38% <66.66%> (-4.62%) ⬇️
jwst/pipeline/calwebb_spec2.py 80.68% <66.66%> (-13.26%) ⬇️
jwst/resample/resample_spec.py 91.91% <88.00%> (-5.32%) ⬇️
jwst/assign_wcs/nirspec.py 91.64% <100.00%> (+0.86%) ⬆️
jwst/resample/gwcs_drizzle.py 61.48% <100.00%> (+2.48%) ⬆️
jwst/regtest/conftest.py 65.96% <0.00%> (-9.94%) ⬇️
jwst/rscd/rscd_step.py 55.81% <0.00%> (-5.73%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c9fa57...cbd5cc7. Read the comment docs.

Copy link
Collaborator

@hbushouse hbushouse 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 overall. Just a few minor changes/additions requested. As well as the requisite reminder for a change log entry. And there's one flake8 issue that needs fixing.

jwst/pipeline/calwebb_spec2.py Show resolved Hide resolved
x_tan, y_tan = undist2sky1.inverse(ra, dec)
warnings.resetwarnings()
if model.meta.wcs.output_frame.name == 'world':
# ra and dec this converted to tangent projection
Copy link
Collaborator

Choose a reason for hiding this comment

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

The grammar in this comment could use some cleanup. What does "ra and dec this converted" really mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a holdover from before my changes, I'll clean up

jwst/resample/resample_spec.py Show resolved Hide resolved
# at this center of slit find x,y tangent projection - x_tan, y_tan
x_tan, y_tan = undist2sky1.inverse(ra, dec)
warnings.resetwarnings()
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this else statement is too general. If the general idea is to have coordinates on a plane and If the output_frame is V2V3 the code may not work correctly since V2V3 is a spherical system. I'm not sure if it's better to exclude V2V3 or to consider only msa_frame. The first option allows for other frames to work so it may be prefferable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a tricky one - currently resample_spec only 'knows' how to do sky/world and msa_frame, so we could just test those cases and punt if there's a different output frame. Alternatively, maybe we could do something like
if Unit("deg") in model.meta.wcs.output_frame.unit or Unit("arcsec") in model.meta.wcs.output_frame.unit:
to capture the sky-like cases, and otherwise do the cartesian cases

x_tan_all, y_tan_all = undist2sky.inverse(all_ra, all_dec)
if model.meta.wcs.output_frame.name == 'world':
# find the spatial size of the output - same in x,y
x_tan_all, y_tan_all = undist2sky.inverse(all_ra, all_dec)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The definition of undist2sky can go in the if statement.

sky = cf.CelestialFrame(name='sky', axes_order=(0, 1),
reference_frame=coord.ICRS())
else:
sky = cf.Frame2D(name='sky', axes_order=(0, 1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The name is a bit misleading since it's definitely not sky. Is something like
resampled_+ {model.meta.wcs.output_frame.name} better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I thought the naming was only temporary for the purposes of doing the transformation, but now I see that it appears in the meta.wcs.output_frame of the slits in the _s2d file.

Copy link
Collaborator

@stscieisenhamer stscieisenhamer left a comment

Choose a reason for hiding this comment

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

Maybe worth a separate issue to refactor that build_interpolated_output_wcs to try to cut down the special case handling.

Copy link
Collaborator

@hbushouse hbushouse left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update resample_spec to use MSA frame for NRS lamp exposure outputs
4 participants