{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Display tables resulting from an astroquery request\n", "\n", "This example implements the addition of two tables :\n", "- one resulting from an astroquery request on the [Simbad](https://simbad.cds.unistra.fr/simbad/ \"https://simbad.cds.unistra.fr/simbad/\") database\n", "- the other is a table created locally" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ipyaladin import Aladin\n", "from astropy.table import QTable\n", "import astropy.units as u\n", "from astroquery.simbad import Simbad" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## From a query" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table = Simbad.query_region(\"Messier 1\", radius=0.03 * u.deg)\n", "table" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin = Aladin(fov=0.4, target=\"Messier 1\")\n", "aladin" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.add_table(table, shape=\"rhomb\", color=\"lightskyblue\", source_size=20)\n", "# This line also works with camelCase instead of snake_case: sourceSize=20" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Display Astropy table created from scratch" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ra = [83.63451584700, 83.61368056017, 83.58780251600]\n", "dec = [22.05652591227, 21.97517807639, 21.99277764451]\n", "name = [\n", " \"Gaia EDR3 3403818589184411648\",\n", " \"Gaia EDR3 3403817661471500416\",\n", " \"Gaia EDR3 3403817936349408000\",\n", "]\n", "parallax = [1.7703, 0.5112, 0.3735] * u.mas\n", "\n", "t = QTable(\n", " [ra, dec, name, parallax],\n", " names=(\"ra\", \"dec\", \"name\", \"parallax\"),\n", " meta={\"name\": \"my sample table\"},\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.add_table(t)" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.3" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": false, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": false, "toc_window_display": false }, "vscode": { "interpreter": { "hash": "85bb43f988bdbdc027a50b6d744a62eda8a76617af1f4f9b115d38242716dbac" } } }, "nbformat": 4, "nbformat_minor": 4 }