{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Aladin commands" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ipyaladin import Aladin\n", "from pathlib import Path" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "A list of all available commands can be displayed as such." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(dir(Aladin))" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "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": { "tags": [] }, "outputs": [], "source": [ "aladin.target = \"sgr a*\"" ] }, { "cell_type": "code", "metadata": {}, "source": [ "aladin.target" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": {}, "source": [ "The x-axis field of view (fov) can be set" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [] }, "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": { "tags": [] }, "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": { "tags": [] }, "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", "metadata": {}, "source": [ "from astropy.coordinates import Angle, SkyCoord" ], "outputs": [], "execution_count": null }, { "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 also 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)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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" }, "vscode": { "interpreter": { "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" } } }, "nbformat": 4, "nbformat_minor": 4 }