scarlet.source

class scarlet.source.CompactExtendedSource(model_frame, sky_coord, observations, shifting=False, resizing=True, boxsize=None)[source]

Bases: FactorizedComponent

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

init_morph(frame, sky_coord[, boxsize])

Initialize a source just like init_extended_morphology, but with the morphology of a point source.

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

static init_morph(frame, sky_coord, boxsize=None)[source]

Initialize a source just like init_extended_morphology, but with the morphology of a point source.

Parameters:
frame: `~scarlet.Frame`

The model frame

sky_coord: tuple

Center of the source

boxsize: int or None

Size of morph box

Returns:
morph, bbox
scarlet.source.ExtendedSource(model_frame, sky_coord, observations, K=1, flux_percentiles=None, thresh=1.0, compact=False, shifting=False, resizing=True, boxsize=None)[source]

Create extended sources with either a single component or multiple components.

If K== 1, a single instance of SingleExtendedSource is returned, otherwise and instance of MultiExtendedSource is returned.

Create multi-component extended source.

Parameters:
model_frame: `~scarlet.Frame`

The frame of the model

sky_coord: tuple

Center of the source

observations: instance or list of `~scarlet.observation.Observation`

Observation(s) to initialize this source.

K: int

Number of stacked components

flux_percentiles: list

Flux percentile of each component as the transition point between components. If pixel value is below the first precentile, it becomes part of the outermost component. If it is above, the percentile value will be subtracted and the remainder attributed to the next component. If flux_percentiles is None then flux_percentiles=[25,].

thresh: `float`

Multiple of the backround RMS used as a flux cutoff for morphology initialization.

shifting: `bool`

Whether or not a subpixel shift is added as optimization parameter

resizingbool

Whether or not to change the size of the source box.

boxsize: int or None

Spatial size of the source box

class scarlet.source.GaussianSource(model_frame, sky_coord, sigma, ellipticity, observations)[source]

Bases: FactorizedComponent

Gassian-shaped source

Their SEDs are initialized from observations at the center pixel.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

class scarlet.source.MultiExtendedSource(model_frame, sky_coord, observations, K=2, flux_percentiles=None, thresh=1.0, shifting=False, resizing=True, boxsize=None)[source]

Bases: CombinedComponent

Extended source with multiple components layered vertically

Uses ~scarlet.ExtendedSource to define the overall morphology, then erodes the outer footprint until it reaches the specified size percentile. For the narrower footprint, it evaluates the mean value at the perimeter and sets the inside to the perimeter value, creating a flat distribution inside. The subsequent component(s) is/are set to the difference between the flattened and the overall morphology. The SED for all components are initialized from the peak pixel, i.e. they are the same.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

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

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

init_morphs

static init_morphs(morphology, flux_percentiles)[source]
class scarlet.source.NullSource(model_frame)[source]

Bases: Component

Source that does nothing

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

parameters

List of parameters, including from the children

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

get_model(*parameters, frame=None)[source]

Get the model for this component.

Parameters:
parameters: tuple of optimimzation parameters
frame: `~scarlet.frame.Frame`

Frame to project the model into. If frame is None then the model contained in bbox is returned.

Returns:
model: array

(Channels, Height, Width) image of the model

class scarlet.source.PointSource(model_frame, sky_coord, observations)[source]

Bases: FactorizedComponent

Point-Source model

Point sources modeled as model_frame.psfs, centered at sky_coord. Their SEDs are taken from observations at the center pixel.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

class scarlet.source.RandomSource(model_frame, observations=None)[source]

Bases: FactorizedComponent

Sources with uniform random morphology and sed.

For cases with no well-defined spatial shape, this source initializes the morphology and the spectrum as a uniform random.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

class scarlet.source.SingleExtendedSource(model_frame, sky_coord, observations, thresh=1.0, shifting=False, resizing=True, boxsize=None)[source]

Bases: FactorizedComponent

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

init_morph(frame, sky_coord, detect, detect_std)

Initialize the source that is symmetric and monotonic See ExtendedSource for a description of the parameters

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

static init_morph(frame, sky_coord, detect, detect_std, thresh=1, symmetric=True, monotonic='flat', min_grad=0, boxsize=None)[source]

Initialize the source that is symmetric and monotonic See ExtendedSource for a description of the parameters

Returns:
morph, bbox
class scarlet.source.SpergelSource(model_frame, sky_coord, nu, rhalf, ellipticity, observations)[source]

Bases: FactorizedComponent

Source based on the Spergel (2010) profile

Their SEDs are initialized from observations at the center pixel.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

class scarlet.source.StarletSource(model_frame, sky_coord=None, observations=None, spectrum=None, thresh=1.0, monotonic=False, starlet_thresh=0.005, boxsize=None)[source]

Bases: FactorizedComponent

Source with a starlet morphology model

Sources are initialized as ~scarlet.ExtendedSource, and the morphology is then transformed into starlet coefficients.

Attributes:
bbox

Hyper-spectral bounding box of this model

children

List of child models

frame

Hyper-spectral characteristics is this model

morphology

Extract the morphology parameter

parameters

List of parameters, including from the children

spectrum

Extract the spectrum parameter.

Methods

check_parameters()

Check that all parameters have finite elements

get_model(*parameters[, frame])

Get the model for this component.

get_models_of_children(*parameters, **kwargs)

Get realization of all child models

get_parameter(i, *parameters)

Access parameters by list index or by name

model_to_box([bbox, model])

Project a model into a frame

update()

Update internal state or configuration of the model

from_source

classmethod from_source(source, monotonic=False, starlet_thresh=0.005)[source]
scarlet.source.append_docs_from(other_func)[source]