scarlet.morphology

class scarlet.morphology.ExtendedSourceMorphology(frame, center, image, bbox=None, monotonic='angle', symmetric=False, min_grad=0, shifting=False, resizing=True)[source]

Bases: ImageMorphology

Attributes:
center
children

List of child models

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

shrink_box

property center
class scarlet.morphology.GaussianMorphology(frame, center, sigma, ellipticity=(0, 0), boxsize=None)[source]

Bases: ProfileMorphology

Morphology from a Gaussian radial profile

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

center: array or `~scarlet.Parameter`

2D center parameter (in units of frame pixels) If it is to be optimized, it needs to be provided as a full defined Parameter.

sigma: float or `~scarlet.Parameter`

Standard deviation of the Gaussian in frame pixels If it is to be optimized, it needs to be provided as a full defined Parameter.

ellipticity: array or ~scarlet.Parameter`

Two-component ellipticity (e1,e2). If it is to be optimized, it needs to be provided as a full defined Parameter.

boxsize: int

Size of bounding box over which to evaluate the function, in frame pixels

Attributes:
children

List of child models

integral
parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

get_box

shrink_box

property integral
class scarlet.morphology.ImageMorphology(frame, image, bbox=None, shifting=False, shift=None, resizing=True)[source]

Bases: Morphology

Morphology from an image

The class uses an arbitrary image as non-parametric model. To allow for subpixel offsets, a Fourier-based shifting transformation is available.

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

image: 2D array or `~scarlet.Parameter`

Image parameter

bbox: `~scarlet.Box`

2D bounding box for focation of the image in frame

shift: None or `~scarlet.Parameter`

2D shift parameter (in units of image pixels)

resizing: bool

Whether to resize the box dynamically

Attributes:
children

List of child models

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

shrink_box

get_model(*parameters)[source]

Get the model realization

Parameters:
parameters: tuple of optimimzation parameters
Returns:
model: array

Realization of the model

update()[source]

Update internal state or configuration of the model

The method is only needed to adjust setting or parameters outside of the optimization forward path.

Raises:
scarlet.model.UpdateException if the optimization needs to be interrupted
class scarlet.morphology.Morphology(frame, *parameters, bbox=None)[source]

Bases: Model

Morphology base class

The class describes the 2D image of the spatial dependence of ~scarlet.FactorizedComponent.

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

parameters: list of `~scarlet.Parameter`
bbox: `~scarlet.Box`

2D bounding box of this model

Attributes:
children

List of child models

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters, **kwargs)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

shrink_box

shrink_box(image, thresh=0)[source]
class scarlet.morphology.PointSourceMorphology(frame, center)[source]

Bases: Morphology

Morphology from a PSF

The class uses frame.psf as model, evaluated at center

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

center: array or `~scarlet.Parameter`

2D center parameter (in units of frame pixels)

Attributes:
children

List of child models

integral
parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

shrink_box

get_model(*parameters)[source]

Get the model realization

Parameters:
parameters: tuple of optimimzation parameters
Returns:
model: array

Realization of the model

property integral
class scarlet.morphology.ProfileMorphology(frame, func, *parameters, boxsize=None, resize=True)[source]

Bases: Morphology

Morphology from a radial profile

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

func:

Radial profile function, signature func(R2, *parameters), where R2 is the squared radius.

parameters: list of `~scarlet.Parameter`

Parameters for the radial profile. Needs to include at least the following: * “radius”: float * “center”: 2D float * “ellipticity”: 2D float

boxsize: int

Size of bounding box over which to evaluate the function, in frame pixels

resizing: bool

Whether to resize the box dynamically

Attributes:
children

List of child models

integral
parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

get_box

shrink_box

get_box(*parameters, boxsize=None)[source]
get_model(*parameters)[source]

Get the model realization

Parameters:
parameters: tuple of optimimzation parameters
Returns:
model: array

Realization of the model

abstract property integral
update()[source]

Update internal state or configuration of the model

The method is only needed to adjust setting or parameters outside of the optimization forward path.

Raises:
scarlet.model.UpdateException if the optimization needs to be interrupted
class scarlet.morphology.SpergelMorphology(frame, center, nu, rhalf, ellipticity=(0, 0), boxsize=None)[source]

Bases: ProfileMorphology

Morphology from a Spergel (2010) radial profile

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

center: array or `~scarlet.Parameter`

2D center parameter (in units of frame pixels) If it is to be optimized, it needs to be provided as a full defined Parameter.

nu: float or `~scarlet.Parameter`

Bessel function order. If it is to be optimized, it needs to be provided as a full defined Parameter.

rhalf: float or `~scarlet.Parameter`

Half-light radius in frame pixels. If it is to be optimized, it needs to be provided as a full defined Parameter.

ellipticity: array or None

Two-component ellipticity (e1,e2) If it is to be optimized, it needs to be provided as a full defined Parameter.

integrate: bool

Whether pixel integration is performed

boxsize: int

Size of bounding box over which to evaluate the function, in frame pixels

Attributes:
children

List of child models

integral
parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

get_box

shrink_box

property integral
class scarlet.morphology.StarletMorphology(frame, image, bbox=None, monotonic=False, threshold=0)[source]

Bases: Morphology

Morphology from a starlet representation of an image

The class uses the starlet parameterization as an overcomplete, non-parametric model.

Parameters:
frame: `~scarlet.Frame`

Characterization of the model

image: 2D array

Initial image to construct starlet transform

bbox: `~scarlet.Box`

2D bounding box for focation of the image in frame

monotonic: bool

Whether to constrain every starlet scale to be monotonic; otherwise they are hard-thresholded by threshold.

threshold: float

Lower bound on threshold for all but the last starlet scale

Attributes:
children

List of child models

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters)

Get the model realization

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

update()

Update internal state or configuration of the model

shrink_box

get_model(*parameters)[source]

Get the model realization

Parameters:
parameters: tuple of optimimzation parameters
Returns:
model: array

Realization of the model

update()[source]

Update internal state or configuration of the model

The method is only needed to adjust setting or parameters outside of the optimization forward path.

Raises:
scarlet.model.UpdateException if the optimization needs to be interrupted