From ad72d648fe98903fb9fdcdabbe197ac763533477 Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Tue, 6 Aug 2024 13:54:36 +0200 Subject: [PATCH] :memo: Add new notebook 12 to show how to use ipyaladin with planetary body --- examples/12_Planetary_surveys.ipynb | 123 ++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 examples/12_Planetary_surveys.ipynb diff --git a/examples/12_Planetary_surveys.ipynb b/examples/12_Planetary_surveys.ipynb new file mode 100644 index 0000000..784ab85 --- /dev/null +++ b/examples/12_Planetary_surveys.ipynb @@ -0,0 +1,123 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8b1a9d152f4e1c7f", + "metadata": {}, + "source": [ + "# Planetary surveys\n", + "With Aladin Lite, you can display a planetary survey and use all existing features with it. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "initial_id", + "metadata": {}, + "outputs": [], + "source": [ + "from ipyaladin import Aladin\n", + "from astropy.table import Table" + ] + }, + { + "cell_type": "markdown", + "id": "60b133f13ce59125", + "metadata": {}, + "source": [ + "First, let's create an Aladin Lite widget with the Mars Viking MDIM21 survey." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "85d284fd3f5cc7bd", + "metadata": {}, + "outputs": [], + "source": [ + "aladin = Aladin(\n", + " target=\"159.2135528 -58.6241989\",\n", + " survey=\"https://alasky.u-strasbg.fr/Planets/Mars_Viking_MDIM21\",\n", + " fov=10,\n", + ")\n", + "aladin" + ] + }, + { + "cell_type": "markdown", + "id": "34747eb38e0db450", + "metadata": {}, + "source": [ + "Now, let's change the target to Olympus Mons, and get the coordinates as a tuple of floats." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbe012440a30b6fe", + "metadata": {}, + "outputs": [], + "source": [ + "aladin.target = \"Olympus Mons\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f8bd2e1814b72bd8", + "metadata": {}, + "outputs": [], + "source": [ + "aladin.target" + ] + }, + { + "cell_type": "markdown", + "id": "1329063f49da8d52", + "metadata": {}, + "source": [ + "Now create and add a table with the names and positions of the main geological features on Mars." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5461264f0485d880", + "metadata": {}, + "outputs": [], + "source": [ + "data = [\n", + " {\"longitude\": 226.2, \"latitude\": 18.65, \"name\": \"Olympus Mons\"},\n", + " {\"longitude\": 70.5, \"latitude\": -42.4, \"name\": \"Hellas Planitia\"},\n", + " {\"longitude\": 250.4, \"latitude\": 40.5, \"name\": \"Alba Mons\"},\n", + " {\"longitude\": -59.2, \"latitude\": -13.9, \"name\": \"Valles Marineris\"},\n", + " {\"longitude\": 147.21, \"latitude\": 25.02, \"name\": \"Elysium Mons\"},\n", + " {\"longitude\": 316.0, \"latitude\": -49.7, \"name\": \"Argyre Basin\"},\n", + " {\"longitude\": 32.53, \"latitude\": 70.0, \"name\": \"Vastitas Borealis\"},\n", + " {\"longitude\": -112.58, \"latitude\": 1.57, \"name\": \"Tharsis Montes\"},\n", + " {\"longitude\": 298.0, \"latitude\": 25.0, \"name\": \"Outflow channels\"},\n", + " {\"longitude\": 30.0, \"latitude\": 19.79, \"name\": \"Arabia Terra\"},\n", + " {\"longitude\": 70.5, \"latitude\": -42.4, \"name\": \"Hellas Basin\"},\n", + " {\"longitude\": 280.0, \"latitude\": 45.0, \"name\": \"Tempe Terra\"},\n", + " {\"longitude\": 87.0, \"latitude\": 12.9, \"name\": \"Isidis Basin\"},\n", + " {\"longitude\": 117.5, \"latitude\": 46.7, \"name\": \"Utopia Basin\"},\n", + " {\"longitude\": 350.0, \"latitude\": -45.0, \"name\": \"Noachis Terra\"},\n", + "]\n", + "\n", + "longitudes = [item[\"longitude\"] for item in data]\n", + "latitudes = [item[\"latitude\"] for item in data]\n", + "names = [item[\"name\"] for item in data]\n", + "\n", + "table = Table([longitudes, latitudes, names], names=(\"Longitude\", \"Latitude\", \"Name\"))\n", + "aladin.add_table(table)" + ] + } + ], + "metadata": { + "nbsphinx": { + "execute": "never" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}