Skip to content

Commit

Permalink
add ASDF Intro tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
nden committed Jun 3, 2022
1 parent 1c6933c commit ac12f9b
Show file tree
Hide file tree
Showing 5 changed files with 1,204 additions and 2 deletions.
147 changes: 147 additions & 0 deletions 12-ASDF/ASDF_Solutions.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "accb2b84",
"metadata": {},
"source": [
"#### ASDF Exercise Solutions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "416bd2e3",
"metadata": {},
"outputs": [],
"source": [
"import asdf"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0f39489",
"metadata": {},
"outputs": [],
"source": [
"af = asdf.open('roman.asdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "286a8859",
"metadata": {},
"outputs": [],
"source": [
"af.info()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "78997318",
"metadata": {},
"outputs": [],
"source": [
"af.info(max_rows=200)"
]
},
{
"cell_type": "markdown",
"id": "f2125b48",
"metadata": {},
"source": [
"Use the **search** method to find the path to the WCS object"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "73b922c1",
"metadata": {},
"outputs": [],
"source": [
"af.search('wcs')"
]
},
{
"cell_type": "markdown",
"id": "d0d25b5c",
"metadata": {},
"source": [
"Evaluate the WCS object using the Astropy Common API"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c905a1a3",
"metadata": {},
"outputs": [],
"source": [
"w = af['roman']['meta']['wcs']\n",
"\n",
"sky = w.pixel_to_world(200, 300)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0fc4a6fd",
"metadata": {},
"outputs": [],
"source": [
"print(sky)"
]
},
{
"cell_type": "markdown",
"id": "f4e97e7f",
"metadata": {},
"source": [
"Convert to galactic coordinates"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7fea05b3",
"metadata": {},
"outputs": [],
"source": [
"print(sky.galactic)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "78dcc722",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit ac12f9b

Please sign in to comment.