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

SCSB-111: Improve documentation #483

Merged
merged 10 commits into from
Dec 18, 2023

Conversation

perrygreenfield
Copy link
Collaborator

Closes issues:

@perrygreenfield perrygreenfield requested a review from a team as a code owner November 14, 2023 19:12
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b483673) 87.28% compared to head (fb48cac) 87.28%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #483   +/-   ##
=======================================
  Coverage   87.28%   87.28%           
=======================================
  Files          22       22           
  Lines        3821     3821           
=======================================
  Hits         3335     3335           
  Misses        486      486           

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

CHANGES.rst Outdated Show resolved Hide resolved
CHANGES.rst Show resolved Hide resolved
docs/gwcs/fits_analog.rst Outdated Show resolved Hide resolved
docs/gwcs/fits_analog.rst Show resolved Hide resolved
>>> det2sky = shift_by_crpix | rotation | tan | celestial_rotation
>>> det2sky.name = "linear_transform"

Create a ``detector`` coordinate frame and a ``celestial`` ICRS frame.
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this detector frame? Can't we just bunch all transforms together from detector all the way to the sky? Also, what is a "detector frame"? is it just the value of the name argument in the Frame2D initializer?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally the frames are information containers - they hold the units on the axes, the names of the axes, the axes type and physical type. You could create a WCS without an input frame but some functionality will not be available. For example, if the transforms are defined with units, you will need to make sure the inputs are with units, so any time you pass input in the case above, the inputs need to have u.pix attached to them. This can be annoying.
In addition the input frame does not always represent a detector and imo it's good to have the information on what inputs are expected.

Copy link
Member

Choose a reason for hiding this comment

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

@nden comment should be added to the docs. My comment was intended to prompt a discussion/explanation about organization of the (gwcs) pipelines. For example, why do some pipelines have multiple steps (JWST WCS comes to mind)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wonder if a paragraphs or two before this example outlining the general structure of a WCS object would be helpful. Any objection @nden?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What if the current "Getting Started" is replaced by an earlier section:

Basic Structure of a GWCS Object
--------------------------------

The key concept to be aware of is that a GWCS Object consists of a pipeline
of steps; each step contains a transform (i.e., an Astropy model) that 
converts the input coordinates of the step to the output coordinates of
the step. Furthermore, each step has an optional coordinate frame associated
with the step. The coordinate frame represents the input coordinate frame, not
the output coordinates. Most typically, the first step coordinate frame is
the detector pixel coordinates (the default). Since no step has a coordinate 
frame for the output coordinates, it is necessary to append a step with no
transform to the end of the pipeline to represent the output coordinate frame.
For imaging, this frame typically references one of the Astropy standard
Sky Coordinate Frames of Reference. The GWCS frames also serve to hold the
units on the axes, the names of the axes and the physical type of the axis
(e.g., wavelength).

Since it is often useful to obtain coordinates in an intermediate frame of
reference, GWCS allows the pipeline to consist of more than one transform.
For example, for spectrographs, it is useful to have access to coordinates
in the slit plane, and in such a case, the first step would transform from
the detector to the slit plane, and the second step from the slit plane to
sky coordinates and a wavelength. Constructed this way, it is possible to
extract from the GWCS the needed transforms between identified frames of
reference.  

The GWCS object can be saved to the ASDF format using the
`asdf <https://asdf.readthedocs.io/en/latest/>`__ package and validated 
using `ASDF Standard <https://asdf-standard.readthedocs.io/en/latest/>`__

There are two ways to save the GWCS object to a files:

- `Save a WCS object as a pure ASDF file`_ 

@mcara does this address your comment?

Copy link
Member

Choose a reason for hiding this comment

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

Yes! This is a great introduction.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this too.

Furthermore, each step has an optional coordinate frame associated with the step.

Is the frame optional? I thought it's required.

a GWCS Object consists of a pipeline of steps

Suggest adding linear -> consists of a linear pipeline of steps
so that it's clear it's not an arbitrary graph.

docs/gwcs/fits_analog.rst Outdated Show resolved Hide resolved
docs/gwcs/ifu.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated

Create a transform which rotates the inputs using the ``PC matrix``.
The more general case where the detector is not aligned with north, would have
a rotation transform after the pixelship and pixelscale transformations to
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
a rotation transform after the pixelship and pixelscale transformations to
a rotation transform after the pixelshift and pixelscale transformations to

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So modified, though I really like how pixelship sounds.

docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated
Comment on lines 134 to 151
- Adjusting pixel coordinates such that the center of the array has
(0, 0) value (typical of most WCS definitions, but any pixel may
be the reference that is tied to the sky reference, even the (0, 0)
pixel, or even pixels outside of the detector).
- Scaling pixels such that the center pixel of the array has the expected
angular scale. (I.e., applying the plate scale)
- Projecting the resultant coordinates onto the sky using the tangent
projection. If the field of view is small, the inaccuracies resulting
leaving this out will be small; however, this is generally applied.
- Transforming the center pixel to the appropriate celestial coordinate
with the approprate orientation on the sky. For simplicity's sake,
we assume the detector array is already oriented with north up, and
that the array has the appropriate parity as the sky coordinates.


The detector has a 1000 pixel by 1000 pixel array.

For simplicity, no units will be used, but instead will be implicit.
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this go into the example in fits_analog.rst?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, do you mean duplicating (with needed changes) it there rather than moving?

docs/gwcs/fits_analog.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
CHANGES.rst Show resolved Hide resolved
docs/gwcs/fits_analog.rst Show resolved Hide resolved
>>> det2sky = shift_by_crpix | rotation | tan | celestial_rotation
>>> det2sky.name = "linear_transform"

Create a ``detector`` coordinate frame and a ``celestial`` ICRS frame.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this too.

Furthermore, each step has an optional coordinate frame associated with the step.

Is the frame optional? I thought it's required.

a GWCS Object consists of a pipeline of steps

Suggest adding linear -> consists of a linear pipeline of steps
so that it's clear it's not an arbitrary graph.

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.

3 participants