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#
|
Set a validated bounding box to a model instance. |
|
Add a validated compound bounding box to a model instance. |
|
Create a model from a user defined function. |
|
This function creates a compound model with one or more of the input values of the input model assigned fixed values (scalar or array). |
|
A separability test for the outputs of a transform. |
|
Compute the correlation between outputs and inputs. |
Classes#
|
Base class for compound models. |
|
Base class for one-dimensional fittable models. |
|
Base class for two-dimensional fittable models. |
|
Base class for models that can be fitted using the built-in fitting algorithms. |
Used for incorrect input parameter values and definitions. |
|
|
Base class for all models. |
Used for incorrect models definitions. |
|
|
Wraps individual parameters. |
Generic exception class for all exceptions pertaining to Parameters. |
Class Inheritance Diagram#
astropy.modeling.bounding_box Module#
This module is to contain an improved bounding box.
Classes#
|
A model's bounding box. |
|
A model's compound bounding box. |
Class Inheritance Diagram#
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#
|
Allows inputs to be reordered, duplicated or dropped. |
|
Returns inputs unchanged. |
|
Mapper that operates on the units of the input, first converting to canonical units, then assigning new units without further conversion. |
Class Inheritance Diagram#
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#
|
A class performing a linear least square fitting. |
|
Levenberg-Marquardt algorithm and least squares statistic. |
|
Trust Region Reflective algorithm and least squares statistic. |
|
DogBox algorithm and least squares statistic. |
|
|
|
This class combines an outlier removal technique with a fitting procedure. |
Sequential Least Squares Programming (SLSQP) optimization algorithm and least squares statistic. |
|
Simplex algorithm and least squares statistic. |
|
|
Fit models which share a parameter. |
|
Base class for all fitters. |
Raised when a non-linear model is passed to a linear fitter. |
|
Base class for model exceptions. |
Class Inheritance Diagram#
astropy.modeling.optimizers Module#
Optimization algorithms used in fitting
.
Classes#
|
Base class for optimizers. |
|
Sequential Least Squares Programming optimization algorithm. |
|
Neald-Mead (downhill simplex) algorithm. |
Class Inheritance Diagram#
astropy.modeling.statistic Module#
Statistic functions used in fitting
.
Functions#
|
Least square statistic, with optional weights, in N-dimensions. |
|
Least square statistic with optional weights. |
|
Least square statistic with optional weights. |
|
Least square statistic with optional weights. |
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#
|
A separability test for the outputs of a transform. |
|
Compute the correlation between outputs and inputs. |
Pre-Defined Models#
astropy.modeling.functional_models Module#
Mathematical models.
Classes#
|
Two dimensional Airy disk model. |
|
One dimensional Moffat model. |
|
Two dimensional Moffat model. |
|
One dimensional Box model. |
|
Two dimensional Box model. |
|
One dimensional Constant model. |
|
Two dimensional Constant model. |
|
A 2D Ellipse model. |
|
Two dimensional radial symmetric Disk model. |
|
One dimensional Gaussian model. |
|
Two dimensional Gaussian model. |
|
Generalized two dimensional Sersic surface brightness profile that allows for "boxy" or "disky" (kite-like) isophote shapes. |
|
One dimensional Line model. |
|
One dimensional Lorentzian model. |
|
One dimensional Ricker Wavelet model (sometimes known as a "Mexican Hat" model). |
|
Two dimensional Ricker Wavelet model (sometimes known as a "Mexican Hat" model). |
|
One dimensional redshift scale factor model. |
|
Multiply a model by a quantity or number. |
|
Two dimensional Plane model. |
|
Multiply a model by a dimensionless factor. |
|
One dimensional Sersic surface brightness profile. |
|
Two dimensional Sersic surface brightness profile. |
|
Shift a coordinate. |
|
One dimensional Sine model. |
|
One dimensional Cosine model. |
|
One dimensional Tangent model. |
|
One dimensional ArcSine model returning values between -pi/2 and pi/2 only. |
|
One dimensional ArcCosine returning values between 0 and pi only. |
|
One dimensional ArcTangent model returning values between -pi/2 and pi/2 only. |
|
One dimensional Trapezoid model. |
|
Two dimensional circular Trapezoid model. |
|
Two dimensional radial symmetric Ring model. |
|
One dimensional model for the Voigt profile. |
|
Projected (surface density) analytic King Model. |
|
One dimensional exponential model. |
|
One dimensional logarithmic model. |
Class Inheritance Diagram#
astropy.modeling.physical_models Module#
Models that have physical origins.
Classes#
|
Blackbody model using the Planck function. |
|
Drude model based one the behavior of electons in materials (esp. |
|
One dimensional Plummer density profile model. |
|
Navarro–Frenk–White (NFW) profile - model for radial distribution of dark matter. |
Class Inheritance Diagram#
astropy.modeling.powerlaws Module#
Power law model variants.
Classes#
|
One dimensional power law model. |
|
One dimensional power law model with a break. |
|
One dimensional smoothly broken power law model. |
|
One dimensional power law model with an exponential cutoff. |
|
One dimensional log parabola model (sometimes called curved power law). |
|
Schechter luminosity function (Schechter 1976), parameterized in terms of magnitudes. |
Class Inheritance Diagram#
astropy.modeling.polynomial Module#
This module contains models representing polynomials and polynomial series.
Classes#
|
Univariate Chebyshev series. |
|
Bivariate Chebyshev series.. |
|
Univariate Hermite series. |
|
Bivariate Hermite series. |
|
Inverse Simple Imaging Polynomial. |
|
Univariate Legendre series. |
|
Bivariate Legendre series. |
|
1D Polynomial model. |
|
2D Polynomial model. |
|
Simple Imaging Polynomial (SIP) model. |
|
This is a base class for the 2D Chebyshev and Legendre models. |
|
Base class for polynomial models. |
Class Inheritance Diagram#
astropy.modeling.projections Module#
Implements projections–particularly sky projections defined in WCS Paper II [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#
Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)
Classes#
|
Base class for all sky projections. |
|
Base class for all Pix2Sky projections. |
|
Base class for all Sky2Pix projections. |
|
Base class for all Zenithal projections. |
|
Base class for Cylindrical projections. |
|
Base class for pseudocylindrical projections. |
|
Base class for conic projections. |
|
Base class for pseudoconic projections. |
|
Base class for quad cube projections. |
|
Base class for HEALPix projections. |
|
Perform an affine transformation in 2 dimensions. |
|
Zenithal perspective projection - pixel to sky. |
alias of |
|
|
Slant zenithal perspective projection - pixel to sky. |
alias of |
|
|
Gnomonic projection - pixel to sky. |
alias of |
|
|
Stereographic Projection - pixel to sky. |
alias of |
|
|
Slant orthographic projection - pixel to sky. |
alias of |
|
|
Zenithal equidistant projection - pixel to sky. |
alias of |
|
|
Zenithal equidistant projection - pixel to sky. |
alias of |
|
|
Airy projection - pixel to sky. |
alias of |
|
|
Cylindrical perspective - pixel to sky. |
alias of |
|
|
Cylindrical equal area projection - pixel to sky. |
alias of |
|
|
Plate carrée projection - pixel to sky. |
alias of |
|
|
Mercator - pixel to sky. |
alias of |
|
|
Sanson-Flamsteed projection - pixel to sky. |
alias of |
|
|
Parabolic projection - pixel to sky. |
alias of |
|
|
Molleweide's projection - pixel to sky. |
alias of |
|
|
Hammer-Aitoff projection - pixel to sky. |
alias of |
|
|
Colles' conic perspective projection - pixel to sky. |
alias of |
|
|
Alber's conic equal area projection - pixel to sky. |
alias of |
|
|
Conic equidistant projection - pixel to sky. |
alias of |
|
|
Conic orthomorphic projection - pixel to sky. |
alias of |
|
|
Bonne's equal area pseudoconic projection - pixel to sky. |
alias of |
|
|
Polyconic projection - pixel to sky. |
alias of |
|
|
Tangential spherical cube projection - pixel to sky. |
alias of |
|
|
COBE quadrilateralized spherical cube projection - pixel to sky. |
alias of |
|
|
Quadrilateralized spherical cube projection - pixel to sky. |
alias of |
|
|
HEALPix - pixel to sky. |
alias of |
|
|
HEALPix polar, aka "butterfly" projection - pixel to sky. |
alias of |
|
|
Zenithal perspective projection - sky to pixel. |
alias of |
|
|
Zenithal perspective projection - sky to pixel. |
alias of |
|
|
Gnomonic Projection - sky to pixel. |
alias of |
|
|
Stereographic Projection - sky to pixel. |
alias of |
|
|
Slant orthographic projection - sky to pixel. |
alias of |
|
|
Zenithal equidistant projection - sky to pixel. |
alias of |
|
|
Zenithal equidistant projection - sky to pixel. |
alias of |
|
|
Airy - sky to pixel. |
alias of |
|
|
Cylindrical Perspective - sky to pixel. |
alias of |
|
|
Cylindrical equal area projection - sky to pixel. |
alias of |
|
|
Plate carrée projection - sky to pixel. |
alias of |
|
|
Mercator - sky to pixel. |
alias of |
|
|
Sanson-Flamsteed projection - sky to pixel. |
alias of |
|
|
Parabolic projection - sky to pixel. |
alias of |
|
|
Molleweide's projection - sky to pixel. |
alias of |
|
|
Hammer-Aitoff projection - sky to pixel. |
alias of |
|
|
Colles' conic perspective projection - sky to pixel. |
alias of |
|
|
Alber's conic equal area projection - sky to pixel. |
alias of |
|
|
Conic equidistant projection - sky to pixel. |
alias of |
|
|
Conic orthomorphic projection - sky to pixel. |
alias of |
|
|
Bonne's equal area pseudoconic projection - sky to pixel. |
alias of |
|
|
Polyconic projection - sky to pixel. |
alias of |
|
|
Tangential spherical cube projection - sky to pixel. |
alias of |
|
|
COBE quadrilateralized spherical cube projection - sky to pixel. |
alias of |
|
|
Quadrilateralized spherical cube projection - sky to pixel. |
alias of |
|
|
HEALPix projection - sky to pixel. |
alias of |
|
|
HEALPix polar, aka "butterfly" projection - pixel to sky. |
alias of |
Class Inheritance Diagram#
astropy.modeling.rotations Module#
Implements rotations, including spherical rotations as defined in WCS Paper II [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#
Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)
Classes#
|
Transform from Celestial to Native Spherical Coordinates. |
|
Transform from Native to Celestial Spherical Coordinates. |
|
Perform a 2D rotation given an angle. |
|
Implements Euler angle intrinsic rotations. |
|
Perform a series of rotations about different axis in 3D space. |
|
Perform a sequence of rotations about arbitrary number of axes in spherical coordinates. |
Class Inheritance Diagram#
astropy.modeling.spline Module#
Spline models and fitters.
Classes#
|
One dimensional Spline Model. |
Fit an interpolating spline. |
|
Fit a smoothing spline. |
|
Fit a spline using least-squares regression. |
|
Fit a spline using the |
Class Inheritance Diagram#
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#
|
Make a |
Classes#
|
Tabular model in 1D. |
|
Tabular model in 2D. |