Display of a Multi Order Coverage (MOC)#
[1]:
from ipyaladin import Aladin
from mocpy import MOC
import astropy.units as u
aladin = Aladin(target="15 26 20.534 -57 02 14.74", fov=135, survey="P/Mellinger/color")
aladin
[1]:
From an URL#
[2]:
moc_from_url = aladin.add_moc(
"https://alasky.u-strasbg.fr/footprints/tables/vizier/II_337_vvv1/MOC?nside=256",
color="violet",
opacity=0.3,
fill=True,
edge=True,
)
From a dictionnary#
[3]:
moc = {
"4": [
32,
33,
36,
51,
54,
55,
98,
99,
102,
112,
113,
116,
117,
1101,
1118,
1600,
1638,
2581,
2582,
2588,
2590,
2612,
2614,
2620,
2622,
2708,
2710,
2716,
2718,
2749,
],
"5": [
42,
43,
150,
151,
152,
153,
156,
157,
194,
195,
198,
199,
200,
201,
203,
210,
378,
379,
382,
383,
387,
390,
391,
402,
403,
406,
407,
412,
413,
456,
457,
460,
461,
472,
1470,
1751,
1755,
1756,
1757,
1758,
1766,
1767,
1769,
1770,
1771,
1772,
1773,
1776,
1777,
1778,
1811,
1817,
1818,
1831,
1835,
1836,
1838,
1840,
1920,
1921,
1922,
4188,
4189,
4363,
4366,
4367,
4389,
4400,
4401,
4450,
4451,
4454,
4456,
4457,
4460,
4461,
4463,
4476,
4478,
4479,
4561,
4564,
4565,
6229,
6408,
6409,
6411,
6412,
6414,
6433,
6436,
6438,
6439,
6444,
6445,
6447,
6533,
6544,
6546,
6577,
6579,
6582,
6588,
6590,
6591,
6933,
6935,
6984,
6986,
7008,
7011,
7017,
10321,
10323,
10332,
10333,
10334,
10356,
10358,
10364,
10366,
10445,
10447,
10469,
10477,
10479,
10821,
10823,
10878,
10960,
10961,
10963,
10964,
10966,
10969,
10971,
10972,
10974,
10975,
11004,
11005,
11007,
11176,
11178,
11370,
11373,
11405,
11406,
11407,
11410,
11411,
11412,
11413,
11414,
11416,
11425,
11426,
11427,
11428,
11432,
],
}
[4]:
moc_from_dict = aladin.add_moc(moc)
From a mocpy object#
[5]:
moc = MOC.from_ring(
lon=231.5855583 * u.deg,
lat=-57.03742777 * u.deg,
internal_radius=10 * u.deg,
external_radius=20 * u.deg,
max_depth=16,
)
moc_from_mocpy = aladin.add_moc(
moc, color="teal", edge=True, line_width=3, fill=True, opacity=0.5
)
We can visually check in the widget that all of the MOCs were added, and we can call the following to get the names of the mocs we added.
[6]:
aladin.overlays
[6]:
['moc', 'moc_1', 'moc_2']
If you want to further distinguish which MOC is which, try calling .update() with any options you want to change for the MOC. See possible options at https://cds-astro.github.io/aladin-lite/global.html#MOCOptions
Run the cell below to update the name, fill, and color of moc_from_dict
[7]:
moc_from_dict = moc_from_dict.update(name="moc_from_dict", color="green")
By running the following cell, we can confirm that our re-naming worked (we now see moc_from_dict instead of moc_1). You can see the same re-naming by opening the widget’s overlays menu.
[8]:
aladin.overlays
[8]:
['moc', 'moc_2', 'moc_from_dict']
If you forget which parameters you set for a given overlay, you can call the Overlay object to get a dictionary of the parameters you set.
[9]:
moc_from_url
[9]:
{'type': 'moc',
'moc': 'https://alasky.u-strasbg.fr/footprints/tables/vizier/II_337_vvv1/MOC?nside=256',
'options': {'color': 'violet',
'opacity': 0.3,
'fill': True,
'edge': True,
'name': 'moc'}}
Or, you can run the following cell to get more specific details about an Overlay instead of the summary dictionary.
[10]:
print("overlay name:", moc_from_url.name)
print("overlay type:", moc_from_url.type)
print("overlay options:", moc_from_url.options)
print("overlay data:", moc_from_url.data)
overlay name: moc
overlay type: moc
overlay options: {'color': 'violet', 'opacity': 0.3, 'fill': True, 'edge': True, 'name': 'moc'}
overlay data: {'moc': 'https://alasky.u-strasbg.fr/footprints/tables/vizier/II_337_vvv1/MOC?nside=256'}