Skip to content

Commit

Permalink
docs: edit plot instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Jul 31, 2024
1 parent 33302cd commit 148eb5f
Showing 1 changed file with 61 additions and 66 deletions.
127 changes: 61 additions & 66 deletions examples/11_Extracting_information_from_the_view.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {},
"outputs": [],
"source": [
"from astropy.coordinates import SkyCoord\n",
"import astropy.units as u\n",
Expand All @@ -26,20 +28,18 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from ipyaladin import Aladin"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2e62d34eb8543145",
"metadata": {},
"outputs": [],
"source": [
"aladin = Aladin(fov=5, height=600, target=\"M31\")\n",
"aladin"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -53,13 +53,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "84153657cb7cd837",
"metadata": {},
"outputs": [],
"source": [
"aladin.wcs # Recover the current WCS"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -71,17 +71,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "a63f210b-3a64-4860-8e70-42a4c66378fa",
"metadata": {},
"outputs": [],
"source": [
"aladin.height = 800\n",
"aladin.survey = \"CDS/P/PLANCK/R2/HFI/color\"\n",
"aladin.target = \"LMC\"\n",
"aladin.frame = \"Galactic\"\n",
"aladin.fov = 50"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -93,13 +93,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "2ddc9637-b5c3-4412-8435-2302b6d86816",
"metadata": {},
"outputs": [],
"source": [
"aladin.wcs"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -115,13 +115,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "9595ae02388b245a",
"metadata": {},
"outputs": [],
"source": [
"aladin.fov_xy # Recover the current field of view for the x and y axis"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -134,8 +134,10 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "bb48cb19a597e262",
"metadata": {},
"outputs": [],
"source": [
"m1 = SkyCoord.from_name(\"m1\")\n",
"\n",
Expand All @@ -144,23 +146,21 @@
"usno = Vizier(catalog=\"I/284/out\", row_limit=-1).query_region(m1, radius=0.05 * u.deg)[\n",
" 0\n",
"]"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0030a996",
"metadata": {},
"outputs": [],
"source": [
"aladin.add_table(simbad, name=\"simbad\", color=\"purple\", shape=\"circle\", source_size=20)\n",
"aladin.add_table(usno, name=\"usno\", color=\"teal\", shape=\"square\", source_size=20)\n",
"aladin.target = m1\n",
"aladin.fov = 0.3\n",
"aladin.survey = \"CDS/P/PanSTARRS/DR1/g\""
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -172,13 +172,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "3efb33016d863bf7",
"metadata": {},
"outputs": [],
"source": [
"aladin.selection(\"circle\")"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
Expand All @@ -190,74 +190,69 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "cda32891dd654568",
"metadata": {},
"outputs": [],
"source": [
"aladin.selected_objects"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"id": "c84e856d82dbde63",
"metadata": {},
"source": [
"## Getting the view as a fits file\n",
"The following method allow you to retrieve the current view as a fits file. If a `path` is given as a second argument, the fits file will be saved."
],
"id": "c84e856d82dbde63"
]
},
{
"metadata": {},
"cell_type": "code",
"source": "fits = aladin.get_view_as_fits()",
"execution_count": null,
"id": "6b0d3e2131e9faa2",
"metadata": {},
"outputs": [],
"execution_count": null
"source": [
"fits = aladin.get_view_as_fits()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "020d2c7f",
"metadata": {},
"cell_type": "markdown",
"source": "Display the fits file using matplotlib:",
"id": "36a996b424529c09"
"outputs": [],
"source": [
"fits[0].header"
]
},
{
"cell_type": "markdown",
"id": "36a996b424529c09",
"metadata": {},
"source": [
"Display the fits file using matplotlib:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8327802bad8e8c87",
"metadata": {},
"outputs": [],
"source": [
"wcs = WCS(fits[0].header).dropaxis(2)\n",
"wcs = WCS(fits[0].header)\n",
"\n",
"plt.subplot(projection=wcs)\n",
"plt.imshow(fits[0].data[0, :, :], cmap=\"gray\")"
],
"id": "8327802bad8e8c87",
"outputs": [],
"execution_count": null
"plt.imshow(fits[0].data, cmap=\"binary_r\", norm=\"asinh\", vmin=0.001)"
]
}
],
"metadata": {
"nbsphinx": {
"execute": "never"
},
"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.11.8"
},
"version_major": 2,
"version_minor": 0
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
Expand Down

0 comments on commit 148eb5f

Please sign in to comment.