Aladin commands#

[1]:
from astropy.coordinates import Angle, SkyCoord
from ipyaladin import Aladin, Marker
from pathlib import Path

ipyaladin’s full list of methods can be found in the documentation here. A few of them are illustrated in the next cells. Let’s first, create the widget with a few initial parameters:

[2]:
aladin = Aladin(
    target=SkyCoord(10, 20, unit="deg"),
    fov=Angle(20, "deg"),
    reticle_size=64,
    reticle_color="#ff89ff",
)
aladin
[2]:

We can always see the current state of the widget target, field of view and rotation:

[3]:
print(aladin.target)
print(aladin.fov)
print(aladin.rotation)
<SkyCoord (ICRS): (ra, dec) in deg
    (10., 20.)>
20d00m00s
0d00m00s

And then, these values can be modified either interactively (with your mouse on the widget) or programmatically in the next cells with an interactive effect on the generated view.

[4]:
aladin.target = "sgr a*"  # either an object name or a SkyCoord
aladin.target
[4]:
<SkyCoord (ICRS): (ra, dec) in deg
    (266.41681663, -29.00782497)>

The field of view fov sets the zoom factor on the x-axis:

[5]:
aladin.fov = 2  # either a number in degrees or an astropy angle
aladin.fov
[5]:
$2^\circ00{}^\prime00{}^{\prime\prime}$

The orientation of the view (view center to north pole angle in degrees) can be set:

[6]:
aladin.rotation = 180  # either a number in degrees or an astropy angle
aladin.rotation
[6]:
$180^\circ00{}^\prime00{}^{\prime\prime}$

The overlay survey is always on top of the base layer

[7]:
aladin.overlay_survey = "P/allWISE/color"
aladin.overlay_survey_opacity = 0.5

We can change the coordinate frame (the choices are ICRS, ICRSd or Galactic).

[8]:
aladin.coo_frame = "ICRSd"  # ICRS, and angles expressed in degrees
[9]:
aladin.coo_frame
[9]:
'ICRSd'

The target, rotation, and field of view can be set with astropy objects

[10]:
aladin.target = SkyCoord("12h00m00s", "-30d00m00s", frame="icrs")
[11]:
aladin.rotation = Angle(0, "deg")
[12]:
aladin.fov = Angle(5, "deg")

You can add a FITS image to the view of the widget, either as a path (string of pathlib.Path object) or as an astropy HDU object.

[13]:
aladin.add_fits(Path("images/m31.fits"), name="M31", opacity=0.5)

You can add markers to the view of the widget with custom popup title and description. Here we will add markers for Messier objects M1 to M10.

[14]:
markers = []
for i in range(1, 11):
    name = f"M{i}"
    markers.append(
        Marker(
            position=name,
            title=name,
            # the title and description can be written as plain text or as html elements
            description=(
                '<a href="https://simbad.cds.unistra.fr/simbad/'
                f'sim-basic?Ident={name}&submit=SIMBAD+search"> '
                "Read more on SIMBAD</a>"
            ),
        )
    )
aladin.add_markers(markers, name="M1-M10", color="pink", shape="cross", source_size=15)
aladin.target = "M1"
aladin.fov = 0.2