mocpy.WCS¶
- class mocpy.WCS(fig, fov, center=<SkyCoord (ICRS): (ra, dec) in deg (0., 0.)>, coordsys='icrs', projection='AIT', rotation=<Angle 0. rad>)[source]¶
- Create a WCS for visualizing a MOC in a matplotlib axis. - This method is a quick astropy WCS instantiation and does not fit every use case. It is especially not designed for all-sky plots. - Parameters:
- figfigure
- The matplotlib figure used for plotting the MOC. 
- fovQuantityor Sequence[Quantity,Quantity]
- Size of the field of view. If it is a sequence, it must be of length 2 and represent the longitudinal and latitudinal field of views. 
- centerSkyCoord, optional
- World coordinates matching with the center of the plot. Default to (0 deg, 0 deg) (in ICRS frame). 
- coordsysstr, optional
- Coordinate system. Default to “icrs”. Must be in [“icrs”, “galactic”]. 
- projectionstr, optional
- World base -> Image base projection type. See http://docs.astropy.org/en/stable/wcs/#supported-projections for the projections currently supported in astropy. Default to Aitoff. 
- rotationAngle, optional
- The angle of rotation. Default to no rotation. 
 
- fig
- Returns:
- wcsWCS
- The WCS that can be passed to mocpy.MOC.fill/border. 
 
- wcs
 - Examples - >>> from mocpy import MOC, WCS >>> from astropy.coordinates import Angle, SkyCoord >>> import matplotlib.pyplot as plt >>> import astropy.units as u >>> # Create a MOC >>> moc = MOC.from_elliptical_cone(lon = 0 * u.rad, ... lat = 0 * u.rad, ... a = 50 * u.deg, ... b = 20 * u.deg, ... pa = 90 * u.deg, ... max_depth = 13, ... ) >>> fig = plt.figure(figsize=(10, 10)) >>> with WCS(fig, ... fov=200 * u.deg, ... center=SkyCoord(0, 20, unit='deg', frame='icrs'), ... coordsys="icrs", ... rotation=Angle(0, u.degree), ... projection="AIT") as wcs: wcs = wcs >>> ax = fig.add_subplot(projection=wcs) >>> # Call fill with a matplotlib axe and the `~astropy.wcs.WCS` wcs object. >>> moc.fill(ax=ax, wcs=wcs, alpha=0.5, fill=True, color="green") >>> moc.border(ax=ax, wcs=wcs, alpha=0.5, color="black")