Skip to content

Commit

Permalink
docs: add a plot with a WCS at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Aug 2, 2024
1 parent f29aa7b commit 8612e25
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion examples/11_Extracting_information_from_the_view.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"from astroquery.simbad import Simbad\n",
"from astroquery.vizier import Vizier\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from ipyaladin import Aladin"
]
Expand Down Expand Up @@ -255,7 +256,8 @@
"source": [
"## Saving the view as an image file\n",
"\n",
"In `save_view_as_image`, the first argument is the path to the file, the second is the format (\"png\", \"jpeg\", \"webp\"), and the third is a boolean to indicate if you want to include the Aladin Lite logo in the image."
"`save_view_as_image` takes a screenshot of the widget. The first argument is the path where the file should be written, the second is the format (\"png\", \"jpeg\", \"webp\"), and the third is a boolean to indicate if you want to include the Aladin Lite logo in the image. \n",
"These data are reflecting the pixels on the screen. For scientific use cases, opt for `get_view_as_fits` that is a bit longer since it retrieves the actual survey from a server."
]
},
{
Expand All @@ -265,6 +267,7 @@
"metadata": {},
"outputs": [],
"source": [
"screenshot_wcs = aladin.wcs\n",
"aladin.save_view_as_image(path=\"./crab.png\", image_format=\"png\", with_logo=True)"
]
},
Expand All @@ -278,6 +281,28 @@
"img = plt.imread(\"./crab.png\")\n",
"plt.imshow(img)"
]
},
{
"cell_type": "markdown",
"id": "dde7fe44",
"metadata": {},
"source": [
"And with the WCS that we stored at the same time than the screenshot"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "89d8f226",
"metadata": {},
"outputs": [],
"source": [
"img = plt.imread(\"./crab.png\")\n",
"plt.subplot(projection=screenshot_wcs)\n",
"plt.imshow(\n",
" np.flipud(img)\n",
") # in FITS, the lines of pixels are flipped, so we have to mimic this"
]
}
],
"metadata": {
Expand Down

0 comments on commit 8612e25

Please sign in to comment.