cosmogrb.utils.plotting package¶
Submodules¶
cosmogrb.utils.plotting.angle module¶
Angle utilities.
-
cosmogrb.utils.plotting.angle.
reference_angle
(a)[source]¶ Convert an angle to a reference angle between -pi and pi.
-
cosmogrb.utils.plotting.angle.
reference_angle_deg
(a)[source]¶ Convert an angle to a reference angle between -180 and 180 degrees.
cosmogrb.utils.plotting.channel_plot module¶
cosmogrb.utils.plotting.itrs_frame_monkeypatch module¶
Workaround for https://github.com/astropy/astropy/pull/9609.
cosmogrb.utils.plotting.projections module¶
Axes subclasses for astronomical mapmaking.
This module adds several astropy.visualization.wcsaxes.WCSAxes
subclasses to the Matplotlib projection registry. The projections have names of
the form astro_or_geo [lon_units] projection
.
astro_or_geo
may be astro
or geo
. It controls the
reference frame, either celestial (ICRS) or terrestrial (ITRS).
lon_units
may be hours
or degrees
. It controls the units of
the longitude axis. If omitted, astro
implies hours
and geo
implies
degrees.
projection
may be any of the following:
aitoff
for the Aitoff all-sky projectionmollweide
for the Mollweide all-sky projectionglobe
for an orthographic projection, like the three-dimensional view of the Earth from a distant satellitezoom
for a gnomonic projection suitable for visualizing small zoomed-in patches
Some of the projections support additional optional arguments. The globe
projections support the options center
and rotate
. The zoom
projections support the options center
, radius
, and rotate
.
Examples
Complete Example¶
The following example demonstrates most of the features of this module.
-
class
cosmogrb.utils.plotting.projections.
AutoScaledWCSAxes
(*args, header, obstime=None, **kwargs)[source]¶ Bases:
astropy.visualization.wcsaxes.core.WCSAxes
Axes base class. The pixel scale is adjusted to the DPI of the image, and there are a variety of convenience methods.
-
compass
(x, y, size)[source]¶ Add a compass to indicate the north and east directions.
Parameters: - x, y (float) – Position of compass vertex in axes coordinates.
- size (float) – Size of compass in axes coordinates.
-
connect_inset_axes
(ax, loc, *args, **kwargs)[source]¶ Connect a corner of another WCSAxes to the matching point inside this one.
Parameters: - ax (astropy.visualization.wcsaxes.WCSAxes) – The other axes.
- loc (int, str) – Which corner to connect. For valid values, see matplotlib.offsetbox.AnchoredOffsetbox.
Other Parameters: - args – Extra arguments for matplotlib.patches.ConnectionPatch
- kwargs – Extra keyword arguments for matplotlib.patches.ConnectionPatch
Returns: patch
Return type: matplotlib.patches.ConnectionPatch
-
contour_hpx
(data, hdu_in=None, order='bilinear', nested=False, field=0, smooth=None, **kwargs)[source]¶ Add contour levels for a HEALPix data set.
Parameters: - data (numpy.ndarray or str or ~astropy.io.fits.TableHDU or ~astropy.io.fits.BinTableHDU or tuple) – The HEALPix data set. If this is a numpy.ndarray, then it is interpreted as the HEALPix array in the same coordinate system as the axes. Otherwise, the input data can be any type that is understood by reproject.reproject_from_healpix.
- smooth (astropy.units.Quantity, optional) – An optional smoothing length in angle-compatible units.
Other Parameters: - hdu_in, order, nested, field, smooth – Extra arguments for reproject.reproject_from_healpix
- kwargs – Extra keyword arguments for matplotlib.axes.Axes.contour
Returns: countours
Return type: matplotlib.contour.QuadContourSet
-
contourf_hpx
(data, hdu_in=None, order='bilinear', nested=False, field=0, smooth=None, **kwargs)[source]¶ Add filled contour levels for a HEALPix data set.
Parameters: - data (numpy.ndarray or str or ~astropy.io.fits.TableHDU or ~astropy.io.fits.BinTableHDU or tuple) – The HEALPix data set. If this is a numpy.ndarray, then it is interpreted as the HEALPix array in the same coordinate system as the axes. Otherwise, the input data can be any type that is understood by reproject.reproject_from_healpix.
- smooth (astropy.units.Quantity, optional) – An optional smoothing length in angle-compatible units.
Other Parameters: - hdu_in, order, nested, field, smooth – Extra arguments for reproject.reproject_from_healpix
- kwargs – Extra keyword arguments for matplotlib.axes.Axes.contour
Returns: contours
Return type: matplotlib.contour.QuadContourSet
-
header
¶
-
imshow_hpx
(data, hdu_in=None, order='bilinear', nested=False, field=0, smooth=None, **kwargs)[source]¶ Add an image for a HEALPix data set.
Parameters: - data (numpy.ndarray or str or ~astropy.io.fits.TableHDU or ~astropy.io.fits.BinTableHDU or tuple) – The HEALPix data set. If this is a numpy.ndarray, then it is interpreted as the HEALPix array in the same coordinate system as the axes. Otherwise, the input data can be any type that is understood by reproject.reproject_from_healpix.
- smooth (astropy.units.Quantity, optional) – An optional smoothing length in angle-compatible units.
Other Parameters: - hdu_in, order, nested, field, smooth – Extra arguments for reproject.reproject_from_healpix
- kwargs – Extra keyword arguments for matplotlib.axes.Axes.contour
Returns: image
Return type: matplotlib.image.AxesImage
-
mark_inset_axes
(ax, *args, **kwargs)[source]¶ Outline the footprint of another WCSAxes inside this one.
Parameters: ax (astropy.visualization.wcsaxes.WCSAxes) – The other axes.
Other Parameters: - args – Extra arguments for matplotlib.patches.PathPatch
- kwargs – Extra keyword arguments for matplotlib.patches.PathPatch
Returns: patch
Return type: matplotlib.patches.PathPatch
-
name
= 'astro wcs'¶
-
scalebar
(*args, **kwargs)[source]¶ Add scale bar.
Parameters: - xy (tuple) – The axes coordinates of the scale bar.
- length (astropy.units.Quantity) – The length of the scale bar in angle-compatible units.
Other Parameters: - args – Extra arguments for matplotlib.patches.FancyArrowPatch
- kwargs – Extra keyword arguments for matplotlib.patches.FancyArrowPatch
Returns: patch
Return type: matplotlib.patches.FancyArrowPatch
-
-
class
cosmogrb.utils.plotting.projections.
ScaleBar
(ax, xy, length, *args, **kwargs)[source]¶ Bases:
matplotlib.patches.FancyArrowPatch
-
class
cosmogrb.utils.plotting.projections.
AstroHoursAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Aitoff
-
name
= 'astro hours aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroHoursGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Globe
-
name
= 'astro hours globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroHoursMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Mollweide
-
name
= 'astro hours mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroHoursZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Zoom
-
name
= 'astro hours zoom'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroDegreesAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Aitoff
-
name
= 'astro degrees aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroDegreesGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Globe
-
name
= 'astro degrees globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroDegreesMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Mollweide
-
name
= 'astro degrees mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroDegreesZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Astro
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Zoom
-
name
= 'astro degrees zoom'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoHoursAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Aitoff
-
name
= 'geo hours aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoHoursGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Globe
-
name
= 'geo hours globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoHoursMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Mollweide
-
name
= 'geo hours mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoHoursZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Hours
,cosmogrb.utils.plotting.projections.Zoom
-
name
= 'geo hours zoom'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoDegreesAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Aitoff
-
name
= 'geo degrees aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoDegreesGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Globe
-
name
= 'geo degrees globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoDegreesMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Mollweide
-
name
= 'geo degrees mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoDegreesZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.Geo
,cosmogrb.utils.plotting.projections.Degrees
,cosmogrb.utils.plotting.projections.Zoom
-
name
= 'geo degrees zoom'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.AstroHoursAitoffAxes
-
name
= 'astro aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.AstroHoursGlobeAxes
-
name
= 'astro globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.AstroHoursMollweideAxes
-
name
= 'astro mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
AstroZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.AstroHoursZoomAxes
-
name
= 'astro zoom'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoAitoffAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.GeoDegreesAitoffAxes
-
name
= 'geo aitoff'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoGlobeAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.GeoDegreesGlobeAxes
-
name
= 'geo globe'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoMollweideAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.GeoDegreesMollweideAxes
-
name
= 'geo mollweide'¶
-
-
class
cosmogrb.utils.plotting.projections.
GeoZoomAxes
(*args, **kwargs)¶ Bases:
cosmogrb.utils.plotting.projections.GeoDegreesZoomAxes
-
name
= 'geo zoom'¶
-