Reference/API

Capabilities

astropy.modeling Package

This subpackage provides a framework for representing models and performing model evaluation and fitting. It supports 1D and 2D models and fitting with parameter constraints. It has some predefined models and fitting routines.

Functions

custom_model(*args[, fit_deriv]) Create a model from a user defined function.
is_separable(transform) A separability test for the outputs of a transform.
separability_matrix(transform) Compute the correlation between outputs and inputs.

Classes

CompoundModel(op, left, right[, name, inverse]) Base class for compound models.
Fittable1DModel(*args[, meta, name]) Base class for one-dimensional fittable models.
Fittable2DModel(*args[, meta, name]) Base class for two-dimensional fittable models.
FittableModel(*args[, meta, name]) Base class for models that can be fitted using the built-in fitting algorithms.
InputParameterError Used for incorrect input parameter values and definitions.
Model(*args[, meta, name]) Base class for all models.
ModelDefinitionError Used for incorrect models definitions.
Parameter([name, description, default, …]) Wraps individual parameters.
ParameterError Generic exception class for all exceptions pertaining to Parameters.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.core.CompoundModel, astropy.modeling.core.Fittable1DModel, astropy.modeling.core.Fittable2DModel, astropy.modeling.core.FittableModel, astropy.modeling.parameters.InputParameterError, astropy.modeling.core.Model, astropy.modeling.core.ModelDefinitionError, astropy.modeling.parameters.Parameter, astropy.modeling.parameters.ParameterError

astropy.modeling.mappings Module

Special models useful for complex compound models where control is needed over which outputs from a source model are mapped to which inputs of a target model.

Classes

Mapping(mapping[, n_inputs, name, meta]) Allows inputs to be reordered, duplicated or dropped.
Identity(n_inputs[, name, meta]) Returns inputs unchanged.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.mappings.Mapping, astropy.modeling.mappings.Identity

astropy.modeling.fitting Module

This module implements classes (called Fitters) which combine optimization algorithms (typically from scipy.optimize) with statistic functions to perform fitting. Fitters are implemented as callable classes. In addition to the data to fit, the __call__ method takes an instance of FittableModel as input, and returns a copy of the model with its parameters determined by the optimizer.

Optimization algorithms, called “optimizers” are implemented in optimizers and statistic functions are in statistic. The goal is to provide an easy to extend framework and allow users to easily create new fitters by combining statistics with optimizers.

There are two exceptions to the above scheme. LinearLSQFitter uses Numpy’s lstsq function. LevMarLSQFitter uses leastsq which combines optimization and statistic in one implementation.

Classes

LinearLSQFitter() A class performing a linear least square fitting.
LevMarLSQFitter() Levenberg-Marquardt algorithm and least squares statistic.
FittingWithOutlierRemoval(fitter, outlier_func) This class combines an outlier removal technique with a fitting procedure.
SLSQPLSQFitter() SLSQP optimization algorithm and least squares statistic.
SimplexLSQFitter() Simplex algorithm and least squares statistic.
JointFitter(models, jointparameters, initvals) Fit models which share a parameter.
Fitter(optimizer, statistic) Base class for all fitters.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.fitting.LinearLSQFitter, astropy.modeling.fitting.LevMarLSQFitter, astropy.modeling.fitting.FittingWithOutlierRemoval, astropy.modeling.fitting.SLSQPLSQFitter, astropy.modeling.fitting.SimplexLSQFitter, astropy.modeling.fitting.JointFitter, astropy.modeling.fitting.Fitter

astropy.modeling.optimizers Module

Optimization algorithms used in fitting.

Classes

Optimization(opt_method) Base class for optimizers.
SLSQP() Sequential Least Squares Programming optimization algorithm.
Simplex() Neald-Mead (downhill simplex) algorithm.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.optimizers.Optimization, astropy.modeling.optimizers.SLSQP, astropy.modeling.optimizers.Simplex

astropy.modeling.statistic Module

Statistic functions used in fitting.

Functions

leastsquare(measured_vals, updated_model, …) Least square statistic with optional weights.

astropy.modeling.tabular Module

Tabular models.

Tabular models of any dimension can be created using tabular_model. For convenience Tabular1D and Tabular2D are provided.

Examples

>>> table = np.array([[ 3.,  0.,  0.],
...                  [ 0.,  2.,  0.],
...                  [ 0.,  0.,  0.]])
>>> points = ([1, 2, 3], [1, 2, 3])
>>> t2 = Tabular2D(points, lookup_table=table, bounds_error=False,
...                fill_value=None, method='nearest')

Functions

tabular_model(dim[, name]) Make a Tabular model where n_inputs is based on the dimension of the lookup_table.

astropy.modeling.separable Module

Functions to determine if a model is separable, i.e. if the model outputs are independent.

It analyzes n_inputs, n_outputs and the operators in a compound model by stepping through the transforms and creating a coord_matrix of shape (n_outputs, n_inputs).

Each modeling operator is represented by a function which takes two simple models (or two coord_matrix arrays) and returns an array of shape (n_outputs, n_inputs).

Functions

is_separable(transform) A separability test for the outputs of a transform.
separability_matrix(transform) Compute the correlation between outputs and inputs.

Pre-Defined Models

astropy.modeling.functional_models Module

Mathematical models.

Classes

AiryDisk2D([amplitude, x_0, y_0, radius]) Two dimensional Airy disk model.
Moffat1D([amplitude, x_0, gamma, alpha]) One dimensional Moffat model.
Moffat2D([amplitude, x_0, y_0, gamma, alpha]) Two dimensional Moffat model.
Box1D([amplitude, x_0, width]) One dimensional Box model.
Box2D([amplitude, x_0, y_0, x_width, y_width]) Two dimensional Box model.
Const1D([amplitude]) One dimensional Constant model.
Const2D([amplitude]) Two dimensional Constant model.
Ellipse2D([amplitude, x_0, y_0, a, b, theta]) A 2D Ellipse model.
Disk2D([amplitude, x_0, y_0, R_0]) Two dimensional radial symmetric Disk model.
Gaussian1D([amplitude, mean, stddev]) One dimensional Gaussian model.
Gaussian2D([amplitude, x_mean, y_mean, …]) Two dimensional Gaussian model.
Linear1D([slope, intercept]) One dimensional Line model.
Lorentz1D([amplitude, x_0, fwhm]) One dimensional Lorentzian model.
MexicanHat1D([amplitude, x_0, sigma]) One dimensional Mexican Hat model.
MexicanHat2D([amplitude, x_0, y_0, sigma]) Two dimensional symmetric Mexican Hat model.
RedshiftScaleFactor([z]) One dimensional redshift scale factor model.
Multiply([factor]) Multiply a model by a quantity or number.
Planar2D([slope_x, slope_y, intercept]) Two dimensional Plane model.
Scale([factor]) Multiply a model by a dimensionless factor.
Sersic1D([amplitude, r_eff, n]) One dimensional Sersic surface brightness profile.
Sersic2D([amplitude, r_eff, n, x_0, y_0, …]) Two dimensional Sersic surface brightness profile.
Shift([offset]) Shift a coordinate.
Sine1D([amplitude, frequency, phase]) One dimensional Sine model.
Trapezoid1D([amplitude, x_0, width, slope]) One dimensional Trapezoid model.
TrapezoidDisk2D([amplitude, x_0, y_0, R_0, …]) Two dimensional circular Trapezoid model.
Ring2D([amplitude, x_0, y_0, r_in, width, r_out]) Two dimensional radial symmetric Ring model.
Voigt1D([x_0, amplitude_L, fwhm_L, fwhm_G]) One dimensional model for the Voigt profile.
KingProjectedAnalytic1D([amplitude, r_core, …]) Projected (surface density) analytic King Model.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.functional_models.AiryDisk2D, astropy.modeling.functional_models.Moffat1D, astropy.modeling.functional_models.Moffat2D, astropy.modeling.functional_models.Box1D, astropy.modeling.functional_models.Box2D, astropy.modeling.functional_models.Const1D, astropy.modeling.functional_models.Const2D, astropy.modeling.functional_models.Ellipse2D, astropy.modeling.functional_models.Disk2D, astropy.modeling.functional_models.Gaussian1D, astropy.modeling.functional_models.Gaussian2D, astropy.modeling.functional_models.Linear1D, astropy.modeling.functional_models.Lorentz1D, astropy.modeling.functional_models.MexicanHat1D, astropy.modeling.functional_models.MexicanHat2D, astropy.modeling.functional_models.RedshiftScaleFactor, astropy.modeling.functional_models.Multiply, astropy.modeling.functional_models.Planar2D, astropy.modeling.functional_models.Scale, astropy.modeling.functional_models.Sersic1D, astropy.modeling.functional_models.Sersic2D, astropy.modeling.functional_models.Shift, astropy.modeling.functional_models.Sine1D, astropy.modeling.functional_models.Trapezoid1D, astropy.modeling.functional_models.TrapezoidDisk2D, astropy.modeling.functional_models.Ring2D, astropy.modeling.functional_models.Voigt1D, astropy.modeling.functional_models.KingProjectedAnalytic1D

astropy.modeling.powerlaws Module

Power law model variants

Classes

PowerLaw1D([amplitude, x_0, alpha]) One dimensional power law model.
BrokenPowerLaw1D([amplitude, x_break, …]) One dimensional power law model with a break.
SmoothlyBrokenPowerLaw1D([amplitude, …]) One dimensional smoothly broken power law model.
ExponentialCutoffPowerLaw1D([amplitude, …]) One dimensional power law model with an exponential cutoff.
LogParabola1D([amplitude, x_0, alpha, beta]) One dimensional log parabola model (sometimes called curved power law).

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.powerlaws.PowerLaw1D, astropy.modeling.powerlaws.BrokenPowerLaw1D, astropy.modeling.powerlaws.SmoothlyBrokenPowerLaw1D, astropy.modeling.powerlaws.ExponentialCutoffPowerLaw1D, astropy.modeling.powerlaws.LogParabola1D

astropy.modeling.blackbody Module

Model and functions related to blackbody radiation.

Blackbody Radiation

Blackbody flux is calculated with Planck law (Rybicki & Lightman 1979):

\[ \begin{align}\begin{aligned}B_{\lambda}(T) = \frac{2 h c^{2} / \lambda^{5}}{exp(h c / \lambda k T) - 1}\\B_{\nu}(T) = \frac{2 h \nu^{3} / c^{2}}{exp(h \nu / k T) - 1}\end{aligned}\end{align} \]

where the unit of \(B_{\lambda}(T)\) is \(erg \; s^{-1} cm^{-2} \mathring{A}^{-1} sr^{-1}\), and \(B_{\nu}(T)\) is \(erg \; s^{-1} cm^{-2} Hz^{-1} sr^{-1}\). blackbody_lambda() and blackbody_nu() calculate the blackbody flux for \(B_{\lambda}(T)\) and \(B_{\nu}(T)\), respectively.

For blackbody representation as a model, see BlackBody1D.

Examples
>>> import numpy as np
>>> from astropy import units as u
>>> from astropy.modeling.blackbody import blackbody_lambda, blackbody_nu

Calculate blackbody flux for 5000 K at 100 and 10000 Angstrom while suppressing any Numpy warnings:

>>> wavelengths = [100, 10000] * u.AA
>>> temperature = 5000 * u.K
>>> with np.errstate(all='ignore'):
...     flux_lam = blackbody_lambda(wavelengths, temperature)
...     flux_nu = blackbody_nu(wavelengths, temperature)
>>> flux_lam  
<Quantity [  1.27452545e-108,  7.10190526e+005] erg / (Angstrom cm2 s sr)>
>>> flux_nu  
<Quantity [  4.25135927e-123,  2.36894060e-005] erg / (cm2 Hz s sr)>

Alternatively, the same results for flux_nu can be computed using BlackBody1D with blackbody representation as a model. The difference between this and the former approach is in one additional step outlined as follows:

>>> from astropy import constants as const
>>> from astropy.modeling import models
>>> temperature = 5000 * u.K
>>> bolometric_flux = const.sigma_sb * temperature ** 4 / np.pi
>>> bolometric_flux.to(u.erg / (u.cm * u.cm * u.s))  
<Quantity 1.12808367e+10 erg / (cm2 s)>
>>> wavelengths = [100, 10000] * u.AA
>>> bb_astro = models.BlackBody1D(temperature, bolometric_flux=bolometric_flux)
>>> bb_astro(wavelengths).to(u.erg / (u.cm * u.cm * u.Hz * u.s)) / u.sr  
<Quantity [4.25102471e-123, 2.36893879e-005] erg / (cm2 Hz s sr)>

where bb_astro(wavelengths) computes the equivalent result as flux_nu above.

Plot a blackbody spectrum for 5000 K:

(png, svg, pdf)

../_images/reference_api-1.png

Note that an array of temperatures can also be given instead of a single temperature. In this case, the Numpy broadcasting rules apply: for instance, if the frequency and temperature have the same shape, the output will have this shape too, while if the frequency is a 2-d array with shape (n, m) and the temperature is an array with shape (m,), the output will have a shape (n, m).

See Also

Rybicki, G. B., & Lightman, A. P. 1979, Radiative Processes in Astrophysics (New York, NY: Wiley)

Functions

blackbody_nu(in_x, temperature) Calculate blackbody flux per steradian, \(B_{\nu}(T)\).
blackbody_lambda(in_x, temperature) Like blackbody_nu() but for \(B_{\lambda}(T)\).

Classes

BlackBody1D([temperature, bolometric_flux]) One dimensional blackbody model.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.blackbody.BlackBody1D

astropy.modeling.polynomial Module

This module contains models representing polynomials and polynomial series.

Classes

Chebyshev1D(degree[, domain, window, …]) Univariate Chebyshev series.
Chebyshev2D(x_degree, y_degree[, x_domain, …]) Bivariate Chebyshev series..
Hermite1D(degree[, domain, window, …]) Univariate Hermite series.
Hermite2D(x_degree, y_degree[, x_domain, …]) Bivariate Hermite series.
InverseSIP(ap_order, bp_order[, ap_coeff, …]) Inverse Simple Imaging Polynomial
Legendre1D(degree[, domain, window, …]) Univariate Legendre series.
Legendre2D(x_degree, y_degree[, x_domain, …]) Bivariate Legendre series.
Polynomial1D(degree[, domain, window, …]) 1D Polynomial model.
Polynomial2D(degree[, x_domain, y_domain, …]) 2D Polynomial model.
SIP(crpix, a_order, b_order[, a_coeff, …]) Simple Imaging Polynomial (SIP) model.
OrthoPolynomialBase(x_degree, y_degree[, …]) This is a base class for the 2D Chebyshev and Legendre models.
PolynomialModel(degree[, n_models, …]) Base class for polynomial models.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.polynomial.Chebyshev1D, astropy.modeling.polynomial.Chebyshev2D, astropy.modeling.polynomial.Hermite1D, astropy.modeling.polynomial.Hermite2D, astropy.modeling.polynomial.InverseSIP, astropy.modeling.polynomial.Legendre1D, astropy.modeling.polynomial.Legendre2D, astropy.modeling.polynomial.Polynomial1D, astropy.modeling.polynomial.Polynomial2D, astropy.modeling.polynomial.SIP, astropy.modeling.polynomial.OrthoPolynomialBase, astropy.modeling.polynomial.PolynomialModel

astropy.modeling.projections Module

Implements projections–particularly sky projections defined in WCS Paper II [R4aef2d5abf34-1].

All angles are set and and displayed in degrees but internally computations are performed in radians. All functions expect inputs and outputs degrees.

References

[R4aef2d5abf34-1]Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)

Classes

Projection(*args[, meta, name]) Base class for all sky projections.
Pix2SkyProjection(*args[, meta, name]) Base class for all Pix2Sky projections.
Sky2PixProjection(*args[, meta, name]) Base class for all Sky2Pix projections.
Zenithal(*args[, meta, name]) Base class for all Zenithal projections.
Cylindrical(*args[, meta, name]) Base class for Cylindrical projections.
PseudoCylindrical(*args[, meta, name]) Base class for pseudocylindrical projections.
Conic(*args[, meta, name]) Base class for conic projections.
PseudoConic(*args[, meta, name]) Base class for pseudoconic projections.
QuadCube(*args[, meta, name]) Base class for quad cube projections.
HEALPix(*args[, meta, name]) Base class for HEALPix projections.
AffineTransformation2D([matrix, translation]) Perform an affine transformation in 2 dimensions.
Pix2Sky_ZenithalPerspective([mu, gamma]) Zenithal perspective projection - pixel to sky.
Sky2Pix_ZenithalPerspective([mu, gamma]) Zenithal perspective projection - sky to pixel.
Pix2Sky_SlantZenithalPerspective([mu, phi0, …]) Slant zenithal perspective projection - pixel to sky.
Sky2Pix_SlantZenithalPerspective([mu, phi0, …]) Zenithal perspective projection - sky to pixel.
Pix2Sky_Gnomonic(*args[, meta, name]) Gnomonic projection - pixel to sky.
Sky2Pix_Gnomonic(*args[, meta, name]) Gnomonic Projection - sky to pixel.
Pix2Sky_Stereographic(*args[, meta, name]) Stereographic Projection - pixel to sky.
Sky2Pix_Stereographic(*args[, meta, name]) Stereographic Projection - sky to pixel.
Pix2Sky_SlantOrthographic([xi, eta]) Slant orthographic projection - pixel to sky.
Sky2Pix_SlantOrthographic([xi, eta]) Slant orthographic projection - sky to pixel.
Pix2Sky_ZenithalEquidistant(*args[, meta, name]) Zenithal equidistant projection - pixel to sky.
Sky2Pix_ZenithalEquidistant(*args[, meta, name]) Zenithal equidistant projection - sky to pixel.
Pix2Sky_ZenithalEqualArea(*args[, meta, name]) Zenithal equidistant projection - pixel to sky.
Sky2Pix_ZenithalEqualArea(*args[, meta, name]) Zenithal equidistant projection - sky to pixel.
Pix2Sky_Airy([theta_b]) Airy projection - pixel to sky.
Sky2Pix_Airy([theta_b]) Airy - sky to pixel.
Pix2Sky_CylindricalPerspective([mu, lam]) Cylindrical perspective - pixel to sky.
Sky2Pix_CylindricalPerspective([mu, lam]) Cylindrical Perspective - sky to pixel.
Pix2Sky_CylindricalEqualArea([lam]) Cylindrical equal area projection - pixel to sky.
Sky2Pix_CylindricalEqualArea([lam]) Cylindrical equal area projection - sky to pixel.
Pix2Sky_PlateCarree(*args[, meta, name]) Plate carrée projection - pixel to sky.
Sky2Pix_PlateCarree(*args[, meta, name]) Plate carrée projection - sky to pixel.
Pix2Sky_Mercator(*args[, meta, name]) Mercator - pixel to sky.
Sky2Pix_Mercator(*args[, meta, name]) Mercator - sky to pixel.
Pix2Sky_SansonFlamsteed(*args[, meta, name]) Sanson-Flamsteed projection - pixel to sky.
Sky2Pix_SansonFlamsteed(*args[, meta, name]) Sanson-Flamsteed projection - sky to pixel.
Pix2Sky_Parabolic(*args[, meta, name]) Parabolic projection - pixel to sky.
Sky2Pix_Parabolic(*args[, meta, name]) Parabolic projection - sky to pixel.
Pix2Sky_Molleweide(*args[, meta, name]) Molleweide’s projection - pixel to sky.
Sky2Pix_Molleweide(*args[, meta, name]) Molleweide’s projection - sky to pixel.
Pix2Sky_HammerAitoff(*args[, meta, name]) Hammer-Aitoff projection - pixel to sky.
Sky2Pix_HammerAitoff(*args[, meta, name]) Hammer-Aitoff projection - sky to pixel.
Pix2Sky_ConicPerspective(*args[, meta, name]) Colles’ conic perspective projection - pixel to sky.
Sky2Pix_ConicPerspective(*args[, meta, name]) Colles’ conic perspective projection - sky to pixel.
Pix2Sky_ConicEqualArea(*args[, meta, name]) Alber’s conic equal area projection - pixel to sky.
Sky2Pix_ConicEqualArea(*args[, meta, name]) Alber’s conic equal area projection - sky to pixel.
Pix2Sky_ConicEquidistant(*args[, meta, name]) Conic equidistant projection - pixel to sky.
Sky2Pix_ConicEquidistant(*args[, meta, name]) Conic equidistant projection - sky to pixel.
Pix2Sky_ConicOrthomorphic(*args[, meta, name]) Conic orthomorphic projection - pixel to sky.
Sky2Pix_ConicOrthomorphic(*args[, meta, name]) Conic orthomorphic projection - sky to pixel.
Pix2Sky_BonneEqualArea([theta1]) Bonne’s equal area pseudoconic projection - pixel to sky.
Sky2Pix_BonneEqualArea([theta1]) Bonne’s equal area pseudoconic projection - sky to pixel.
Pix2Sky_Polyconic(*args[, meta, name]) Polyconic projection - pixel to sky.
Sky2Pix_Polyconic(*args[, meta, name]) Polyconic projection - sky to pixel.
Pix2Sky_TangentialSphericalCube(*args[, …]) Tangential spherical cube projection - pixel to sky.
Sky2Pix_TangentialSphericalCube(*args[, …]) Tangential spherical cube projection - sky to pixel.
Pix2Sky_COBEQuadSphericalCube(*args[, meta, …]) COBE quadrilateralized spherical cube projection - pixel to sky.
Sky2Pix_COBEQuadSphericalCube(*args[, meta, …]) COBE quadrilateralized spherical cube projection - sky to pixel.
Pix2Sky_QuadSphericalCube(*args[, meta, name]) Quadrilateralized spherical cube projection - pixel to sky.
Sky2Pix_QuadSphericalCube(*args[, meta, name]) Quadrilateralized spherical cube projection - sky to pixel.
Pix2Sky_HEALPix([H, X]) HEALPix - pixel to sky.
Sky2Pix_HEALPix([H, X]) HEALPix projection - sky to pixel.
Pix2Sky_HEALPixPolar(*args[, meta, name]) HEALPix polar, aka “butterfly” projection - pixel to sky.
Sky2Pix_HEALPixPolar(*args[, meta, name]) HEALPix polar, aka “butterfly” projection - pixel to sky.
Pix2Sky_AZP alias of astropy.modeling.projections.Pix2Sky_ZenithalPerspective
Sky2Pix_AZP alias of astropy.modeling.projections.Sky2Pix_ZenithalPerspective
Pix2Sky_SZP alias of astropy.modeling.projections.Pix2Sky_SlantZenithalPerspective
Sky2Pix_SZP alias of astropy.modeling.projections.Sky2Pix_SlantZenithalPerspective
Pix2Sky_TAN alias of astropy.modeling.projections.Pix2Sky_Gnomonic
Sky2Pix_TAN alias of astropy.modeling.projections.Sky2Pix_Gnomonic
Pix2Sky_STG alias of astropy.modeling.projections.Pix2Sky_Stereographic
Sky2Pix_STG alias of astropy.modeling.projections.Sky2Pix_Stereographic
Pix2Sky_SIN alias of astropy.modeling.projections.Pix2Sky_SlantOrthographic
Sky2Pix_SIN alias of astropy.modeling.projections.Sky2Pix_SlantOrthographic
Pix2Sky_ARC alias of astropy.modeling.projections.Pix2Sky_ZenithalEquidistant
Sky2Pix_ARC alias of astropy.modeling.projections.Sky2Pix_ZenithalEquidistant
Pix2Sky_ZEA alias of astropy.modeling.projections.Pix2Sky_ZenithalEqualArea
Sky2Pix_ZEA alias of astropy.modeling.projections.Sky2Pix_ZenithalEqualArea
Pix2Sky_AIR alias of astropy.modeling.projections.Pix2Sky_Airy
Sky2Pix_AIR alias of astropy.modeling.projections.Sky2Pix_Airy
Pix2Sky_CYP alias of astropy.modeling.projections.Pix2Sky_CylindricalPerspective
Sky2Pix_CYP alias of astropy.modeling.projections.Sky2Pix_CylindricalPerspective
Pix2Sky_CEA alias of astropy.modeling.projections.Pix2Sky_CylindricalEqualArea
Sky2Pix_CEA alias of astropy.modeling.projections.Sky2Pix_CylindricalEqualArea
Pix2Sky_CAR alias of astropy.modeling.projections.Pix2Sky_PlateCarree
Sky2Pix_CAR alias of astropy.modeling.projections.Sky2Pix_PlateCarree
Pix2Sky_MER alias of astropy.modeling.projections.Pix2Sky_Mercator
Sky2Pix_MER alias of astropy.modeling.projections.Sky2Pix_Mercator
Pix2Sky_SFL alias of astropy.modeling.projections.Pix2Sky_SansonFlamsteed
Sky2Pix_SFL alias of astropy.modeling.projections.Sky2Pix_SansonFlamsteed
Pix2Sky_PAR alias of astropy.modeling.projections.Pix2Sky_Parabolic
Sky2Pix_PAR alias of astropy.modeling.projections.Sky2Pix_Parabolic
Pix2Sky_MOL alias of astropy.modeling.projections.Pix2Sky_Molleweide
Sky2Pix_MOL alias of astropy.modeling.projections.Sky2Pix_Molleweide
Pix2Sky_AIT alias of astropy.modeling.projections.Pix2Sky_HammerAitoff
Sky2Pix_AIT alias of astropy.modeling.projections.Sky2Pix_HammerAitoff
Pix2Sky_COP alias of astropy.modeling.projections.Pix2Sky_ConicPerspective
Sky2Pix_COP alias of astropy.modeling.projections.Sky2Pix_ConicPerspective
Pix2Sky_COE alias of astropy.modeling.projections.Pix2Sky_ConicEqualArea
Sky2Pix_COE alias of astropy.modeling.projections.Sky2Pix_ConicEqualArea
Pix2Sky_COD alias of astropy.modeling.projections.Pix2Sky_ConicEquidistant
Sky2Pix_COD alias of astropy.modeling.projections.Sky2Pix_ConicEquidistant
Pix2Sky_COO alias of astropy.modeling.projections.Pix2Sky_ConicOrthomorphic
Sky2Pix_COO alias of astropy.modeling.projections.Sky2Pix_ConicOrthomorphic
Pix2Sky_BON alias of astropy.modeling.projections.Pix2Sky_BonneEqualArea
Sky2Pix_BON alias of astropy.modeling.projections.Sky2Pix_BonneEqualArea
Pix2Sky_PCO alias of astropy.modeling.projections.Pix2Sky_Polyconic
Sky2Pix_PCO alias of astropy.modeling.projections.Sky2Pix_Polyconic
Pix2Sky_TSC alias of astropy.modeling.projections.Pix2Sky_TangentialSphericalCube
Sky2Pix_TSC alias of astropy.modeling.projections.Sky2Pix_TangentialSphericalCube
Pix2Sky_CSC alias of astropy.modeling.projections.Pix2Sky_COBEQuadSphericalCube
Sky2Pix_CSC alias of astropy.modeling.projections.Sky2Pix_COBEQuadSphericalCube
Pix2Sky_QSC alias of astropy.modeling.projections.Pix2Sky_QuadSphericalCube
Sky2Pix_QSC alias of astropy.modeling.projections.Sky2Pix_QuadSphericalCube
Pix2Sky_HPX alias of astropy.modeling.projections.Pix2Sky_HEALPix
Sky2Pix_HPX alias of astropy.modeling.projections.Sky2Pix_HEALPix
Pix2Sky_XPH alias of astropy.modeling.projections.Pix2Sky_HEALPixPolar
Sky2Pix_XPH alias of astropy.modeling.projections.Sky2Pix_HEALPixPolar

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.projections.Projection, astropy.modeling.projections.Pix2SkyProjection, astropy.modeling.projections.Sky2PixProjection, astropy.modeling.projections.Zenithal, astropy.modeling.projections.Cylindrical, astropy.modeling.projections.PseudoCylindrical, astropy.modeling.projections.Conic, astropy.modeling.projections.PseudoConic, astropy.modeling.projections.QuadCube, astropy.modeling.projections.HEALPix, astropy.modeling.projections.AffineTransformation2D, astropy.modeling.projections.Pix2Sky_ZenithalPerspective, astropy.modeling.projections.Sky2Pix_ZenithalPerspective, astropy.modeling.projections.Pix2Sky_SlantZenithalPerspective, astropy.modeling.projections.Sky2Pix_SlantZenithalPerspective, astropy.modeling.projections.Pix2Sky_Gnomonic, astropy.modeling.projections.Sky2Pix_Gnomonic, astropy.modeling.projections.Pix2Sky_Stereographic, astropy.modeling.projections.Sky2Pix_Stereographic, astropy.modeling.projections.Pix2Sky_SlantOrthographic, astropy.modeling.projections.Sky2Pix_SlantOrthographic, astropy.modeling.projections.Pix2Sky_ZenithalEquidistant, astropy.modeling.projections.Sky2Pix_ZenithalEquidistant, astropy.modeling.projections.Pix2Sky_ZenithalEqualArea, astropy.modeling.projections.Sky2Pix_ZenithalEqualArea, astropy.modeling.projections.Pix2Sky_Airy, astropy.modeling.projections.Sky2Pix_Airy, astropy.modeling.projections.Pix2Sky_CylindricalPerspective, astropy.modeling.projections.Sky2Pix_CylindricalPerspective, astropy.modeling.projections.Pix2Sky_CylindricalEqualArea, astropy.modeling.projections.Sky2Pix_CylindricalEqualArea, astropy.modeling.projections.Pix2Sky_PlateCarree, astropy.modeling.projections.Sky2Pix_PlateCarree, astropy.modeling.projections.Pix2Sky_Mercator, astropy.modeling.projections.Sky2Pix_Mercator, astropy.modeling.projections.Pix2Sky_SansonFlamsteed, astropy.modeling.projections.Sky2Pix_SansonFlamsteed, astropy.modeling.projections.Pix2Sky_Parabolic, astropy.modeling.projections.Sky2Pix_Parabolic, astropy.modeling.projections.Pix2Sky_Molleweide, astropy.modeling.projections.Sky2Pix_Molleweide, astropy.modeling.projections.Pix2Sky_HammerAitoff, astropy.modeling.projections.Sky2Pix_HammerAitoff, astropy.modeling.projections.Pix2Sky_ConicPerspective, astropy.modeling.projections.Sky2Pix_ConicPerspective, astropy.modeling.projections.Pix2Sky_ConicEqualArea, astropy.modeling.projections.Sky2Pix_ConicEqualArea, astropy.modeling.projections.Pix2Sky_ConicEquidistant, astropy.modeling.projections.Sky2Pix_ConicEquidistant, astropy.modeling.projections.Pix2Sky_ConicOrthomorphic, astropy.modeling.projections.Sky2Pix_ConicOrthomorphic, astropy.modeling.projections.Pix2Sky_BonneEqualArea, astropy.modeling.projections.Sky2Pix_BonneEqualArea, astropy.modeling.projections.Pix2Sky_Polyconic, astropy.modeling.projections.Sky2Pix_Polyconic, astropy.modeling.projections.Pix2Sky_TangentialSphericalCube, astropy.modeling.projections.Sky2Pix_TangentialSphericalCube, astropy.modeling.projections.Pix2Sky_COBEQuadSphericalCube, astropy.modeling.projections.Sky2Pix_COBEQuadSphericalCube, astropy.modeling.projections.Pix2Sky_QuadSphericalCube, astropy.modeling.projections.Sky2Pix_QuadSphericalCube, astropy.modeling.projections.Pix2Sky_HEALPix, astropy.modeling.projections.Sky2Pix_HEALPix, astropy.modeling.projections.Pix2Sky_HEALPixPolar, astropy.modeling.projections.Sky2Pix_HEALPixPolar, astropy.modeling.projections.Pix2Sky_ZenithalPerspective, astropy.modeling.projections.Sky2Pix_ZenithalPerspective, astropy.modeling.projections.Pix2Sky_SlantZenithalPerspective, astropy.modeling.projections.Sky2Pix_SlantZenithalPerspective, astropy.modeling.projections.Pix2Sky_Gnomonic, astropy.modeling.projections.Sky2Pix_Gnomonic, astropy.modeling.projections.Pix2Sky_Stereographic, astropy.modeling.projections.Sky2Pix_Stereographic, astropy.modeling.projections.Pix2Sky_SlantOrthographic, astropy.modeling.projections.Sky2Pix_SlantOrthographic, astropy.modeling.projections.Pix2Sky_ZenithalEquidistant, astropy.modeling.projections.Sky2Pix_ZenithalEquidistant, astropy.modeling.projections.Pix2Sky_ZenithalEqualArea, astropy.modeling.projections.Sky2Pix_ZenithalEqualArea, astropy.modeling.projections.Pix2Sky_Airy, astropy.modeling.projections.Sky2Pix_Airy, astropy.modeling.projections.Pix2Sky_CylindricalPerspective, astropy.modeling.projections.Sky2Pix_CylindricalPerspective, astropy.modeling.projections.Pix2Sky_CylindricalEqualArea, astropy.modeling.projections.Sky2Pix_CylindricalEqualArea, astropy.modeling.projections.Pix2Sky_PlateCarree, astropy.modeling.projections.Sky2Pix_PlateCarree, astropy.modeling.projections.Pix2Sky_Mercator, astropy.modeling.projections.Sky2Pix_Mercator, astropy.modeling.projections.Pix2Sky_SansonFlamsteed, astropy.modeling.projections.Sky2Pix_SansonFlamsteed, astropy.modeling.projections.Pix2Sky_Parabolic, astropy.modeling.projections.Sky2Pix_Parabolic, astropy.modeling.projections.Pix2Sky_Molleweide, astropy.modeling.projections.Sky2Pix_Molleweide, astropy.modeling.projections.Pix2Sky_HammerAitoff, astropy.modeling.projections.Sky2Pix_HammerAitoff, astropy.modeling.projections.Pix2Sky_ConicPerspective, astropy.modeling.projections.Sky2Pix_ConicPerspective, astropy.modeling.projections.Pix2Sky_ConicEqualArea, astropy.modeling.projections.Sky2Pix_ConicEqualArea, astropy.modeling.projections.Pix2Sky_ConicEquidistant, astropy.modeling.projections.Sky2Pix_ConicEquidistant, astropy.modeling.projections.Pix2Sky_ConicOrthomorphic, astropy.modeling.projections.Sky2Pix_ConicOrthomorphic, astropy.modeling.projections.Pix2Sky_BonneEqualArea, astropy.modeling.projections.Sky2Pix_BonneEqualArea, astropy.modeling.projections.Pix2Sky_Polyconic, astropy.modeling.projections.Sky2Pix_Polyconic, astropy.modeling.projections.Pix2Sky_TangentialSphericalCube, astropy.modeling.projections.Sky2Pix_TangentialSphericalCube, astropy.modeling.projections.Pix2Sky_COBEQuadSphericalCube, astropy.modeling.projections.Sky2Pix_COBEQuadSphericalCube, astropy.modeling.projections.Pix2Sky_QuadSphericalCube, astropy.modeling.projections.Sky2Pix_QuadSphericalCube, astropy.modeling.projections.Pix2Sky_HEALPix, astropy.modeling.projections.Sky2Pix_HEALPix, astropy.modeling.projections.Pix2Sky_HEALPixPolar, astropy.modeling.projections.Sky2Pix_HEALPixPolar

astropy.modeling.rotations Module

Implements rotations, including spherical rotations as defined in WCS Paper II [R487dd78e661d-1]

RotateNative2Celestial and RotateCelestial2Native follow the convention in WCS Paper II to rotate to/from a native sphere and the celestial sphere.

The implementation uses EulerAngleRotation. The model parameters are three angles: the longitude (lon) and latitude (lat) of the fiducial point in the celestial system (CRVAL keywords in FITS), and the longitude of the celestial pole in the native system (lon_pole). The Euler angles are lon+90, 90-lat and -(lon_pole-90).

References

[R487dd78e661d-1]Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)

Classes

RotateCelestial2Native(lon, lat, lon_pole, …) Transform from Celestial to Native Spherical Coordinates.
RotateNative2Celestial(lon, lat, lon_pole, …) Transform from Native to Celestial Spherical Coordinates.
Rotation2D([angle]) Perform a 2D rotation given an angle.
EulerAngleRotation(phi, theta, psi, …) Implements Euler angle intrinsic rotations.

Class Inheritance Diagram

Inheritance diagram of astropy.modeling.rotations.RotateCelestial2Native, astropy.modeling.rotations.RotateNative2Celestial, astropy.modeling.rotations.Rotation2D, astropy.modeling.rotations.EulerAngleRotation

class astropy.modeling.tabular.Tabular1D(points=None, lookup_table=None, method='linear', bounds_error=True, fill_value=nan, **kwargs)

Tabular model in 1D. Returns an interpolated lookup table value.

Parameters:
points : array-like of float of ndim=1.

The points defining the regular grid in n dimensions.

lookup_table : array-like, of ndim=1.

The data in one dimensions.

method : str, optional

The method of interpolation to perform. Supported are “linear” and “nearest”, and “splinef2d”. “splinef2d” is only supported for 2-dimensional data. Default is “linear”.

bounds_error : bool, optional

If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then fill_value is used.

fill_value : float, optional

If provided, the value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated. Extrapolation is not supported by method “splinef2d”.

Returns:
value : ndarray

Interpolated values at input coordinates.

Raises:
ImportError

Scipy is not installed.

Notes

Uses scipy.interpolate.interpn.

class astropy.modeling.tabular.Tabular2D(points=None, lookup_table=None, method='linear', bounds_error=True, fill_value=nan, **kwargs)

Tabular model in 2D. Returns an interpolated lookup table value.

Parameters:
points : tuple of ndarray of float, with shapes (m1, m2), optional

The points defining the regular grid in n dimensions.

lookup_table : array-like, shape (m1, m2)

The data on a regular grid in 2 dimensions.

method : str, optional

The method of interpolation to perform. Supported are “linear” and “nearest”, and “splinef2d”. “splinef2d” is only supported for 2-dimensional data. Default is “linear”.

bounds_error : bool, optional

If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then fill_value is used.

fill_value : float, optional

If provided, the value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated. Extrapolation is not supported by method “splinef2d”.

Returns:
value : ndarray

Interpolated values at input coordinates.

Raises:
ImportError

Scipy is not installed.

Notes

Uses scipy.interpolate.interpn.