astrophot.models package

Submodules

astrophot.models.airy_psf module

class astrophot.models.airy_psf.Airy_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

The Airy disk is an analytic description of the diffraction pattern for a circular aperture.

The diffraction pattern is described exactly by the configuration of the lens system under the assumption that all elements are perfect. This expression goes as:

\[ \begin{align}\begin{aligned}I(\theta) = I_0\left[\frac{2J_1(x)}{x}\right]^2\\x = ka\sin(\theta) = \frac{2\pi a r}{\lambda R}\end{aligned}\end{align} \]

where \(I(\theta)\) is the intensity as a function of the angular poisition within the diffraction system along its main axis, \(I_0\) is the central intensity of the airy disk, \(J_1\) is the Bessel function of the first kind of order one, \(k = \frac{2\pi}{\lambda}\) is the wavenumber of the light, \(a\) is the aperture radius, \(r\) is the radial position from the center of the pattern, \(R\) is the distance from the circular aperture to the observation plane.

In the Airy_PSF class we combine the parameters \(a,R,\lambda\) into a single ratio to be optimized (or fixed by the optical configuration).

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'airy psf model'
parameter_specs = {'I0': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'aRL': {'units': 'a/(R lambda)'}}
radial_model(R, image=None, parameters=None)[source]
useable = True

astrophot.models.core_model module

class astrophot.models.core_model.AstroPhot_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: object

Core class for all AstroPhot models and model like objects. This class defines the signatures to interact with AstroPhot models both for users and internal functions.

Basic usage:

import astrophot as ap

# Create a model object
model = ap.models.AstroPhot_Model(
    name = "unique name",
    model_type = <choose a model type>,
    target = <Target_Image object>,
    window = [[a,b],[c,d]], <widnow pixel coordinates>,
    parameters = <dict of parameter specifications if desired>,
)

# Initialize parameters that weren't set on creation
model.initialize()

# Fit model to target
result = ap.fit.lm(model, verbose=1).fit()

# Plot the model
fig, ax = plt.subplots()
ap.plots.model_image(fig, ax, model)
plt.show()

# Sample the model
img = model()
pixels = img.data

AstroPhot models are one of the main ways that one interacts with the code, either by setting model parameters or passing models to other objects, one can perform a huge variety of fitting tasks. The subclass Component_Model should be thought of as the basic unit when constructing a model of an image while a Group_Model is a composite structure that may represent a complex object, a region of an image, or even a model spanning many images. Constructing the Component_Model`s is where most work goes, these store the actual parameters that will be optimized. It is important to remmeber that a `Component_Model only ever applies to a single image and a single component (star, galaxy, or even sub-component of one of those) in that image.

A complex representation is made by stacking many `Component_Model`s together, in total this may result in a very large number of parameters. Trying to find starting values for all of these parameters can be tedious and error prone, so instead all built-in AstroPhot models can self initialize and find reasonable starting parameters for most situations. Even still one may find that for extremely complex fits, it is more stable to first run an iterative fitter before global optimization to start the models in better initial positions.

Parameters:
  • name (Optional[str]) – every AstroPhot model should have a unique name

  • model_type (str) – a model type string can determine which kind of AstroPhot model is instantiated.

  • target (Optional[Target_Image]) – A Target_Image object which stores information about the image which the model is trying to fit.

  • filename (Optional[str]) – name of a file to load AstroPhot parameters, window, and name. The model will still need to be told its target, device, and other information

classmethod List_Model_Names(useable=None)[source]
classmethod List_Models(useable=None)[source]
default_uncertainty = 0.01
get_state(*args, **kwargs)[source]

Returns a dictionary of the state of the model with its name, type, parameters, and other important infomration. This dictionary is what gets saved when a model saves to disk.

initialize(target=None, parameters=None, **kwargs)[source]

When this function finishes, all parameters should have numerical values (non None) that are reasonable estimates of the final values.

jacobian(parameters=None, **kwargs)[source]
classmethod load(filename='AstroPhot.yaml')[source]

Loads a saved model object.

property locked

Set when the model should remain fixed going forward. This model will be bypassed when fitting parameters, however it will still be sampled for generating the model image.

Warning

This feature is not yet fully functional and should be avoided for now. It is included here for the sake of testing.

make_model_image(window: Window | None = None)[source]

This is called to create a blank Model_Image object of the correct format for this model. This is typically used internally to construct the model image before filling the pixel values with the model.

model_names = []
model_type = 'model'
property name

The name for this model as a string. The name should be unique though this is not enforced here. The name should not contain the | or : characters as these are reserved for internal use. If one tries to set the name of a model as None (for example by not providing a name for the model) then a new unique name will be generated. The unique name is just the model type for this model with an extra unique id appended to the end in the format of [#] where # is a number that increases until a unique name is found.

negative_log_likelihood(parameters=None, as_representation=False)[source]

Compute the negative log likelihood of the model wrt the target image in the appropriate window.

property parameter_order

Returns the model parameters in the order they are kept for flattening, such as when evaluating the model with a tensor of parameter values.

sample(image=None, window=None, parameters=None, *args, **kwargs)[source]

Calling this function should fill the given image with values sampled from the given model.

save(filename='AstroPhot.yaml')[source]

Saves a model object to disk. By default the file type should be yaml, this is the only file type which gets tested, though other file types such as json and hdf5 should work.

set_window(window)[source]
property target
total_flux(parameters=None, window=None, image=None)[source]
useable = False
property window

The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously conected.

If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.

astrophot.models.edgeon_model module

class astrophot.models.edgeon_model.Edgeon_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: Component_Model

General Edge-On galaxy model to be subclassed for any specific representation such as radial light profile or the structure of the galaxy on the sky. Defines an edgeon galaxy as an object with a position angle, no inclination information is included.

evaluate_model(X=None, Y=None, image: Image = None, parameters: Parameter_Node = None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters: Parameter_Node | None = None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'edgeon model'
parameter_specs = {'PA': {'cyclic': True, 'limits': (0, 3.141592653589793), 'uncertainty': 0.06, 'units': 'rad'}}
transform_coordinates(X, Y, image=None, parameters=None)[source]
useable = False

astrophot.models.eigen_psf module

class astrophot.models.eigen_psf.Eigen_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

point source model which uses multiple images as a basis for the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no functional form for this object type as any image can be supplied. Note that as an argument to the model at construction one can provide “psf” as an AstroPhot PSF_Image object. Since only bilinear interpolation is performed, it is recommended to provide the PSF at a higher resolution than the image if it is near the nyquist sampling limit. Bilinear interpolation is very fast and accurate for smooth models, so this way it is possible to do the expensive interpolation before optimization and save time. Note that if you do this you must provide the PSF as a PSF_Image object with the correct pixelscale (essentially just divide the pixelscale by the upsampling factor you used).

Parameters:
  • eigen_basis (tensor) – This is the basis set of images used to form the eigen point source, it should be a tensor with shape (N x W x H) where N is the number of eigen images, and W/H are the dimensions of the image.

  • eigen_pixelscale (float) – This is the pixelscale associated with the eigen basis images.

  • flux – the total flux of the point source model, represented as the log of the total flux.

  • weights – the relative amplitude of the Eigen basis modes.

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = True
model_type = 'eigen psf model'
parameter_specs = {'flux': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'weights': {'units': 'unitless'}}
useable = True

astrophot.models.exponential_model module

class astrophot.models.exponential_model.Exponential_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

basic galaxy model with a exponential profile for the radial light profile. The light profile is defined as:

I(R) = Ie * exp(-b1(R/Re - 1))

where I(R) is the brightness as a function of semi-major axis, Ie is the brightness at the half light radius, b1 is a constant not involved in the fit, R is the semi-major axis, and Re is the effective radius.

Parameters:
  • Ie – Brightness at half light radius, represented as the log of the brightness divided by pixelscale squared. This is proportional to a surface brightness

  • Re – half light radius, represented in arcsec. This parameter cannot go below zero.

initialize(target=None, parameters: Parameter_Node | None = None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'exponential galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.exponential_model.Exponential_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

basic point source model with a exponential profile for the radial light profile.

I(R) = Ie * exp(-b1(R/Re - 1))

where I(R) is the brightness as a function of semi-major axis, Ie is the brightness at the half light radius, b1 is a constant not involved in the fit, R is the semi-major axis, and Re is the effective radius.

Parameters:
  • Ie – Brightness at half light radius, represented as the log of the brightness divided by pixelscale squared. This is proportional to a surface brightness

  • Re – half light radius, represented in arcsec. This parameter cannot go below zero.

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'exponential psf model'
parameter_specs = {'Ie': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.exponential_model.Exponential_Ray(*, filename=None, model_type=None, **kwargs)[source]

Bases: Ray_Galaxy

ray galaxy model with a sersic profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius.

Parameters:
  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'exponential ray galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
useable = True
class astrophot.models.exponential_model.Exponential_SuperEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Galaxy

super ellipse galaxy model with a exponential profile for the radial light profile.

I(R) = Ie * exp(-b1(R/Re - 1))

where I(R) is the brightness as a function of semi-major axis, Ie is the brightness at the half light radius, b1 is a constant not involved in the fit, R is the semi-major axis, and Re is the effective radius.

Parameters:
  • Ie – Brightness at half light radius, represented as the log of the brightness divided by pixelscale squared. This is proportional to a surface brightness

  • Re – half light radius, represented in arcsec. This parameter cannot go below zero.

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'exponential superellipse galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.exponential_model.Exponential_SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Warp

super ellipse warp galaxy model with a exponential profile for the radial light profile.

I(R) = Ie * exp(-b1(R/Re - 1))

where I(R) is the brightness as a function of semi-major axis, Ie is the brightness at the half light radius, b1 is a constant not involved in the fit, R is the semi-major axis, and Re is the effective radius.

Parameters:
  • Ie – Brightness at half light radius, represented as the log of the brightness divided by pixelscale squared. This is proportional to a surface brightness

  • Re – half light radius, represented in arcsec. This parameter cannot go below zero.

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'exponential superellipse warp galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.exponential_model.Exponential_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

warped coordinate galaxy model with a exponential profile for the radial light model.

I(R) = Ie * exp(-b1(R/Re - 1))

where I(R) is the brightness as a function of semi-major axis, Ie is the brightness at the half light radius, b1 is a constant not involved in the fit, R is the semi-major axis, and Re is the effective radius.

Parameters:
  • Ie – Brightness at half light radius, represented as the log of the brightness divided by pixelscale squared. This is proportional to a surface brightness

  • Re – half light radius, represented in arcsec. This parameter cannot go below zero.

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'exponential warp galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.exponential_model.Exponential_Wedge(*, filename=None, model_type=None, **kwargs)[source]

Bases: Wedge_Galaxy

wedge galaxy model with a exponential profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius.

Parameters:
  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'exponential wedge galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}}
useable = True

astrophot.models.flatsky_model module

class astrophot.models.flatsky_model.Flat_Sky(*, filename=None, model_type=None, **kwargs)[source]

Bases: Sky_Model

Model for the sky background in which all values across the image are the same.

Parameters:

sky – brightness for the sky, represented as the log of the brightness over pixel scale squared, this is proportional to a surface brightness

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'flat sky model'
parameter_specs = {'F': {'units': 'log10(flux/arcsec^2)'}}
useable = True

astrophot.models.foureirellipse_model module

class astrophot.models.foureirellipse_model.FourierEllipse_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Expanded galaxy model which includes a Fourier transformation in its radius metric. This allows for the expression of arbitrarily complex isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation. The form of the Fourier perturbations is:

R’ = R * exp(sum_m(a_m * cos(m * theta + phi_m)))

where R’ is the new radius value, R is the original ellipse radius, a_m is the amplitude of the m’th Fourier mode, m is the index of the Fourier mode, theta is the angle around the ellipse, and phi_m is the phase of the m’th fourier mode. This representation is somewhat different from other Fourier mode implimentations where instead of an expoenntial it is just 1 + sum_m(…), we opt for this formulation as it is more numerically stable. It cannot ever produce negative radii, but to first order the two representation are the same as can be seen by a Taylor expansion of exp(x) = 1 + x + O(x^2).

One can create extrememly complex shapes using different Fourier modes, however usually it is only low order modes that are of interest. For intuition, the first Fourier mode is roughly equivalent to a lopsided galaxy, one side will be compressed and the opposite side will be expanded. The second mode is almost never used as it is nearly degenerate with ellipticity. The third mode is an alternate kind of lopsidedness for a galaxy which makes it somewhat triangular, meaning that it is wider on one side than the other. The fourth mode is similar to a boxyness/diskyness parameter which tends to make more pronounced peanut shapes since it is more rounded than a superellipse representation. Modes higher than 4 are only useful in very specialized situations. In general one should consider carefully why the Fourier modes are being used for the science case at hand.

Parameters:
  • am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode.

  • phi_m – Tensor of phases for the Fourier modes, adjusts the orientation of the mode perturbation relative to the major axis. It is cyclically defined in the range [0,2pi)

angular_metric(X, Y, image=None, parameters=None)[source]
initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'fourier galaxy model'
modes = (1, 3, 4)
parameter_specs = {'am': {'units': 'none'}, 'phim': {'cyclic': True, 'limits': (0, 6.283185307179586), 'units': 'radians'}}
radius_metric(X, Y, image=None, parameters=None)[source]
track_attrs = ['psf_mode', 'psf_convolve_mode', 'psf_subpixel_shift', 'sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'image_chunksize', 'softening', 'modes']
useable = False
class astrophot.models.foureirellipse_model.FourierEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

Expanded warp galaxy model which includes a Fourier transformation in its radius metric. This allows for the expression of arbitrarily complex isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation. The form of the Fourier perturbations is:

R’ = R * exp(sum_m(a_m * cos(m * theta + phi_m)))

where R’ is the new radius value, R is the original ellipse radius, a_m is the amplitude of the m’th Fourier mode, m is the index of the Fourier mode, theta is the angle around the ellipse, and phi_m is the phase of the m’th fourier mode. This representation is somewhat different from other Fourier mode implimentations where instead of an expoenntial it is just 1 + sum_m(…), we opt for this formulation as it is more numerically stable. It cannot ever produce negative radii, but to first order the two representation are the same as can be seen by a Taylor expansion of exp(x) = 1 + x + O(x^2).

One can create extrememly complex shapes using different Fourier modes, however usually it is only low order modes that are of interest. For intuition, the first Fourier mode is roughly equivalent to a lopsided galaxy, one side will be compressed and the opposite side will be expanded. The second mode is almost never used as it is nearly degenerate with ellipticity. The third mode is an alternate kind of lopsidedness for a galaxy which makes it somewhat triangular, meaning that it is wider on one side than the other. The fourth mode is similar to a boxyness/diskyness parameter which tends to make more pronounced peanut shapes since it is more rounded than a superellipse representation. Modes higher than 4 are only useful in very specialized situations. In general one should consider carefully why the Fourier modes are being used for the science case at hand.

Parameters:
  • am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode.

  • phi_m – Tensor of phases for the Fourier modes, adjusts the orientation of the mode perturbation relative to the major axis. It is cyclically defined in the range [0,2pi)

angular_metric(X, Y, image=None, parameters=None)[source]
initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'fourier warp galaxy model'
modes = (1, 3, 4)
parameter_specs = {'am': {'units': 'none'}, 'phim': {'cyclic': True, 'limits': (0, 6.283185307179586), 'units': 'radians'}}
radius_metric(X, Y, image=None, parameters=None)[source]
track_attrs = ['psf_mode', 'psf_convolve_mode', 'psf_subpixel_shift', 'sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'image_chunksize', 'softening', 'modes']
useable = False

astrophot.models.galaxy_model_object module

class astrophot.models.galaxy_model_object.Galaxy_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: Component_Model

General galaxy model to be subclassed for any specific representation. Defines a galaxy as an object with a position angle and axis ratio, or effectively a tilted disk. Most subclassing models should simply define a radial model or update to the coordinate transform. The definition of the position angle and axis ratio used here is simply a scaling along the minor axis. The transformation can be written as:

X, Y = meshgrid(image) X’, Y’ = Rot(theta, X, Y) Y’’ = Y’ / q

where X Y are the coordinates of an image, X’ Y’ are the rotated coordinates, Rot is a rotation matrix by angle theta applied to the initial X Y coordinates, Y’’ is the scaled semi-minor axis, and q is the axis ratio.

Parameters:
  • q – axis ratio to scale minor axis from the ratio of the minor/major axis b/a, this parameter is unitless, it is restricted to the range (0,1)

  • PA – position angle of the smei-major axis relative to the image positive x-axis in radians, it is a cyclic parameter in the range [0,pi)

evaluate_model(X=None, Y=None, image=None, parameters: Parameter_Node = None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters: Parameter_Node | None = None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'galaxy model'
parameter_specs = {'PA': {'cyclic': True, 'limits': (0, 3.141592653589793), 'uncertainty': 0.06, 'units': 'radians'}, 'q': {'limits': (0, 1), 'uncertainty': 0.03, 'units': 'b/a'}}
transform_coordinates(X, Y, image=None, parameters=None)[source]
useable = False

astrophot.models.gaussian_model module

class astrophot.models.gaussian_model.Gaussian_FourierEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Galaxy

fourier mode perturbations to ellipse galaxy model with a gaussian profile for the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian fourier galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_FourierEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Warp

fourier mode perturbations to ellipse galaxy model with a gaussian profile for the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian fourier warp galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Basic galaxy model with Gaussian as the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

Basic point source model with a Gaussian as the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'gaussian psf model'
parameter_specs = {'flux': {'locked': True, 'units': 'log10(flux)', 'value': 0.0}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_SuperEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Galaxy

Super ellipse galaxy model with Gaussian as the radial light profile.The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian superellipse galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Warp

super ellipse warp galaxy model with a gaussian profile for the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian superellipse warp galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.gaussian_model.Gaussian_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

Coordinate warped galaxy model with Gaussian as the radial light profile. The gaussian radial profile is defined as:

I(R) = F * exp(-0.5 R^2/S^2) / sqrt(2pi*S^2)

where I(R) is the prightness as a function of semi-major axis length, F is the total flux in the model, R is the semi-major axis, and S is the standard deviation.

Parameters:
  • sigma – standard deviation of the gaussian profile, must be a positive value

  • flux – the total flux in the gaussian model, represented as the log of the total

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'gaussian warp galaxy model'
parameter_specs = {'flux': {'units': 'log10(flux)'}, 'sigma': {'limits': (0, None), 'units': 'arcsec'}}
radial_model(R, image=None, parameters=None)
useable = True

astrophot.models.group_model_object module

class astrophot.models.group_model_object.Group_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: AstroPhot_Model

Model object which represents a list of other models. For each general AstroPhot model method, this calls all the appropriate models from its list and combines their output into a single summed model. This class shoould be used when describing any system more comlex than makes sense to represent with a single light distribution.

Parameters:
  • name (str) – unique name for the full group model

  • target (Target_Image) – the target image that this group model is trying to fit to

  • models (Optional[Sequence[AstroPhot_Model]]) – list of AstroPhot_Model objects which will combine for the group model

  • locked (bool) – if the whole group of models should be locked

add_model(model)[source]

Adds a new model to the group model list. Ensures that the same model isn’t added a second time.

Parameters:

model – a model object to add to the model list.

get_state(save_params=True)[source]

Returns a dictionary with information about the state of the model and its parameters.

initialize(target: Image | None = None, parameters=None, **kwargs)[source]

Initialize each model in this group. Does this by iteratively initializing a model then subtracting it from a copy of the target.

Parameters:

target (Optional["Target_Image"]) – A Target_Image instance to use as the source for initializing the model parameters on this image.

jacobian(parameters: Tensor | None = None, as_representation: bool = False, pass_jacobian: Jacobian_Image | None = None, window: Window | None = None, **kwargs)[source]

Compute the jacobian for this model. Done by first constructing a full jacobian (Npixels * Nparameters) of zeros then call the jacobian method of each sub model and add it in to the total.

Parameters:
  • parameters (Optional[torch.Tensor]) – 1D parameter vector to overwrite current values

  • as_representation (bool) – Indiates if the “parameters” argument is in the form of the real values, or as representations in the (-inf,inf) range. Default False

  • pass_jacobian (Optional["Jacobian_Image"]) – A Jacobian image pre-constructed to be passed along instead of constructing new Jacobians

load(filename='AstroPhot.yaml', new_name=None)[source]

Loads an AstroPhot state file and updates this model with the loaded parameters.

model_type = 'group model'
property psf_mode
sample(image: Image | None = None, window: Window | None = None, parameters: Parameter_Node | None = None)[source]

Sample the group model on an image. Produces the flux values for each pixel associated with the models in this group. Each model is called individually and the results are added together in one larger image.

Parameters:

image (Optional["Model_Image"]) – Image to sample on, overrides the windows for each sub model, they will all be evaluated over this entire image. If left as none then each sub model will be evaluated in its window.

property target
update_window(include_locked: bool = False)[source]

Makes a new window object which encloses all the windows of the sub models in this group model object.

useable = True

astrophot.models.group_psf_model module

class astrophot.models.group_psf_model.PSF_Group_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: Group_Model

model_type = 'psf group model'
property psf_mode
property target
useable = True

astrophot.models.model_object module

class astrophot.models.model_object.Component_Model(name, target, window, locked, **kwargs)[source]

Bases: AstroPhot_Model

Component_Model is a base class for models that represent single objects or parametric forms. It provides the basis for subclassing models and requires the definition of parameters, initialization, and model evaluation functions. This class also handles integration, PSF convolution, and computing the Jacobian matrix.

parameter_specs

Specifications for the model parameters.

Type:

dict

_parameter_order

Fixed order of parameters.

Type:

tuple

psf_mode

Technique and scope for PSF convolution.

Type:

str

sampling_mode

Method for initial sampling of model. Can be one of midpoint, trapezoid, simpson. Default: midpoint

Type:

str

sampling_tolerance

accuracy to which each pixel should be evaluated. Default: 1e-2

Type:

float

integrate_mode

Integration scope for the model. One of none, threshold, full where threshold will select which pixels to integrate while full (in development) will integrate all pixels. Default: threshold

Type:

str

integrate_max_depth

Maximum recursion depth when performing sub pixel integration.

Type:

int

integrate_gridding

Amount by which to subdivide pixels when doing recursive pixel integration.

Type:

int

integrate_quad_level

The initial quadrature level for sub pixel integration. Please always choose an odd number 3 or higher.

Type:

int

softening

Softening length used for numerical stability and integration stability to avoid discontinuities (near R=0). Effectively has units of arcsec. Default: 1e-5

Type:

float

jacobian_chunksize

Maximum size of parameter list before jacobian will be broken into smaller chunks.

Type:

int

special_kwargs

Parameters which are treated specially by the model object and should not be updated directly.

Type:

list

useable

Indicates if the model is useable.

Type:

bool

initialize()[source]

Determine initial values for the center coordinates.

sample()[source]

Evaluate the model on the space covered by an image object.

jacobian()

Compute the Jacobian matrix for this model.

angular_metric(X, Y, image=None, parameters=None)
classmethod build_parameter_specs(user_specs=None)
build_parameters()
evaluate_model(X: Tensor | None = None, Y: Tensor | None = None, image: Image | None = None, parameters: Parameter_Node | None = None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

get_state(save_params=True)[source]

Returns a dictionary with a record of the current state of the model.

Specifically, the current parameter settings and the window for this model. From this information it is possible for the model to re-build itself lated when loading from disk. Note that the target image is not saved, this must be reset when loading the model.

image_chunksize = 1000
initialize(target: Target_Image | None = None, parameters: Parameter_Node | None = None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

integrate_gridding = 5
integrate_max_depth = 3
integrate_mode = 'threshold'
integrate_quad_level = 3
jacobian(parameters: Tensor | None = None, as_representation: bool = False, window: Window | None = None, pass_jacobian: Jacobian_Image | None = None, **kwargs)

Compute the Jacobian matrix for this model.

The Jacobian matrix represents the partial derivatives of the model’s output with respect to its input parameters. It is useful in optimization and model fitting processes. This method simplifies the process of computing the Jacobian matrix for astronomical image models and is primarily used by the Levenberg-Marquardt algorithm for model fitting tasks.

Parameters:
  • parameters (Optional[torch.Tensor]) – A 1D parameter tensor to override the current model’s parameters.

  • as_representation (bool) – Indicates if the parameters argument is provided as real values or representations in the (-inf, inf) range. Default is False.

  • parameters_identity (Optional[tuple]) – Specifies which parameters are to be considered in the computation.

  • window (Optional[Window]) – A window object specifying the region of interest in the image.

  • **kwargs – Additional keyword arguments.

Returns:

A Jacobian_Image object containing the computed Jacobian matrix.

Return type:

Jacobian_Image

jacobian_chunksize = 10
load(filename: str | dict | TextIOBase = 'AstroPhot.yaml', new_name=None)

Used to load the model from a saved state.

Sets the model window to the saved value and updates all parameters with the saved information. This overrides the current parameter settings.

Parameters:

filename – The source from which to load the model parameters. Can be a string (the name of the file on disc), a dictionary (formatted as if from self.get_state), or an io.TextIOBase (a file stream to load the file from).

parameter_specs = {'center': {'uncertainty': [0.1, 0.1], 'units': 'arcsec'}}
property psf
psf_convolve_mode = 'fft'
psf_mode = 'none'
psf_subpixel_shift = 'bilinear'
radius_metric(X, Y, image=None, parameters=None)
sample(image: Image | None = None, window: Window | None = None, parameters: Parameter_Node | None = None)[source]

Evaluate the model on the space covered by an image object. This function properly calls integration methods and PSF convolution. This should not be overloaded except in special cases.

This function is designed to compute the model on a given image or within a specified window. It takes care of sub-pixel sampling, recursive integration for high curvature regions, PSF convolution, and proper alignment of the computed model with the original pixel grid. The final model is then added to the requested image.

Parameters:
  • image (Optional[Image]) – An AstroPhot Image object (likely a Model_Image) on which to evaluate the model values. If not provided, a new Model_Image object will be created.

  • window (Optional[Window]) – A window within which to evaluate the model. Should only be used if a subset of the full image is needed. If not provided, the entire image will be used.

Returns:

The image with the computed model values.

Return type:

Image

sampling_mode = 'midpoint'
sampling_tolerance = 0.01
set_aux_psf(aux_psf, add_parameters=True)[source]

Set the PSF for this model as an auxiliary psf model. This psf model will be resampled as part of the model sampling step to track changes made during fitting.

Parameters:
  • aux_psf – The auxiliary psf model

  • add_parameters – if true, the parameters of the auxiliary psf model will become model parameters for this model as well.

softening = 0.001
special_kwargs = ['parameters', 'filename', 'model_type']
property target
track_attrs = ['psf_mode', 'psf_convolve_mode', 'psf_subpixel_shift', 'sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'image_chunksize', 'softening']
useable = False

astrophot.models.moffat_model module

class astrophot.models.moffat_model.Moffat_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

basic galaxy model with a Moffat profile for the radial light profile. The functional form of the Moffat profile is defined as:

I(R) = I0 / (1 + (R/Rd)^2)^n

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, I0 is the central flux density, Rd is the scale length for the profile, and n is the concentration index which controls the shape of the profile.

Parameters:
  • n – Concentration index which controls the shape of the brightness profile

  • I0 – brightness at the center of the profile, represented as the log of the brightness divided by pixel scale squared.

  • Rd – scale length radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'moffat galaxy model'
parameter_specs = {'I0': {'units': 'log10(flux/arcsec^2)'}, 'Rd': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.1, 10), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
total_flux(parameters=None)[source]
total_flux_uncertainty(parameters=None)[source]
useable = True
class astrophot.models.moffat_model.Moffat_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

basic point source model with a Moffat profile for the radial light profile. The functional form of the Moffat profile is defined as:

I(R) = I0 / (1 + (R/Rd)^2)^n

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, I0 is the central flux density, Rd is the scale length for the profile, and n is the concentration index which controls the shape of the profile.

Parameters:
  • n – Concentration index which controls the shape of the brightness profile

  • I0 – brightness at the center of the profile, represented as the log of the brightness divided by pixel scale squared.

  • Rd – scale length radius

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'moffat psf model'
parameter_specs = {'I0': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'Rd': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.1, 10), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
total_flux(parameters=None)[source]
total_flux_uncertainty(parameters=None)[source]
useable = True

astrophot.models.nuker_model module

class astrophot.models.nuker_model.Nuker_FourierEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Galaxy

fourier mode perturbations to ellipse galaxy model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker fourier galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_FourierEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Warp

fourier mode perturbations to ellipse galaxy model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker fourier warp galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

basic galaxy model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

basic point source model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'nuker psf model'
parameter_specs = {'Ib': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_Ray(*, filename=None, model_type=None, **kwargs)[source]

Bases: Ray_Galaxy

ray galaxy model with a nuker profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'nuker ray galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
useable = True
class astrophot.models.nuker_model.Nuker_SuperEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Galaxy

super ellipse galaxy model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker superellipse galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Warp

super ellipse warp galaxy model with a Nuker profile for the radial light profile. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker superellipse warp galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.nuker_model.Nuker_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

warped coordinate galaxy model with a Nuker profile for the radial light model. The functional form of the Nuker profile is defined as:

I(R) = Ib * 2^((beta-gamma)/alpha) * (R / Rb)^(-gamma) * (1 + (R/Rb)^alpha)^((gamma - beta)/alpha)

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ib is the flux density at the scale radius Rb, Rb is the scale length for the profile, beta is the outer power law slope, gamma is the iner power law slope, and alpha is the sharpness of the transition.

Parameters:
  • Ib – brightness at the scale length, represented as the log of the brightness divided by pixel scale squared.

  • Rb – scale length radius

  • alpha – sharpness of transition between power law slopes

  • beta – outer power law slope

  • gamma – inner power law slope

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'nuker warp galaxy model'
parameter_specs = {'Ib': {'units': 'log10(flux/arcsec^2)'}, 'Rb': {'limits': (0, None), 'units': 'arcsec'}, 'alpha': {'limits': (0, None), 'units': 'none'}, 'beta': {'limits': (0, None), 'units': 'none'}, 'gamma': {'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True

astrophot.models.pixelated_psf_model module

class astrophot.models.pixelated_psf_model.Pixelated_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

point source model which uses an image of the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no funcitonal form for this object type as any image can be supplied. The image pixels will be optimized as individual parameters. This can very quickly result in a large number of parameters and a near impossible fitting task, ideally this should be restricted to a very small area likely at the center of the PSF.

To initialize the PSF image will by default be set to the target PSF_Image values, thus one can use an empirical PSF as a starting point. Since only bilinear interpolation is performed, it is recommended to provide the PSF at a higher resolution than the image if it is near the nyquist sampling limit. Bilinear interpolation is very fast and accurate for smooth models, so this way it is possible to do the expensive interpolation before optimization and save time. Note that if you do this you must provide the PSF as a PSF_Image object with the correct pixelscale (essentially just divide the pixelscale by the upsampling factor you used).

Parameters:

pixels – the total flux within each pixel, represented as the log of the flux.

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = True
model_type = 'pixelated psf model'
parameter_specs = {'pixels': {'units': 'log10(flux/arcsec^2)'}}
useable = True

astrophot.models.planesky_model module

class astrophot.models.planesky_model.Plane_Sky(*, filename=None, model_type=None, **kwargs)[source]

Bases: Sky_Model

Sky background model using a tilted plane for the sky flux. The brightness for each pixel is defined as:

I(X, Y) = S + X*dx + Y*dy

where I(X,Y) is the brightness as a funcion of image position X Y, S is the central sky brightness value, and dx dy are the slopes of the sky brightness plane.

Parameters:
  • sky – central sky brightness value

  • delta – Tensor for slope of the sky brightness in each image dimension

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'plane sky model'
parameter_specs = {'F': {'units': 'flux/arcsec^2'}, 'delta': {'units': 'flux/arcsec'}}
useable = True

astrophot.models.point_source module

class astrophot.models.point_source.Point_Source(*, filename=None, model_type=None, **kwargs)[source]

Bases: Component_Model

Describes a point source in the image, this is a delta function at some position in the sky. This is typically used to describe stars, supernovae, very small galaxies, quasars, asteroids or any other object which can essentially be entirely described by a position and total flux (no structure).

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'point model'
parameter_specs = {'flux': {'units': 'log10(flux)'}}
property psf_mode

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

sample(image: Image | None = None, window: Window | None = None, parameters: Parameter_Node | None = None)[source]

Evaluate the model on the space covered by an image object. This function properly calls integration methods and PSF convolution. This should not be overloaded except in special cases.

This function is designed to compute the model on a given image or within a specified window. It takes care of sub-pixel sampling, recursive integration for high curvature regions, PSF convolution, and proper alignment of the computed model with the original pixel grid. The final model is then added to the requested image.

Parameters:
  • image (Optional[Image]) – An AstroPhot Image object (likely a Model_Image) on which to evaluate the model values. If not provided, a new Model_Image object will be created.

  • window (Optional[Window]) – A window within which to evaluate the model. Should only be used if a subset of the full image is needed. If not provided, the entire image will be used.

Returns:

The image with the computed model values.

Return type:

Image

useable = True

astrophot.models.psf_model_object module

class astrophot.models.psf_model_object.PSF_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: AstroPhot_Model

Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.

PSF_Models behave differently than component models. For starters, their target image must be a PSF_Image object instead of a Target_Image object. PSF_Models also don’t define a “center” variable since their center is always (0,0) just like a PSF_Image. A PSF_Model will never be convolved with a PSF_Model (that’s it’s job!), so a lot of the sampling method is simpler.

angular_metric(X, Y, image=None, parameters=None)
classmethod build_parameter_specs(user_specs=None)
build_parameters()
evaluate_model(X: Tensor | None = None, Y: Tensor | None = None, image: Image | None = None, parameters: Parameter_Node | None = None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

get_state(save_params=True)[source]

Returns a dictionary with a record of the current state of the model.

Specifically, the current parameter settings and the window for this model. From this information it is possible for the model to re-build itself lated when loading from disk. Note that the target image is not saved, this must be reset when loading the model.

image_chunksize = 1000
initialize(target: PSF_Image | None = None, parameters: Parameter_Node | None = None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

integrate_gridding = 5
integrate_max_depth = 3
integrate_mode = 'threshold'
integrate_quad_level = 3
jacobian(parameters: Tensor | None = None, as_representation: bool = False, window: Window | None = None, pass_jacobian: Jacobian_Image | None = None, **kwargs)

Compute the Jacobian matrix for this model.

The Jacobian matrix represents the partial derivatives of the model’s output with respect to its input parameters. It is useful in optimization and model fitting processes. This method simplifies the process of computing the Jacobian matrix for astronomical image models and is primarily used by the Levenberg-Marquardt algorithm for model fitting tasks.

Parameters:
  • parameters (Optional[torch.Tensor]) – A 1D parameter tensor to override the current model’s parameters.

  • as_representation (bool) – Indicates if the parameters argument is provided as real values or representations in the (-inf, inf) range. Default is False.

  • parameters_identity (Optional[tuple]) – Specifies which parameters are to be considered in the computation.

  • window (Optional[Window]) – A window object specifying the region of interest in the image.

  • **kwargs – Additional keyword arguments.

Returns:

A Jacobian_Image object containing the computed Jacobian matrix.

Return type:

Jacobian_Image

jacobian_chunksize = 10
load(filename: str | dict | TextIOBase = 'AstroPhot.yaml', new_name=None)

Used to load the model from a saved state.

Sets the model window to the saved value and updates all parameters with the saved information. This overrides the current parameter settings.

Parameters:

filename – The source from which to load the model parameters. Can be a string (the name of the file on disc), a dictionary (formatted as if from self.get_state), or an io.TextIOBase (a file stream to load the file from).

make_model_image(window: Window | None = None)[source]

This is called to create a blank Model_Image object of the correct format for this model. This is typically used internally to construct the model image before filling the pixel values with the model.

model_integrated = None
model_type = 'psf model'
normalize_psf = True
parameter_specs = {'center': {'locked': True, 'uncertainty': (0.1, 0.1), 'units': 'arcsec', 'value': (0.0, 0.0)}}
radius_metric(X, Y, image=None, parameters=None)
sample(image: Image | None = None, window: Window | None = None, parameters: Parameter_Node | None = None)[source]

Evaluate the model on the space covered by an image object. This function properly calls integration methods. This should not be overloaded except in special cases.

This function is designed to compute the model on a given image or within a specified window. It takes care of sub-pixel sampling, recursive integration for high curvature regions, and proper alignment of the computed model with the original pixel grid. The final model is then added to the requested image.

Parameters:
  • image (Optional[Image]) – An AstroPhot Image object (likely a Model_Image) on which to evaluate the model values. If not provided, a new Model_Image object will be created.

  • window (Optional[Window]) – A window within which to evaluate the model. Should only be used if a subset of the full image is needed. If not provided, the entire image will be used.

Returns:

The image with the computed model values.

Return type:

Image

sampling_mode = 'midpoint'
sampling_tolerance = 0.01
softening = 0.001
special_kwargs = ['parameters', 'filename', 'model_type']
property target
track_attrs = ['sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'softening']
useable = False

astrophot.models.ray_model module

class astrophot.models.ray_model.Ray_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Variant of a galaxy model which defines multiple radial models seprarately along some number of rays projected from the galaxy center. These rays smoothly transition from one to another along angles theta. The ray transition uses a cosine smoothing function which depends on the number of rays, for example with two rays the brightness would be:

I(R,theta) = I1(R)*cos(theta % pi) + I2(R)*cos((theta + pi/2) % pi)

Where I(R,theta) is the brightness function in polar coordinates, R is the semi-major axis, theta is the polar angle (defined after galaxy axis ratio is applied), I1(R) is the first brightness profile, % is the modulo operator, and I2 is the second brightness profile. The ray model defines no extra parameters, though now every model parameter related to the brightness profile gains an extra dimension for the ray number. Also a new input can be given when instantiating the ray model: “rays” which is an integer for the number of rays.

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

model_type = 'ray galaxy model'
polar_model(R, T, image=None, parameters=None)[source]
rays = 2
special_kwargs = ['parameters', 'filename', 'model_type', 'rays']
track_attrs = ['psf_mode', 'psf_convolve_mode', 'psf_subpixel_shift', 'sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'image_chunksize', 'softening', 'rays']
useable = False

astrophot.models.relspline_model module

class astrophot.models.relspline_model.RelSpline_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Basic galaxy model with a spline radial light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:
  • I0 – Central brightness

  • dI (R) – Tensor of brighntess values relative to central brightness, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'relspline galaxy model'
parameter_specs = {'I0': {'units': 'log10(flux/arcsec^2)'}, 'dI(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.relspline_model.RelSpline_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

point source model with a spline radial light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:
  • I0 – Central brightness

  • dI (R) – Tensor of brighntess values relative to central brightness, represented as the log of the brightness divided by pixelscale squared

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'relspline psf model'
parameter_specs = {'I0': {'locked': True, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'dI(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
transform_coordinates(X=None, Y=None, image=None, parameters=None)[source]
useable = True

astrophot.models.sersic_model module

class astrophot.models.sersic_model.Sersic_FourierEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Galaxy

fourier mode perturbations to ellipse galaxy model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic fourier galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_FourierEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Warp

fourier mode perturbations to ellipse galaxy model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic fourier warp galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

basic galaxy model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
total_flux(parameters=None)[source]
total_flux_uncertainty(parameters=None)[source]
useable = True
class astrophot.models.sersic_model.Sersic_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

basic point source model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'sersic psf model'
parameter_specs = {'Ie': {'locked': True, 'uncertainty': 0.0, 'units': 'log10(flux/arcsec^2)', 'value': 0.0}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_Ray(*, filename=None, model_type=None, **kwargs)[source]

Bases: Ray_Galaxy

ray galaxy model with a sersic profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'sersic ray galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
useable = True
class astrophot.models.sersic_model.Sersic_SuperEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Galaxy

super ellipse galaxy model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic superellipse galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Warp

super ellipse warp galaxy model with a sersic profile for the radial light profile. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic superellipse warp galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

warped coordinate galaxy model with a sersic profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'sersic warp galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.sersic_model.Sersic_Wedge(*, filename=None, model_type=None, **kwargs)[source]

Bases: Wedge_Galaxy

wedge galaxy model with a sersic profile for the radial light model. The functional form of the Sersic profile is defined as:

I(R) = Ie * exp(- bn((R/Re)^(1/n) - 1))

where I(R) is the brightness profile as a function of semi-major axis, R is the semi-major axis length, Ie is the brightness as the half light radius, bn is a function of n and is not involved in the fit, Re is the half light radius, and n is the sersic index which controls the shape of the profile.

Parameters:
  • n – Sersic index which controls the shape of the brightness profile

  • Ie – brightness at the half light radius, represented as the log of the brightness divided by pixel scale squared.

  • Re – half light radius

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'sersic wedge galaxy model'
parameter_specs = {'Ie': {'units': 'log10(flux/arcsec^2)'}, 'Re': {'limits': (0, None), 'units': 'arcsec'}, 'n': {'limits': (0.36, 8), 'uncertainty': 0.05, 'units': 'none'}}
useable = True

astrophot.models.sky_model_object module

class astrophot.models.sky_model_object.Sky_Model(*, filename=None, model_type=None, **kwargs)[source]

Bases: Component_Model

prototype class for any sky backgorund model. This simply imposes that the center is a locked parameter, not involved in the fit. Also, a sky model object has no psf mode or integration mode by default since it is intended to change over much larger spatial scales than the psf or pixel size.

property integrate_mode

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

model_type = 'sky model'
parameter_specs = {'center': {'locked': True, 'uncertainty': 0.0, 'units': 'arcsec'}}
property psf_mode

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

useable = False

astrophot.models.spline_model module

class astrophot.models.spline_model.Spline_FourierEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Galaxy

The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline fourier galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.spline_model.Spline_FourierEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: FourierEllipse_Warp

The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline fourier warp galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.spline_model.Spline_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Basic galaxy model with a spline radial light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.spline_model.Spline_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

star model with a spline radial light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

evaluate_model(X=None, Y=None, image=None, parameters=None)

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_integrated = False
model_type = 'spline psf model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
transform_coordinates(X=None, Y=None, image=None, parameters=None)[source]
useable = True
class astrophot.models.spline_model.Spline_Ray(*, filename=None, model_type=None, **kwargs)[source]

Bases: Ray_Galaxy

ray galaxy model with a spline light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – 2D Tensor of brighntess values for each ray, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iradial_model(i, R, image=None, parameters=None)
model_type = 'spline ray galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
useable = True
class astrophot.models.spline_model.Spline_SuperEllipse(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Galaxy

The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline superellipse galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.spline_model.Spline_SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: SuperEllipse_Warp

The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline superellipse warp galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True
class astrophot.models.spline_model.Spline_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

warped coordinate galaxy model with a spline light profile. The light profile is defined as a cubic spline interpolation of the stored brightness values:

I(R) = interp(R, profR, I)

where I(R) is the brightness along the semi-major axis, interp is a cubic spline function, R is the semi-major axis length, profR is a list of radii for the spline, I is a corresponding list of brightnesses at each profR value.

Parameters:

I (R) – Tensor of brighntess values, represented as the log of the brightness divided by pixelscale squared

extend_profile = True
initialize(target=None, parameters=None, **kwargs)

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'spline warp galaxy model'
parameter_specs = {'I(R)': {'units': 'log10(flux/arcsec^2)'}}
radial_model(R, image=None, parameters=None)
useable = True

astrophot.models.superellipse_model module

class astrophot.models.superellipse_model.SuperEllipse_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Expanded galaxy model which includes a superellipse transformation in its radius metric. This allows for the expression of “boxy” and “disky” isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation, especially for early-type galaxies. The functional form for this is:

R = (|X|^C + |Y|^C)^(1/C)

where R is the new distance metric, X Y are the coordiantes, and C is the coefficient for the superellipse. C can take on any value greater than zero where C = 2 is the standard distance metric, 0 < C < 2 creates disky or pointed perturbations to an ellipse, and C > 2 transforms an ellipse to be more boxy.

Parameters:

C0 – superellipse distance metric parameter where C0 = C-2 so that a value of zero is now a standard ellipse.

model_type = 'superellipse galaxy model'
parameter_specs = {'C0': {'limits': (-2, None), 'uncertainty': 0.01, 'units': 'C-2', 'value': 0.0}}
radius_metric(X, Y, image=None, parameters=None)[source]
useable = False
class astrophot.models.superellipse_model.SuperEllipse_Warp(*, filename=None, model_type=None, **kwargs)[source]

Bases: Warp_Galaxy

Expanded warp model which includes a superellipse transformation in its radius metric. This allows for the expression of “boxy” and “disky” isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation, especially for early-type galaxies. The functional form for this is:

R = (|X|^C + |Y|^C)^(1/C)

where R is the new distance metric, X Y are the coordiantes, and C is the coefficient for the superellipse. C can take on any value greater than zero where C = 2 is the standard distance metric, 0 < C < 2 creates disky or pointed perturbations to an ellipse, and C > 2 transforms an ellipse to be more boxy.

Parameters:

C0 – superellipse distance metric parameter where C0 = C-2 so that a value of zero is now a standard ellipse.

model_type = 'superellipse warp galaxy model'
parameter_specs = {'C0': {'limits': (-2, None), 'uncertainty': 0.01, 'units': 'C-2', 'value': 0.0}}
radius_metric(X, Y, image=None, parameters=None)[source]
useable = False

astrophot.models.warp_model module

class astrophot.models.warp_model.Warp_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Galaxy model which includes radially varrying PA and q profiles. This works by warping the cooridnates using the same transform for a global PA/q except applied to each pixel individually. In the limit that PA and q are a constant, this recovers a basic galaxy model with global PA/q. However, a linear PA profile will give a spiral appearance, variations of PA/q profiles can create complex galaxy models. The form of the coordinate transformation looks like:

X, Y = meshgrid(image) R = sqrt(X^2 + Y^2) X’, Y’ = Rot(theta(R), X, Y) Y’’ = Y’ / q(R)

where the definitions are the same as for a regular galaxy model, except now the theta is a function of radius R (before transformation) and the axis ratio q is also a function of radius (before the transformation).

Parameters:
  • q (R) – Tensor of axis ratio values for axis ratio spline

  • PA (R) – Tensor of position angle values as input to the spline

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

model_type = 'warp galaxy model'
parameter_specs = {'PA(R)': {'cyclic': True, 'limits': (0, 3.141592653589793), 'uncertainty': 0.08, 'units': 'rad'}, 'q(R)': {'limits': (0.05, 1), 'uncertainty': 0.04, 'units': 'b/a'}}
transform_coordinates(X, Y, image=None, parameters=None)[source]
useable = False

astrophot.models.wedge_model module

class astrophot.models.wedge_model.Wedge_Galaxy(*, filename=None, model_type=None, **kwargs)[source]

Bases: Galaxy_Model

Variant of the ray model where no smooth transition is performed between regions as a function of theta, instead there is a sharp trnasition boundary. This may be desireable as it cleanly separates where the pixel information is going. Due to the sharp transition though, it may cause unusual behaviour when fitting. If problems occur, try fitting a ray model first then fix the center, PA, and q and then fit the wedge model. Essentially this breaks down the structure fitting and the light profile fitting into two steps. The wedge model, like the ray model, defines no extra parameters, however a new option can be supplied on instantiation of the wedge model which is “wedges” or the number of wedges in the model.

evaluate_model(X=None, Y=None, image=None, parameters=None, **kwargs)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

model_type = 'wedge galaxy model'
polar_model(R, T, image=None, parameters=None)[source]
special_kwargs = ['parameters', 'filename', 'model_type', 'wedges']
track_attrs = ['psf_mode', 'psf_convolve_mode', 'psf_subpixel_shift', 'sampling_mode', 'sampling_tolerance', 'integrate_mode', 'integrate_max_depth', 'integrate_gridding', 'integrate_quad_level', 'jacobian_chunksize', 'image_chunksize', 'softening', 'wedges']
useable = False
wedges = 2

astrophot.models.zernike_model module

class astrophot.models.zernike_model.Zernike_PSF(*, filename=None, model_type=None, **kwargs)[source]

Bases: PSF_Model

Z_n_m(rho, phi, n, m, efficient=True)[source]
static coefficients(n, m)[source]
evaluate_model(X=None, Y=None, image=None, parameters=None)[source]

Evaluate the model on every pixel in the given image. The basemodel object simply returns zeros, this function should be overloaded by subclasses.

Parameters:

image (Image) – The image defining the set of pixels on which to evaluate the model

initialize(target=None, parameters=None, **kwargs)[source]

Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.

Parameters:

target (Optional[Target_Image]) – A target image object to use as a reference when setting parameter values

iter_nm(n)[source]
model_integrated = False
model_type = 'zernike psf model'
parameter_specs = {'Anm': {'units': 'flux/arcsec^2'}}
useable = True

Module contents