Aladin commands#

[1]:
from ipyaladin import Aladin
from pathlib import Path

A list of all available commands can be displayed as such.

[2]:
print(dir(Aladin))
['__annotations__', '__class__', '__copy__', '__deepcopy__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_active_widgets', '_add_notifiers', '_all_trait_default_generators', '_anywidget_commands', '_call_widget_constructed', '_comm_changed', '_compare', '_control_comm', '_css', '_default_keys', '_descriptors', '_dom_classes', '_esm', '_fov', '_fov_xy', '_gen_repr_from_keys', '_get_embed_state', '_get_trait_default_generator', '_handle_control_comm_msg', '_handle_custom_message', '_handle_custom_msg', '_handle_msg', '_height', '_holding_sync', '_init_options', '_instance_inits', '_is_numpy', '_lock_property', '_log_default', '_model_module', '_model_module_version', '_model_name', '_msg_callbacks', '_notify_observers', '_notify_trait', '_property_lock', '_register_validator', '_remove_notifiers', '_repr_keys', '_repr_mimebundle_', '_send', '_should_send_property', '_states_to_send', '_static_immutable_initial_values', '_target', '_trait_default_generators', '_trait_from_json', '_trait_to_json', '_traits', '_view_count', '_view_module', '_view_module_version', '_view_name', '_wcs', '_widget_construction_callback', '_widget_types', 'add_catalog_from_URL', 'add_class', 'add_fits', 'add_graphic_overlay_from_region', 'add_graphic_overlay_from_stcs', 'add_listener', 'add_moc', 'add_moc_from_URL', 'add_moc_from_dict', 'add_overlay_from_stcs', 'add_table', 'add_traits', 'background_color', 'blur', 'class_own_trait_events', 'class_own_traits', 'class_trait_names', 'class_traits', 'clicked_object', 'close', 'close_all', 'comm', 'coo_frame', 'cross_validation_lock', 'focus', 'fov', 'fov_xy', 'full_screen', 'get_JPEG_thumbnail', 'get_manager_state', 'get_state', 'get_view_spec', 'grid_color', 'grid_opacity', 'grid_options', 'handle_comm_opened', 'handle_control_comm_opened', 'has_trait', 'height', 'hold_sync', 'hold_trait_notifications', 'init_options', 'keys', 'layout', 'listener_callback', 'log', 'model_id', 'notify_change', 'observe', 'on_msg', 'on_trait_change', 'on_widget_constructed', 'open', 'overlay_survey', 'overlay_survey_opacity', 'projection', 'rectangular_selection', 'remove_class', 'reticle_color', 'reticle_size', 'samp', 'send', 'send_state', 'set_color_map', 'set_listener', 'set_state', 'set_trait', 'setup_instance', 'show_catalog', 'show_context_menu', 'show_coo_grid', 'show_coo_grid_control', 'show_coo_location', 'show_fov', 'show_frame', 'show_fullscreen_control', 'show_layers_control', 'show_projection_control', 'show_reticle', 'show_settings_control', 'show_share_control', 'show_simbad_pointer_control', 'show_status_bar', 'show_zoom_control', 'survey', 'tabbable', 'target', 'tooltip', 'trait_defaults', 'trait_events', 'trait_has_value', 'trait_metadata', 'trait_names', 'trait_values', 'traits', 'unobserve', 'unobserve_all', 'wcs', 'widget_types', 'widgets']

A few of them are illustrated in the next cells. Let’s first, create the widget with a few initial parameters:

[3]:
aladin = Aladin(fov=20, reticle_size=64, reticle_color="#ff89ff")
aladin
[3]:

They can also be modified in the next cells with an interactive effect on the generated view.

[4]:
aladin.target = "sgr a*"
[5]:
aladin.target
[5]:
<SkyCoord (ICRS): (ra, dec) in deg
    (266.41681663, -29.00782497)>

The x-axis field of view (fov) can be set

[6]:
aladin.fov = 2
[7]:
aladin.fov
[7]:
$2^\circ00{}^\prime00{}^{\prime\prime}$

The overlay survey is always on top of the base layer

[8]:
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).

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

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

[11]:
from astropy.coordinates import Angle, SkyCoord
[12]:
aladin.target = SkyCoord("12h00m00s", "-30d00m00s", frame="icrs")
[13]:
aladin.fov = Angle(5, "deg")

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 astropy HDU object.

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