{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Aladin commands" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from astropy.coordinates import Angle, SkyCoord\n", "from ipyaladin import Aladin, Marker\n", "from pathlib import Path" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "`ipyaladin`'s full list of methods can be found in the documentation [here](https://cds-astro.github.io/ipyaladin/autoapi/ipyaladin/widget/index.html). A few of them are illustrated in the next cells. Let's first, create the widget with a few initial parameters:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin = Aladin(fov=20, reticle_size=64, reticle_color=\"#ff89ff\")\n", "aladin" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "They can also be modified in the next cells with an interactive effect on the generated view." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.target = \"sgr a*\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.target" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The x-axis field of view (fov) can be set" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.fov = 2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.fov" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The overlay survey is always on top of the base layer" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.overlay_survey = \"P/allWISE/color\"\n", "aladin.overlay_survey_opacity = 0.5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can change the coordinate frame (the choices are `ICRS`, `ICRSd` or `Galactic`)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.coo_frame = \"ICRSd\" # ICRS, and angles expressed in degrees" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.coo_frame" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The target and field of view can be set with astropy objects" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.target = SkyCoord(\"12h00m00s\", \"-30d00m00s\", frame=\"icrs\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.fov = Angle(5, \"deg\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can add a FITS image to the view of the widget, either as a path (string of pathlib.Path object) or as an\n", "astropy HDU object." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "aladin.add_fits(Path(\"images/m31.fits\"), name=\"M31\", opacity=0.5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can add markers to the view of the widget with custom popup title and description.\n", "Here we will add markers for Messier objects M1 to M10." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "markers = []\n", "for i in range(1, 11):\n", " name = f\"M{i}\"\n", " markers.append(\n", " Marker(\n", " position=name,\n", " title=name,\n", " # the title and description can be written as plain text or as html elements\n", " description=(\n", " ' '\n", " \"Read more on SIMBAD\"\n", " ),\n", " )\n", " )\n", "aladin.add_markers(markers, name=\"M1-M10\", color=\"pink\", shape=\"cross\", source_size=15)\n", "aladin.target = \"M1\"\n", "aladin.fov = 0.2" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 4 }