Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions ASDF_and_World_Coordinate_Systems.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"\n",
"Ideally, one would want to be able to construct coordinate transforms\n",
"out of simpler models to form a pipeline of transformations from \n",
"one coordinate frame to another. The combination of the Python packages \n",
"astropy modeling, GWCS (Generalized World Coordinate Systems) and asdf\n",
"one coordinate frame to another. The combination of the Python packages - astropy modeling, GWCS (Generalized World Coordinate Systems) and asdf\n",
"provide a very flexible and powerful means of dealing with WCS.\n",
"\n",
"This tutorial will not address how one develops a WCS model as that\n",
Expand All @@ -61,7 +60,7 @@
"## Using GWCS with ASDF\n",
"\n",
"This initial imaging example will use the same wcs that was in the\n",
"JWST data file used in this tutorial: [Reading a JWST ASDF file]\n",
"JWST data file used in the tutorial: [Reading a JWST ASDF file]\n",
"(Reading_a_JWST_ASDF_file.ipynb) except only the WCS has been saved\n",
"to its own file (ASDF makes saving components of ASDF files to their\n",
"own files trivial).\n",
Expand Down Expand Up @@ -222,7 +221,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This compound model is sufficiently complicated to require some detailed explanation (but not nearly as complicated as some JWST spectral WCS models!). First a brief explanation of the notation. Inputs and outputs indicate that this model takes two input values (or two arrays of values and generates two output values, i.e., two input coordinates and two output coordinates. Expression is the expression used to combine astropy models into a more complex compound model. To keep the expression concise, each term is replaced by a number and the model associated with that number is listed below. The two operators in particular that need special explanation are & and |. The & operator means that two functions are joined by adding dimensionality. If a Shift function shifts the value of the input by the given value, the joining two Shift functions shift the first input by the first value, and the second input by the second value. It is a way of making two 1D functions a 2D function, albeit with each input coordinate treated independently of the other. The | operator feeds the output of the preceding function into the next. The number of outputs of the preceding must match the number of inputs of the following function. Finally, the Mapping function acts as a switchboard between inputs and output. For example, Mapping(0, 1, 0, 1) takes two inputs and generates 4 outputs, where outputs 0, and 2 are both equal to the first input, and outputs 1 and 3 are both equal to the second input.\n",
"This compound model is sufficiently complicated to require some detailed explanation (but not nearly as complicated as some JWST spectral WCS models!). First a brief explanation of the notation. Inputs and outputs indicate that this model takes two input values (or two arrays of values and generates two output values, i.e., two input coordinates and two output coordinates. Expression is the expression used to combine astropy models into a more complex compound model. To keep the expression concise, each term is replaced by a number and the model associated with that number is listed below. The two operators in particular that need special explanation are & and |. The & operator means that two functions are joined by adding dimensionality. If a Shift function shifts the value of the input by the given value, the joining two Shift functions shift the first input by the first value, and the second input by the second value. It is a way of making two 1D functions a 2D function, albeit with each input coordinate treated independently of the other. The | operator feeds the output of the preceding function into the next. The number of outputs of the preceding function must match the number of inputs of the following function. Finally, the Mapping function acts as a switchboard between inputs and output. For example, Mapping(0, 1, 0, 1) takes two inputs and generates 4 outputs, where outputs 0 and 2 are both equal to the first input, and outputs 1 and 3 are both equal to the second input.\n",
"\n",
"Now to summarize in words what this transform does: shifts both input values first by 1 and then by -1024.5. This to make the coordinates relative to the center of the detector and center of that pixel. The next step splits the two input values so that both go to two different 2D polynomials (each of which produces only one value, so the net result is two output values. Then these values go through a similar split and to a second polynomial that is effectively applying a small rotation, followed by a shift in the V2,V3 coordinate system.\n",
"\n",
Expand All @@ -243,13 +242,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This transform is much simpler and consists of a scale change then conversion to cartesian to perform Euler rotations to the RA, Dec system and then conversion back to spherical coordinates.\n",
"This transform is much simpler and consists of a scale change then conversion to cartesian coordinates to perform Euler rotations to a RA, Dec system and then conversion back to spherical coordinates.\n",
"\n",
"Note that there is no use of a tangent projection, and such distortions that would result from that have been folded into the polynomial distortion model.\n",
"\n",
"## Modifying the WCS\n",
"\n",
"This is a somewhat contrived example, but it is to illustrate that one can make customizations to a WCS fairly easily. In this particular case one could change any of the parameters in the transforms, and save the new WCS to an ASDF file without any concern for how to do that. Or one can modify the existing transform by adding new elements to the transform. So supposing the existing plate scale used does not include velocity aberration, then one would want to include that as well as a plate scale change, and perhaps not change the existing plate scale application to be clear there are two different scales applied. \n",
"This is a somewhat contrived example, but it is to illustrate that one can make customizations to a WCS fairly easily. In this particular case one could change any of the parameters in the transforms and save the new WCS to an ASDF file without any concern for how to do that. Or one can modify the existing transform by adding new elements to the transform. So supposing the existing plate scale used does not include velocity aberration, then one would want to include that as well as a plate scale change, and perhaps not change the existing plate scale application to be clear there are two different scales applied. \n",
"\n"
]
},
Expand Down Expand Up @@ -309,13 +308,6 @@
"The result is fairly extensive and not nearly as easy to interpret as the python printed version. Nevertheless, it demonstrates ASDF is capable of saving arbitrarily complex expressions without the user needing to understand the details of saving or reading those expressions."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -354,7 +346,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down