We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi there,
Not really an issue, but I wanted to inform you that support for regions has been added in ipyaladin>=0.4.0 and mocpy>=0.16.0 .
This can be installed with pip install ipyaladin. You can now do (in a notebook)
pip install ipyaladin
Cell 1: load the widget
Cell 1
from ipyaladin import Aladin from regions import ( CircleSkyRegion, EllipseSkyRegion, LineSkyRegion, PolygonSkyRegion, RectangleSkyRegion, RegionVisual, ) aladin = Aladin(target="m31", fov=10) aladin
Cell 2: define regions
Cell 2
center = SkyCoord.from_name("M31") circle = CircleSkyRegion( center=center, radius=Angle(0.5, "deg"), visual={"edgecolor": "yellow"} ) ellipse = EllipseSkyRegion( center=center, height=Angle(0.5, "deg"), width=Angle(1, "deg"), angle=Angle(45, "deg"), visual=RegionVisual(edgecolor="red"), ) line = LineSkyRegion( start=center, end=center.directional_offset_by(Angle(0, "deg"), Angle(0.5, "deg")), visual=RegionVisual(edgecolor="green"), ) polygon = PolygonSkyRegion( vertices=SkyCoord( [ center.directional_offset_by(Angle(0, "deg"), Angle(0.5, "deg")), center.directional_offset_by(Angle(90, "deg"), Angle(0.5, "deg")), center.directional_offset_by(Angle(-90, "deg"), Angle(0.5, "deg")), ], frame="icrs", unit="deg", ), visual={"edgecolor": "blue"}, ) rectangle = RectangleSkyRegion( center=center, width=Angle(1, "deg"), height=Angle(1, "deg"), angle=Angle(45, "deg"), visual=RegionVisual(color="purple"), )
Cell 3: add the regions to the widget
Cell 3
aladin.add_graphic_overlay_from_region([circle, ellipse, line, polygon, rectangle])
If you scroll up to the widget, you should see
This is exctracted from the notebook 9 in ipyaladin's examples, see https://cds-astro.github.io/ipyaladin/_collections/notebooks/09_Displaying_Shapes.html .
It is installed with pip install mocpy. You can now build a MOC (an ensemble of healpix cells that represent an approximated region) from a regions
pip install mocpy
regions
import matplotlib.pyplot as plt import regions from astropy import units as u from astropy.coordinates import SkyCoord from mocpy import MOC center = SkyCoord(42, 43, unit="deg", frame="fk5") ring = regions.CircleAnnulusSkyRegion(center, 3 * u.deg, 4 * u.deg) moc_ring = MOC.from_astropy_regions(ring, max_depth=9) fig = plt.figure(figsize=(5, 5)) wcs = moc_ring.wcs(fig) ax = fig.add_subplot(projection=wcs) moc_ring.fill(ax, wcs, color="pink", alpha=0.8) moc_ring.border(ax, wcs) ring.to_pixel(wcs).plot(color="r");
This is exctracted from notebook 02 in mocpy's repository, see https://cds-astro.github.io/mocpy/_collections/notebooks/02-Creating_MOCs_from_astropy_regions.html
02
The supported astropy regions are:
The text was updated successfully, but these errors were encountered:
Thanks, @ManonMarchand. This is great!
Sorry, something went wrong.
No branches or pull requests
Hi there,
Not really an issue, but I wanted to inform you that support for regions has been added in ipyaladin>=0.4.0 and mocpy>=0.16.0 .
In ipyaladin
This can be installed with
pip install ipyaladin
. You can now do (in a notebook)Cell 1
: load the widgetCell 2
: define regionsCell 3
: add the regions to the widgetIf you scroll up to the widget, you should see
This is exctracted from the notebook 9 in ipyaladin's examples, see https://cds-astro.github.io/ipyaladin/_collections/notebooks/09_Displaying_Shapes.html .
In mocpy
It is installed with
pip install mocpy
. You can now build a MOC (an ensemble of healpix cells that represent an approximated region) from aregions
This is exctracted from notebook
02
in mocpy's repository, see https://cds-astro.github.io/mocpy/_collections/notebooks/02-Creating_MOCs_from_astropy_regions.htmlThe supported astropy regions are:
The text was updated successfully, but these errors were encountered: