Plots¶
- class rubin_sim.maf.plots.BaseHistogram[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.BasePlotter[source]¶
Bases:
object
Serve as the base type for MAF plotters and example of API.
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.BaseSkyMap[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.CategoricalHourglassPlotMixin(*args, **kwargs)[source]¶
Bases:
object
A mix-in to allow the HourglassPlot to accept categorical data, rather than float/int.
- class rubin_sim.maf.plots.FOPlot[source]¶
Bases:
BasePlotter
Special plotter to generate and label fO plots.
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.GeneralHourglassPlot(tz='Chile/Continental', site='Cerro Pachon', solar_time=True, marked_ra=None)[source]¶
Bases:
BasePlotter
Make an hourglass plot
- Parameters:
tz (
str
) – The timezone to usesite (
str
) – The site name (sent toastropy.coordinates.EarthLocation.of_site
)solar_time (
bool
) – Use solar time as the x axis (instead of civil time)?marked_ra (
dict
) – A dictionary of RA values (in deg) for which to label transit lines.more (A general feature of the hourglass plot is that you can pass)
values (data (such as the metric)
survey) (calculated for the entire)
plotter (to the plotter than are actually included in the plot. The)
data (will pull out the select subset of)
kwargs. (defined by)
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
Restructure the metric data to use, and build the figure.
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.HealpixHistogram[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.HealpixPowerSpectrum[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.HealpixSDSSSkyMap[source]¶
Bases:
BasePlotter
- __call__(metric_value_in, slicer, user_plot_dict, fig=None)[source]¶
Plot the sky map of metric_value using healpy cartview plots in thin strips. raMin: Minimum RA to plot (deg) raMax: Max RA to plot (deg). Note raMin/raMax define the centers that will be plotted. raLen: Length of the plotted strips in degrees decMin: minimum dec value to plot decMax: max dec value to plot metric_value_in: metric values
- class rubin_sim.maf.plots.HealpixSkyMap[source]¶
Bases:
BasePlotter
Generate a sky map of healpix metric values using healpy’s mollweide view.
- __call__(metric_value_in, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.HourglassPlot[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.HpxmapPlotter[source]¶
Bases:
SkyprojPlotter
- decorate()[source]¶
Add decorations/annotations to the sky plot.
Notes
For decorations that depend on the time or location of the observer (e.g., the horizon and sun and moon positions) this method relies on the site location and time (as an mjd) set in the
model_observatory
element of theplot_dict
, which should be of the classrubin_scheduler.scheduler.model_observatory.ModelObservatory
. Other decorations (e.g., the ecliptic and galactic plane) can be shown even whenmodel_observatory
is not set.
- class rubin_sim.maf.plots.Integral[source]¶
Bases:
Rational
Integral adds methods that work on integral numbers.
In short, these are conversion to int, pow with modulus, and the bit-string operations.
- abstract __pow__(exponent, modulus=None)[source]¶
self ** exponent % modulus, but maybe faster.
Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn’t Integral. Otherwise, just implement the 2-argument version described in Complex.
- property denominator¶
Integers have a denominator of 1.
- property numerator¶
Integers are their own numerators.
- class rubin_sim.maf.plots.LambertSkyMap[source]¶
Bases:
BasePlotter
Use basemap and contour to make a Lambertian projection. Note that the plot_dict can include a ‘basemap’ key with a dictionary of arbitrary kwargs to use with the call to Basemap.
- class rubin_sim.maf.plots.MetricVsH[source]¶
Bases:
BasePlotter
Plot metric values versus H. Marginalize over metric values in each H bin using ‘np_reduce’.
- class rubin_sim.maf.plots.MetricVsOrbit(xaxis='q', yaxis='e')[source]¶
Bases:
BasePlotter
Plot metric values (at a particular H value) vs. orbital parameters. Marginalize over metric values in each orbital bin using ‘np_reduce’.
- class rubin_sim.maf.plots.MetricVsOrbitPoints(xaxis='q', yaxis='e')[source]¶
Bases:
BasePlotter
Plot metric values (at a particular H value) as function of orbital parameters, using points for each metric value.
- class rubin_sim.maf.plots.MonthHourglassCategoricalPlot(*args, **kwargs)[source]¶
Bases:
CategoricalHourglassPlotMixin
,MonthHourglassPlot
Plot categorical data for a Month.
- class rubin_sim.maf.plots.MonthHourglassPlot(month, year, **kwargs)[source]¶
Bases:
GeneralHourglassPlot
Make an hourglass plot for a month
- Parameters:
month (
int
) – The month number (1-12).year (
int
) – The year.GeneralHourglassPlot (Keyward arguments are passed to)
metric (Note that this pulls the chosen month's data out of the)
Unsubclassed (values calculated for the entire survey.)
class (this)
data (expects to obtain float/int data. To use it with other)
its
mixin (subclass that includes the appropriate)
a ((MonthHourglassCategoricalPlot or MonthHourglassUsePlot) or)
subclass. (custom)
- class rubin_sim.maf.plots.MonthHourglassUsePlot(*args, **kwargs)[source]¶
Bases:
TimeUseHourglassPlotMixin
,MonthHourglassPlot
Plot categorical ‘use’ data for one month.
- class rubin_sim.maf.plots.NeoDistancePlotter(step=0.01, eclip_max=10.0, eclip_min=-10.0)[source]¶
Bases:
BasePlotter
Special plotter to calculate and plot the maximum distance an H=22 NEO could be observable to, in any particular opsim observation.
- Parameters:
step (
float
, optional) – Step size to use for radial bins. Default is 0.01 AU.eclip_max (
float
,float
, optional) – Range of ecliptic latitude values to include when creating the plot.eclip_min (
float
,float
, optional) – Range of ecliptic latitude values to include when creating the plot.
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.NightPointingPlotter(mjd_col='observationStartMJD', alt_col='alt', az_col='az')[source]¶
Bases:
BasePlotter
- class rubin_sim.maf.plots.OneDBinnedData[source]¶
Bases:
BasePlotter
Plot data from a OneDSlicer.
- class rubin_sim.maf.plots.OneDSubsetData[source]¶
Bases:
BasePlotter
Plot a single axes from the sliceColList, identified by plot_dict[‘axis’], given the metric_values at all slicepoints [sums over non-visible axes].
- __call__(metric_values, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.PlotHandler(out_dir='.', results_db=None, savefig=True, fig_format='pdf', dpi=600, thumbnail=True, trim_whitespace=True)[source]¶
Bases:
object
Create plots from a single or series of metric bundles.
- Parameters:
out_dir (
str
, optional) – Directory to save output plots.results_db (
rubin_sim.maf.ResultsDb
, optional) – ResultsDb into which to record plot location and information.savefig (
bool
, optional) – Flag for saving images to disk (versus create and return to caller).fig_format (
str
, optional) – Figure format to use to save full-size output. Default PDF.dpi (
int
, optional) – DPI to save output figures to disk at. (for matplotlib figures).thumbnail (
bool
, optional) – Flag for saving thumbnails (reduced size pngs) to disk.trim_whitespace (
bool
, optional) – Flag for trimming whitespace option to matplotlib output figures. Default True, usually doesn’t need to be changed.
- plot(plot_func, plot_dicts=None, display_dict=None, outfile_root=None, outfile_suffix=None)[source]¶
Create a plot for the active metric bundles (self.set_metric_bundles).
- Parameters:
plot_func (
rubin_sim.plots.BasePlotter
) – The plotter to use to make the figure.plot_dicts (
list
of [dict
], optional) – List of plot_dicts for each metric bundle. Can use these to override individual metric bundle colors, etc.display_dict (
dict
, optional) – Information to save to resultsDb to accompany the figure on the show_maf pages. Generally set automatically. Includes a caption.outfile_root (
str
, optional) – Output filename. Generally set automatically, but can be overriden (such as when output filenames get too long).outfile_suffix (
str
, optional) – A suffix to add to the end of the default output filename. Useful when creating a series of plots, such as for a movie.
- Returns:
fig – The plot.
- Return type:
matplotlib.figure.Figure
- set_metric_bundles(m_bundles)[source]¶
Set the metric bundle or bundles (list or dictionary). Reuse the PlotHandler by resetting this reference. The metric bundles have to have the same slicer.
- set_plot_dicts(plot_dicts=None, plot_func=None, reset=False)[source]¶
Set or update the plot_dict for the (possibly joint) plots.
Resolution is: (from lowest to higher) auto-generated items (colors/labels/titles) < anything previously set in the plot_handler < defaults set by the plotter < explicitly set items in the metricBundle plot_dict < explicitly set items in the plot_dicts list passed to this method.
- class rubin_sim.maf.plots.RangeHourglassCategoricalPlot(*args, **kwargs)[source]¶
Bases:
CategoricalHourglassPlotMixin
,RangeHourglassPlot
Plot categorical data for a range of dates.
- class rubin_sim.maf.plots.SkyCoord(*args, copy=True, **kwargs)[source]¶
Bases:
MaskableShapedLikeNDArray
High-level object providing a flexible interface for celestial coordinate representation, manipulation, and transformation between systems.
The |SkyCoord| class accepts a wide variety of inputs for initialization. At a minimum these must provide one or more celestial coordinate values with unambiguous units. Inputs may be scalars or lists/tuples/arrays, yielding scalar or array coordinates (can be checked via
SkyCoord.isscalar
). Typically one also specifies the coordinate frame, though this is not required. The general pattern for spherical representations is:SkyCoord(COORD, [FRAME], keyword_args ...) SkyCoord(LON, LAT, [FRAME], keyword_args ...) SkyCoord(LON, LAT, [DISTANCE], frame=FRAME, unit=UNIT, keyword_args ...) SkyCoord([FRAME], <lon_attr>=LON, <lat_attr>=LAT, keyword_args ...)
It is also possible to input coordinate values in other representations such as cartesian or cylindrical. In this case one includes the keyword argument
representation_type='cartesian'
(for example) along with data inx
,y
, andz
.See also: https://docs.astropy.org/en/stable/coordinates/
Examples
The examples below illustrate common ways of initializing a |SkyCoord| object. For a complete description of the allowed syntax see the full coordinates documentation. First some imports:
>>> from astropy.coordinates import SkyCoord # High-level coordinates >>> from astropy.coordinates import ICRS, Galactic, FK4, FK5 # Low-level frames >>> from astropy.coordinates import Angle, Latitude, Longitude # Angles >>> import astropy.units as u
The coordinate values and frame specification can now be provided using positional and keyword arguments:
>>> c = SkyCoord(10, 20, unit="deg") # defaults to ICRS frame >>> c = SkyCoord([1, 2, 3], [-30, 45, 8], frame="icrs", unit="deg") # 3 coords >>> coords = ["1:12:43.2 +31:12:43", "1 12 43.2 +31 12 43"] >>> c = SkyCoord(coords, frame=FK4, unit=(u.hourangle, u.deg), obstime="J1992.21") >>> c = SkyCoord("1h12m43.2s +1d12m43s", frame=Galactic) # Units from string >>> c = SkyCoord(frame="galactic", l="1h12m43.2s", b="+1d12m43s") >>> ra = Longitude([1, 2, 3], unit=u.deg) # Could also use Angle >>> dec = np.array([4.5, 5.2, 6.3]) * u.deg # Astropy Quantity >>> c = SkyCoord(ra, dec, frame='icrs') >>> c = SkyCoord(frame=ICRS, ra=ra, dec=dec, obstime='2001-01-02T12:34:56') >>> c = FK4(1 * u.deg, 2 * u.deg) # Uses defaults for obstime, equinox >>> c = SkyCoord(c, obstime='J2010.11', equinox='B1965') # Override defaults >>> c = SkyCoord(w=0, u=1, v=2, unit='kpc', frame='galactic', ... representation_type='cartesian') >>> c = SkyCoord([ICRS(ra=1*u.deg, dec=2*u.deg), ICRS(ra=3*u.deg, dec=4*u.deg)])
Velocity components (proper motions or radial velocities) can also be provided in a similar manner:
>>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, radial_velocity=10*u.km/u.s) >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr)
As shown, the frame can be a
BaseCoordinateFrame
class or the corresponding string alias – lower-case versions of the class name that allow for creating a |SkyCoord| object and transforming frames without explicitly importing the frame classes.- Parameters:
frame (
BaseCoordinateFrame
class or string, optional) – Type of coordinate frame this |SkyCoord| should represent. Defaults to to ICRS if not given or given as None.unit (
Unit
, string, or tuple ofUnit
or str, optional) – Units for supplied coordinate values. If only one unit is supplied then it applies to all values. Note that passing only one unit might lead to unit conversion errors if the coordinate values are expected to have mixed physical meanings (e.g., angles and distances).obstime (time-like, optional) – Time(s) of observation.
equinox (time-like, optional) – Coordinate frame equinox time.
representation_type (str or Representation class) – Specifies the representation, e.g. ‘spherical’, ‘cartesian’, or ‘cylindrical’. This affects the positional args and other keyword args which must correspond to the given representation.
copy (bool, optional) – If
True
(default), a copy of any coordinate data is made. This argument can only be passed in as a keyword argument.**keyword_args –
Other keyword arguments as applicable for user-defined coordinate frames. Common options include:
- ra, decangle-like, optional
RA and Dec for frames where
ra
anddec
are keys in the frame’srepresentation_component_names
, includingICRS
,FK5
,FK4
, andFK4NoETerms
.- pm_ra_cosdec, pm_dec
Quantity
[‘angular speed’], optional Proper motion components, in angle per time units.
- l, bangle-like, optional
Galactic
l
andb
for for frames wherel
andb
are keys in the frame’srepresentation_component_names
, including theGalactic
frame.- pm_l_cosb, pm_b
Quantity
[‘angular speed’], optional Proper motion components in the
Galactic
frame, in angle per time units.- x, y, zfloat or
Quantity
[‘length’], optional Cartesian coordinates values
- u, v, wfloat or
Quantity
[‘length’], optional Cartesian coordinates values for the Galactic frame.
- radial_velocity
Quantity
[‘speed’], optional The component of the velocity along the line-of-sight (i.e., the radial direction), in velocity units.
- __dir__()[source]¶
Original dir() behavior, plus frame attributes and transforms.
This dir includes: - All attributes of the SkyCoord class - Coordinate transforms available by aliases - Attribute / methods of the underlying self.frame objects
- __eq__(value)[source]¶
Equality operator for SkyCoord.
This implements strict equality and requires that the frames are equivalent, extra frame attributes are equivalent, and that the representation data are exactly equal.
- __getattr__(attr)[source]¶
Overrides getattr to return coordinates that this can be transformed to, based on the alias attr in the primary transform graph.
- __setitem__(item, value)[source]¶
Implement self[item] = value for SkyCoord.
The right hand
value
must be strictly consistent with self: - Identical class - Equivalent frames - Identical representation_types - Identical representation differentials keys - Identical frame attributes - Identical “extra” frame attributes (e.g. obstime for an ICRS coord)With these caveats the setitem ends up as effectively a setitem on the representation data.
self.frame.data[item] = value.frame.data
- apply_space_motion(new_obstime=None, dt=None)[source]¶
Compute the position to a new time using the velocities.
Compute the position of the source represented by this coordinate object to a new time using the velocities stored in this object and assuming linear space motion (including relativistic corrections). This is sometimes referred to as an “epoch transformation”.
The initial time before the evolution is taken from the
obstime
attribute of this coordinate. Note that this method currently does not support evolving coordinates where the frame has anobstime
frame attribute, so theobstime
is only used for storing the before and after times, not actually as an attribute of the frame. Alternatively, ifdt
is given, anobstime
need not be provided at all.- Parameters:
new_obstime (
Time
, optional) – The time at which to evolve the position to. Requires that theobstime
attribute be present on this frame.dt (
Quantity
,TimeDelta
, optional) – An amount of time to evolve the position of the source. Cannot be given at the same time asnew_obstime
.
- Returns:
new_coord – A new coordinate object with the evolved location of this coordinate at the new time.
obstime
will be set on this object to the new time only ifself
also hasobstime
.- Return type:
- contained_by(wcs, image=None, **kwargs)[source]¶
Determines if the SkyCoord is contained in the given wcs footprint.
- Parameters:
wcs (
WCS
) – The coordinate to check if it is within the wcs coordinate.image (array) – Optional. The image associated with the wcs object that the coordinate is being checked against. If not given the naxis keywords will be used to determine if the coordinate falls within the wcs footprint.
**kwargs – Additional arguments to pass to
to_pixel
- Returns:
response – True means the WCS footprint contains the coordinate, False means it does not.
- Return type:
bool
- directional_offset_by(position_angle, separation)[source]¶
Computes coordinates at the given offset from this coordinate.
- Parameters:
position_angle (
Angle
) – position_angle of offsetseparation (
Angle
) – offset angular separation
- Returns:
newpoints – The coordinates for the location that corresponds to offsetting by the given
position_angle
andseparation
.- Return type:
SkyCoord
Notes
Returned SkyCoord frame retains only the frame attributes that are for the resulting frame type. (e.g. if the input frame is
ICRS
, anequinox
value will be retained, but anobstime
will not.)For a more complete set of transform offsets, use
WCS
.skyoffset_frame()
can also be used to create a spherical frame with (lat=0, lon=0) at a reference point, approximating an xy cartesian system for small offsets. This method is distinct in that it is accurate on the sphere.See also
position_angle()
inverse operation for the
position_angle
componentseparation()
inverse operation for the
separation
component
- classmethod from_name(name, frame='icrs', parse=False, cache=True)[source]¶
Given a name, query the CDS name resolver to attempt to retrieve coordinate information for that object. The search database, sesame url, and query timeout can be set through configuration items in
astropy.coordinates.name_resolve
– see docstring forget_icrs_coordinates
for more information.- Parameters:
name (str) – The name of the object to get coordinates for, e.g.
'M42'
.frame (str or
BaseCoordinateFrame
class or instance) – The frame to transform the object to.parse (bool) – Whether to attempt extracting the coordinates from the name by parsing with a regex. For objects catalog names that have J-coordinates embedded in their names, e.g., ‘CRTS SSS100805 J194428-420209’, this may be much faster than a Sesame query for the same object name. The coordinates extracted in this way may differ from the database coordinates by a few deci-arcseconds, so only use this option if you do not need sub-arcsecond accuracy for coordinates.
cache (bool, optional) – Determines whether to cache the results or not. To update or overwrite an existing value, pass
cache='update'
.
- Returns:
coord – Instance of the SkyCoord class.
- Return type:
- classmethod from_pixel(xp, yp, wcs, origin=0, mode='all')[source]¶
Create a new SkyCoord from pixel coordinates using a World Coordinate System.
- Parameters:
xp (float or ndarray) – The coordinates to convert.
yp (float or ndarray) – The coordinates to convert.
wcs (
WCS
) – The WCS to use for convertorigin (int) – Whether to return 0 or 1-based pixel coordinates.
mode ('all' or 'wcs') – Whether to do the transformation including distortions (
'all'
) or only including only the core WCS transformation ('wcs'
).
- Returns:
coord – A new object with sky coordinates corresponding to the input
xp
andyp
.- Return type:
SkyCoord
See also
to_pixel
to do the inverse operation
astropy.wcs.utils.pixel_to_skycoord
the implementation of this method
- get_constellation(short_name=False, constellation_list='iau')[source]¶
Determines the constellation(s) of the coordinates this SkyCoord contains.
- Parameters:
short_name (bool) – If True, the returned names are the IAU-sanctioned abbreviated names. Otherwise, full names for the constellations are used.
constellation_list (str) – The set of constellations to use. Currently only
'iau'
is supported, meaning the 88 “modern” constellations endorsed by the IAU.
- Returns:
constellation – If this is a scalar coordinate, returns the name of the constellation. If it is an array |SkyCoord|, it returns an array of names.
- Return type:
str or string array
Notes
To determine which constellation a point on the sky is in, this first precesses to B1875, and then uses the Delporte boundaries of the 88 modern constellations, as tabulated by Roman 1987.
See also
astropy.coordinates.get_constellation
- get_mask(*attrs)[source]¶
Get the mask associated with these coordinates.
- Parameters:
*attrs (str) – Attributes from which to get the masks to combine. Items can be dotted, like
"data.lon", "data.lat"
. By default, get the combined mask of all components (including from differentials), ignoring possible masks of attributes.- Returns:
mask – The combined, read-only mask. If the instance is not masked, it is an array of
False
with the correct shape.- Return type:
ndarray of bool
- Raises:
ValueError – If the coordinate frame has no associated data.
- classmethod guess_from_table(table, **coord_kwargs)[source]¶
A convenience method to create and return a new SkyCoord from the data in an astropy Table.
This method matches table columns that start with the case-insensitive names of the components of the requested frames (including differentials), if they are also followed by a non-alphanumeric character. It will also match columns that end with the component name if a non-alphanumeric character is before it.
For example, the first rule means columns with names like
'RA[J2000]'
or'ra'
will be interpreted asra
attributes forICRS
frames, but'RAJ2000'
or'radius'
are not. Similarly, the second rule applied to theGalactic
frame means that a column named'gal_l'
will be used as thel
component, butgall
or'fill'
will not.The definition of alphanumeric here is based on Unicode’s definition of alphanumeric, except without
_
(which is normally considered alphanumeric). So for ASCII, this means the non-alphanumeric characters are<space>_!"#$%&'()*+,-./\:;<=>?@[]^`{|}~
).- Parameters:
table (
Table
or subclass) – The table to load data from.**coord_kwargs – Any additional keyword arguments are passed directly to this class’s constructor.
- Returns:
newsc – The new instance.
- Return type:
SkyCoord
or subclass- Raises:
ValueError – If more than one match is found in the table for a component, unless the additional matches are also valid frame component names. If a “coord_kwargs” is provided for a value also found in the table.
- insert(obj, values, axis=0)[source]¶
Make a copy with coordinate values inserted before the given indices.
The values to be inserted must conform to the rules for in-place setting of the object.
The API signature matches the
np.insert
API, but is more limited. The specification of insert indexobj
must be a single integer, and theaxis
must be0
for simple insertion before the index.- Parameters:
obj (int) – Integer index before which
values
is inserted.values (array-like) – Value(s) to insert. If the type of
values
is different from that of quantity,values
is converted to the matching type.axis (int, optional) – Axis along which to insert
values
. Default is 0, which is the only allowed value and will insert a row.
- Returns:
coord – Copy of instance with new values inserted.
- Return type:
- is_equivalent_frame(other)[source]¶
Checks if this object’s frame is the same as that of the
other
object.To be the same frame, two objects must be the same frame class and have the same frame attributes. For two |SkyCoord| objects, all of the frame attributes have to match, not just those relevant for the object’s frame.
- Parameters:
other (SkyCoord or BaseCoordinateFrame) – The other object to check.
- Returns:
isequiv – True if the frames are the same, False if not.
- Return type:
bool
- Raises:
TypeError – If
other
isn’t a |SkyCoord| or a subclass ofBaseCoordinateFrame
.
- is_transformable_to(new_frame)[source]¶
Determines if this coordinate frame can be transformed to another given frame.
- Parameters:
new_frame (frame class, frame object, or str) – The proposed frame to transform into.
- Returns:
transformable –
True
if this can be transformed tonew_frame
,False
if not, or the string ‘same’ ifnew_frame
is the same system as this object but no transformation is defined.- Return type:
bool or str
Notes
A return value of ‘same’ means the transformation will work, but it will just give back a copy of this object. The intended usage is:
if coord.is_transformable_to(some_unknown_frame): coord2 = coord.transform_to(some_unknown_frame)
This will work even if
some_unknown_frame
turns out to be the same frame class ascoord
. This is intended for cases where the frame is the same regardless of the frame attributes (e.g. ICRS), but be aware that it might also indicate that someone forgot to define the transformation between two objects of the same frame class but with different attributes.
- property mask¶
The mask associated with these coordinates.
Combines the masks of all components of the underlying representation, including possible differentials.
- property masked¶
Whether the underlying data is masked.
- Raises:
ValueError – If the frame has no associated data.
- match_to_catalog_3d(catalogcoord, nthneighbor=1)[source]¶
Finds the nearest 3-dimensional matches of this coordinate to a set of catalog coordinates.
This finds the 3-dimensional closest neighbor, which is only different from the on-sky distance if
distance
is set in this object or thecatalogcoord
object.For more on how to use this (and related) functionality, see the examples in astropy-coordinates-separations-matching.
- Parameters:
catalogcoord (
SkyCoord
orBaseCoordinateFrame
) – The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e.,catalogcoord.isscalar == False
)nthneighbor (int, optional) – Which closest neighbor to search for. Typically
1
is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is2
, for matching a coordinate catalog against itself (1
is inappropriate because each point will find itself as the closest match).
- Returns:
idx (int array) – Indices into
catalogcoord
to get the matched points for each of this object’s coordinates. Shape matches this object.sep2d (
Angle
) – The on-sky separation between the closest match for each element in this object incatalogcoord
. Shape matches this object.dist3d (
Quantity
[‘length’]) – The 3D distance between the closest match for each element in this object incatalogcoord
. Shape matches this object.
Notes
This method requires SciPy to be installed or it will fail.
See also
astropy.coordinates.match_coordinates_3d
,SkyCoord.match_to_catalog_sky
- match_to_catalog_sky(catalogcoord, nthneighbor=1)[source]¶
Finds the nearest on-sky matches of this coordinate in a set of catalog coordinates.
For more on how to use this (and related) functionality, see the examples in astropy-coordinates-separations-matching.
- Parameters:
catalogcoord (
SkyCoord
orBaseCoordinateFrame
) – The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e.,catalogcoord.isscalar == False
)nthneighbor (int, optional) – Which closest neighbor to search for. Typically
1
is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is2
, for matching a coordinate catalog against itself (1
is inappropriate because each point will find itself as the closest match).
- Returns:
idx (int array) – Indices into
catalogcoord
to get the matched points for each of this object’s coordinates. Shape matches this object.sep2d (
Angle
) – The on-sky separation between the closest match for each element in this object incatalogcoord
. Shape matches this object.dist3d (
Quantity
[‘length’]) – The 3D distance between the closest match for each element in this object incatalogcoord
. Shape matches this object. Unless both this andcatalogcoord
have associated distances, this quantity assumes that all sources are at a distance of 1 (dimensionless).
Notes
This method requires SciPy to be installed or it will fail.
See also
astropy.coordinates.match_coordinates_sky
,SkyCoord.match_to_catalog_3d
- radial_velocity_correction(kind='barycentric', obstime=None, location=None)[source]¶
Compute the correction required to convert a radial velocity at a given time and place on the Earth’s Surface to a barycentric or heliocentric velocity.
- Parameters:
kind (str) – The kind of velocity correction. Must be ‘barycentric’ or ‘heliocentric’.
obstime (
Time
or None, optional) – The time at which to compute the correction. IfNone
, theobstime
frame attribute on the |SkyCoord| will be used.location (
EarthLocation
or None, optional) – The observer location at which to compute the correction. IfNone
, thelocation
frame attribute on the passed-inobstime
will be used, and if that is None, thelocation
frame attribute on the |SkyCoord| will be used.
- Raises:
ValueError – If either
obstime
orlocation
are passed in (notNone
) when the frame attribute is already set on this |SkyCoord|.TypeError – If
obstime
orlocation
aren’t provided, either as arguments or as frame attributes.
- Returns:
vcorr – The correction with a positive sign. I.e., add this to an observed radial velocity to get the barycentric (or heliocentric) velocity. If m/s precision or better is needed, see the notes below.
- Return type:
Quantity
[‘speed’]
Notes
The barycentric correction is calculated to higher precision than the heliocentric correction and includes additional physics (e.g time dilation). Use barycentric corrections if m/s precision is required.
The algorithm here is sufficient to perform corrections at the mm/s level, but care is needed in application. The barycentric correction returned uses the optical approximation v = z * c. Strictly speaking, the barycentric correction is multiplicative and should be applied as:
>>> from astropy.time import Time >>> from astropy.coordinates import SkyCoord, EarthLocation >>> from astropy.constants import c >>> t = Time(56370.5, format='mjd', scale='utc') >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m) >>> sc = SkyCoord(1*u.deg, 2*u.deg) >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc) >>> rv = rv + vcorr + rv * vcorr / c
Also note that this method returns the correction velocity in the so-called optical convention:
>>> vcorr = zb * c
where
zb
is the barycentric correction redshift as defined in section 3 of Wright & Eastman (2014). The application formula given above follows from their equation (11) under assumption that the radial velocityrv
has also been defined using the same optical convention. Note, this can be regarded as a matter of velocity definition and does not by itself imply any loss of accuracy, provided sufficient care has been taken during interpretation of the results. If you need the barycentric correction expressed as the full relativistic velocity (e.g., to provide it as the input to another software which performs the application), the following recipe can be used:>>> zb = vcorr / c >>> zb_plus_one_squared = (zb + 1) ** 2 >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)
or alternatively using just equivalencies:
>>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))
See also
doppler_optical
,doppler_radio
, anddoppler_relativistic
for more information on the velocity conventions.The default is for this method to use the builtin ephemeris for computing the sun and earth location. Other ephemerides can be chosen by setting the
solar_system_ephemeris
variable, either directly or viawith
statement. For example, to use the JPL ephemeris, do:>>> from astropy.coordinates import solar_system_ephemeris >>> sc = SkyCoord(1*u.deg, 2*u.deg) >>> with solar_system_ephemeris.set('jpl'): ... rv += sc.radial_velocity_correction(obstime=t, location=loc)
- search_around_3d(searcharoundcoords, distlimit)[source]¶
Searches for all coordinates in this object around a supplied set of points within a given 3D radius.
This is intended for use on
SkyCoord
objects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to useseparation_3d()
.For more on how to use this (and related) functionality, see the examples in astropy-coordinates-separations-matching.
- Parameters:
searcharoundcoords (
SkyCoord
orBaseCoordinateFrame
) – The coordinates to search around to try to find matching points in this |SkyCoord|. This should be an object with array coordinates, not a scalar coordinate object.distlimit (
Quantity
[‘length’]) – The physical radius to search within.
- Returns:
idxsearcharound (int array) – Indices into
searcharoundcoords
that match the corresponding elements ofidxself
. Shape matchesidxself
.idxself (int array) – Indices into
self
that match the corresponding elements ofidxsearcharound
. Shape matchesidxsearcharound
.sep2d (
Angle
) – The on-sky separation between the coordinates. Shape matchesidxsearcharound
andidxself
.dist3d (
Quantity
[‘length’]) – The 3D distance between the coordinates. Shape matchesidxsearcharound
andidxself
.
Notes
This method requires SciPy to be installed or it will fail.
In the current implementation, the return values are always sorted in the same order as the
searcharoundcoords
(soidxsearcharound
is in ascending order). This is considered an implementation detail, though, so it could change in a future release.See also
astropy.coordinates.search_around_3d
,SkyCoord.search_around_sky
- search_around_sky(searcharoundcoords, seplimit)[source]¶
Searches for all coordinates in this object around a supplied set of points within a given on-sky separation.
This is intended for use on
SkyCoord
objects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to useseparation()
.For more on how to use this (and related) functionality, see the examples in astropy-coordinates-separations-matching.
- Parameters:
searcharoundcoords (coordinate-like) – The coordinates to search around to try to find matching points in this |SkyCoord|. This should be an object with array coordinates, not a scalar coordinate object.
seplimit (
Quantity
[‘angle’]) – The on-sky separation to search within.
- Returns:
idxsearcharound (int array) – Indices into
searcharoundcoords
that match the corresponding elements ofidxself
. Shape matchesidxself
.idxself (int array) – Indices into
self
that match the corresponding elements ofidxsearcharound
. Shape matchesidxsearcharound
.sep2d (
Angle
) – The on-sky separation between the coordinates. Shape matchesidxsearcharound
andidxself
.dist3d (
Quantity
[‘length’]) – The 3D distance between the coordinates. Shape matchesidxsearcharound
andidxself
.
Notes
This method requires SciPy to be installed or it will fail.
In the current implementation, the return values are always sorted in the same order as the
searcharoundcoords
(soidxsearcharound
is in ascending order). This is considered an implementation detail, though, so it could change in a future release.See also
astropy.coordinates.search_around_sky
,SkyCoord.search_around_3d
- property shape¶
The shape of the underlying data.
- skyoffset_frame(rotation=None)[source]¶
Returns the sky offset frame with this SkyCoord at the origin.
- Parameters:
rotation (angle-like) – The final rotation of the frame about the
origin
. The sign of the rotation is the left-hand rule. That is, an object at a particular position angle in the un-rotated system will be sent to the positive latitude (z) direction in the final frame.- Returns:
astrframe – A sky offset frame of the same type as this |SkyCoord| (e.g., if this object has an ICRS coordinate, the resulting frame is SkyOffsetICRS, with the origin set to this object)
- Return type:
SkyOffsetFrame
- spherical_offsets_by(d_lon, d_lat)[source]¶
Computes the coordinate that is a specified pair of angular offsets away from this coordinate.
- Parameters:
d_lon (angle-like) – The angular offset in the longitude direction. The definition of “longitude” depends on this coordinate’s frame (e.g., RA for equatorial coordinates).
d_lat (angle-like) – The angular offset in the latitude direction. The definition of “latitude” depends on this coordinate’s frame (e.g., Dec for equatorial coordinates).
- Returns:
newcoord – The coordinates for the location that corresponds to offsetting by
d_lat
in the latitude direction andd_lon
in the longitude direction.- Return type:
SkyCoord
Notes
This internally uses
SkyOffsetFrame
to do the transformation. For a more complete set of transform offsets, useSkyOffsetFrame
orWCS
manually. This specific method can be reproduced by doingSkyCoord(SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))
.See also
spherical_offsets_to
compute the angular offsets to another coordinate
directional_offset_by
offset a coordinate by an angle in a direction
- spherical_offsets_to(tocoord)[source]¶
Computes angular offsets to go from this coordinate to another.
- Parameters:
tocoord (
BaseCoordinateFrame
) – The coordinate to find the offset to.- Returns:
lon_offset (
Angle
) – The angular offset in the longitude direction. The definition of “longitude” depends on this coordinate’s frame (e.g., RA for equatorial coordinates).lat_offset (
Angle
) – The angular offset in the latitude direction. The definition of “latitude” depends on this coordinate’s frame (e.g., Dec for equatorial coordinates).
- Raises:
ValueError – If the
tocoord
is not in the same frame as this one. This is different from the behavior of theseparation()
/separation_3d()
methods because the offset components depend critically on the specific choice of frame.
Notes
This uses the sky offset frame machinery, and hence will produce a new sky offset frame if one does not already exist for this object’s frame class.
See also
separation()
for the total angular offset (not broken out into components).
position_angle()
for the direction of the offset.
- to_pixel(wcs, origin=0, mode='all')[source]¶
Convert this coordinate to pixel coordinates using a
WCS
object.- Parameters:
wcs (
WCS
) – The WCS to use for convertorigin (int) – Whether to return 0 or 1-based pixel coordinates.
mode ('all' or 'wcs') – Whether to do the transformation including distortions (
'all'
) or only including only the core WCS transformation ('wcs'
).
- Returns:
xp, yp – The pixel coordinates
- Return type:
numpy.ndarray
See also
astropy.wcs.utils.skycoord_to_pixel
the implementation of this method
- to_string(style='decimal', **kwargs)[source]¶
A string representation of the coordinates.
The default styles definitions are:
'decimal': 'lat': {'decimal': True, 'unit': "deg"} 'lon': {'decimal': True, 'unit': "deg"} 'dms': 'lat': {'unit': "deg"} 'lon': {'unit': "deg"} 'hmsdms': 'lat': {'alwayssign': True, 'pad': True, 'unit': "deg"} 'lon': {'pad': True, 'unit': "hour"}
See
to_string()
for details and keyword arguments (the two angles forming the coordinates are are bothAngle
instances). Keyword arguments have precedence over the style defaults and are passed toto_string()
.- Parameters:
style ({'hmsdms', 'dms', 'decimal'}) – The formatting specification to use. These encode the three most common ways to represent coordinates. The default is
decimal
.**kwargs – Keyword args passed to
to_string()
.
- to_table()[source]¶
Convert this |SkyCoord| to a |QTable|.
Any attributes that have the same length as the |SkyCoord| will be converted to columns of the |QTable|. All other attributes will be recorded as metadata.
- Returns:
A |QTable| containing the data of this |SkyCoord|.
- Return type:
QTable
Examples
>>> sc = SkyCoord(ra=[40, 70]*u.deg, dec=[0, -20]*u.deg, ... obstime=Time([2000, 2010], format='jyear')) >>> t = sc.to_table() >>> t <QTable length=2> ra dec obstime deg deg float64 float64 Time ------- ------- ------- 40.0 0.0 2000.0 70.0 -20.0 2010.0 >>> t.meta {'representation_type': 'spherical', 'frame': 'icrs'}
- transform_to(frame, merge_attributes=True)[source]¶
Transform this coordinate to a new frame.
The precise frame transformed to depends on
merge_attributes
. IfFalse
, the destination frame is used exactly as passed in. But this is often not quite what one wants. E.g., suppose one wants to transform an ICRS coordinate that has an obstime attribute to FK4; in this case, one likely would want to use this information. Thus, the default formerge_attributes
isTrue
, in which the precedence is as follows: (1) explicitly set (i.e., non-default) values in the destination frame; (2) explicitly set values in the source; (3) default value in the destination frame.Note that in either case, any explicitly set attributes on the source |SkyCoord| that are not part of the destination frame’s definition are kept (stored on the resulting |SkyCoord|), and thus one can round-trip (e.g., from FK4 to ICRS to FK4 without losing obstime).
- Parameters:
frame (str,
BaseCoordinateFrame
class or instance, or |SkyCoord| instance) – The frame to transform this coordinate into. If a |SkyCoord|, the underlying frame is extracted, and all other information ignored.merge_attributes (bool, optional) – Whether the default attributes in the destination frame are allowed to be overridden by explicitly set attributes in the source (see note above; default:
True
).
- Returns:
coord – A new object with this coordinate represented in the
frame
frame.- Return type:
- Raises:
ValueError – If there is no possible transformation route.
- class rubin_sim.maf.plots.SkyprojPlotter[source]¶
Bases:
BasePlotter
,ABC
Base class for all plotters that use the skyproj module.
- __call__(metric_values, slicer, user_plot_dict, fig=None)[source]¶
Make a plot.
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure. The default isNone
, which starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- decorate()[source]¶
Add decorations/annotations to the sky plot.
Notes
For decorations that depend on the time or location of the observer (e.g., the horizon and sun and moon positions) this method relies on the site location and time (as an mjd) set in the
model_observatory
element of theplot_dict
, which should be of the classrubin_scheduler.scheduler.model_observatory.ModelObservatory
. Other decorations (e.g., the ecliptic and galactic plane) can be shown even whenmodel_observatory
is not set.
- draw_body(body='sun', **kwargs)[source]¶
Mark the sun or moon.
- Parameters:
body (
str
) – The name of the body to draw, eithersun
ormoon
. Defaults tosun
**kwargs – Keyword arguments passed to
skyproj._Skyproj.scatter
Notes
This method relies on the site location and time (as an mjd) set in the
model_observatory
element of theplot_dict
, which should be of the classrubin_scheduler.scheduler.model_observatory.ModelObservatory
.
- draw_circle(center_ra, center_decl, radius=90, **kwargs)[source]¶
Draw a circle on the sphere.
- Parameters:
center_ra (
float
) – R.A. of the center of the circle (deg.).center_decl (
float
) – Decl. of the center of the circle (deg.).radius (float, optional) – Radius of the circle (deg.), by default 90.0
**kwargs – Additional keyword arguments passed to
skyproj._Skyproj.draw_polygon
.
- draw_ecliptic()[source]¶
Draw the ecliptic the sphere.
- Parameters:
**kwargs – Keyword arguments passed to
skyproj._Skyproj.draw_polygon
.
- draw_galactic_plane()[source]¶
Draw the galactic plane the sphere.
- Parameters:
**kwargs – Keyword arguments passed to
skyproj._Skyproj.draw_polygon
.
- draw_zd(zd=90, **kwargs)[source]¶
Draw a circle at a given zenith distance.
- Parameters:
zd (
float
) – The zenith distance to draw, in degrees. Defaults to 90.**kwargs – Keyword arguments passed to
skyproj._Skyproj.draw_polygon
.
Notes
This method relies on the site location and time (as an mjd) set in the
model_observatory
element of theplot_dict
, which should be of the classrubin_scheduler.scheduler.model_observatory.ModelObservatory
.
- class rubin_sim.maf.plots.SummaryHistogram[source]¶
Bases:
BasePlotter
Special plotter to summarize metrics which return a set of values at each slice_point, e.g. a histogram the metric result per slicepoint. (example: the results of with the rubin_sim.maf.metrics.TgapsMetric). Essentially, this collapses the metric value over the sky and plots a summarized version (reduced to a single value per point according to the plot_dict[‘metricReduce’] metric).
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – Handles ‘object’ datatypes for the masked array.slicer (
rubin_sim.maf.slicer
) – Any MAF slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user to override defaults. ‘metricReduce’ (arubin_sim.maf.metric
) indicates how to marginalize the metric values calculated at each point to a single series of values over the sky. ‘histStyle’ (True/False) indicates whether to plot the results as a step histogram (True) or as a series of values (False) ‘bins’ (np.ndarray) sets the x values for the resulting plot and should generally match the bins used with the metric.fig (
matplotlib.figure.Figure
) – Matplotlib figure to use. Default starts a new figure.
- Returns:
fig – Matplotlib figure used to create the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.TimeUseHourglassPlotMixin(*args, **kwargs)[source]¶
Bases:
CategoricalHourglassPlotMixin
A mix-in to allow the HourglassPlot to accept categorical ‘use’ data rather than float/int.
- class rubin_sim.maf.plots.TwoDMap[source]¶
Bases:
BasePlotter
- __call__(metric_value, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.TwoDSubsetData[source]¶
Bases:
BasePlotter
Plot 2 axes from the slicer.sliceColList, identified by plot_dict[‘xaxis’]/[‘yaxis’], given the metric_values at all slicepoints [sums over non-visible axes].
- __call__(metric_values, slicer, user_plot_dict, fig=None)[source]¶
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.VisitPairsHist[source]¶
Bases:
BasePlotter
Given an TwoDSlicer, figure out what fraction of observations are in singles, pairs, triples, etc.
- Parameters:
metric_value (
numpy.ma.MaskedArray
) – The metric values from the bundle.slicer (
rubin_sim.maf.slicers.TwoDSlicer
) – The slicer.user_plot_dict (
dict
) – Dictionary of plot parameters set by user (overrides default values).fig (
matplotlib.figure.Figure
) – Matplotlib figure number to use. Default = None, starts new figure.
- Returns:
fig – Figure with the plot.
- Return type:
matplotlib.figure.Figure
- class rubin_sim.maf.plots.VisitPerimeterPlotter[source]¶
Bases:
SkyprojPlotter
- class rubin_sim.maf.plots.WeakKeyDictionary(dict=None)[source]¶
Bases:
MutableMapping
Mapping class that references keys weakly.
Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses.
- keyrefs()[source]¶
Return a list of weak references to the keys.
The references are not guaranteed to be ‘live’ at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed.
- pop(k[, d]) v, remove specified key and return the corresponding value. [source]¶
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair [source]¶
as a 2-tuple; but raise KeyError if D is empty.
- class rubin_sim.maf.plots.XyPlotter[source]¶
Bases:
BasePlotter
Bare-bones plotter for making scatter plots. Expects single metric value (e.g, from UniSlicer or UserPointSlicer with one point)
- class rubin_sim.maf.plots.YearHourglassCategoricalPlot(*args, **kwargs)[source]¶
Bases:
CategoricalHourglassPlotMixin
,YearHourglassPlot
Plot categorical data for a year.
- class rubin_sim.maf.plots.YearHourglassPlot(year, **kwargs)[source]¶
Bases:
GeneralHourglassPlot
Make an array of monthly hourglass plots for a year.
- Parameters:
year (
int
) – The year.GeneralHourglassPlot (Keyward arguments are passed to)
metric (Note that this plot pulls the chosen year's data out of the)
the (its subclass that includes)
class (MonthHourglassPlot)
float/int (this class expects to obtain)
data (data. To use it with other)
the
or (appropriate mixin (YearHourglassCategoricalPlot)
subclass. (YearHourglassUsePlot) or a custom)
- class rubin_sim.maf.plots.YearHourglassUsePlot(*args, **kwargs)[source]¶
Bases:
TimeUseHourglassPlotMixin
,YearHourglassPlot
Plot categorical ‘use’ data for one year.
- rubin_sim.maf.plots.compute_circle_points(center_ra, center_decl, radius=90.0, start_bear=0, end_bear=360, step=1)[source]¶
Create points along a circle or arc on a sphere
- Parameters:
center_ra (
float
) – R.A. of the center of the circle (deg.).center_decl (
float
) – Decl. of the center of the circle (deg.).radius (float, optional) – Radius of the circle (deg.), by default 90.0
start_bear (int, optional) – Bearing (E. of N.) of the start of the circle (deg.), by default 0
end_bear (int, optional) – Bearing (E. of N.) of the end of the circle (deg.), by default 360
step (int, optional) – Spacing of the points along the circle (deg.), by default 1
- Returns:
circle – DataFrame with points in the circle.
- Return type:
pandas.DataFrame
- class rubin_sim.maf.plots.defaultdict¶
Bases:
dict
defaultdict(default_factory=None, /, […]) –> dict with default factory
The default factory is called without arguments to produce a new value when a key is not present, in __getitem__ only. A defaultdict compares equal to a dict with the same items. All remaining arguments are treated the same as if they were passed to the dict constructor, including keyword arguments.
- copy() a shallow copy of D. ¶
- default_factory¶
Factory for default value called by __missing__().