LsstBlend

class lsst.meas.extensions.scarlet.LsstBlend(sources, observations)

Bases: scarlet.blend.Blend

LSST Blend of sources

It is possible that LSST blends might require different funtionality than those in scarlet, which is being designed for multiresolution blends. So this class exists for any LSST specific changes.

Attributes Summary

K Number of components.
components Flattened tuple of all components in the tree.
coord The coordinate in tree.
frame Frame of the components.
n_components Number of components.
n_sources Number of initial sources or components.
parameters The list of non-fixed parameters
sources Initial list of components or sources that generate the tree.

Methods Summary

check_parameters() Check the all parameters have finite elements
fit([max_iter, e_rel, f_rel]) Fit the model for each source to the data
freeze() Fix all parameters
get_model(*params) Get the model of this component tree
set_frame(frame) Set the frame for all components in the tree
unfreeze() Release all parameters

Attributes Documentation

K

Number of components.

components

Flattened tuple of all components in the tree.

CAUTION: Each component in a tree can only be a leaf of a single node. While one can construct trees that hold the same component multiple times, this method will only return that component at its first encountered location

coord

The coordinate in tree.

The coordinate can be used to traverse the tree and for __getitem__.

frame

Frame of the components.

n_components

Number of components.

n_sources

Number of initial sources or components.

This can be different than self.n_components because sources can have multiple components.

Returns:
int: number of initial sources
parameters

The list of non-fixed parameters

Returns:
list of parameters available for optimization
If `parameter.fixed == True`, the parameter will not returned here.
sources

Initial list of components or sources that generate the tree.

This can be different than self.components because sources can have multiple components.

Returns:
The arguments of `__init__`

Methods Documentation

check_parameters()

Check the all parameters have finite elements

Raises:
`ArithmeticError`
fit(max_iter=200, e_rel=0.001, f_rel=0.0001, **alg_kwargs)

Fit the model for each source to the data

Note that two convergence criteria are specified:

  • e_rel for the change of the norm of each parameter between two iterations
  • f_rel for the change of the loss function
Parameters:
max_iter: int

Maximum number of iterations if the algorithm doesn’t converge

e_rel: float

Relative error for parameter convergence

f_rel: float

Relative error for functional convergence of the loss

alg_kwargs: dict

Keywords for the proxmin.adaprox optimizer

freeze()

Fix all parameters

The tree will not provide optimizable parameters anymore.

get_model(*params)

Get the model of this component tree

Parameters:
params: tuple of optimization parameters
Returns:
model: array

(Bands, Height, Width) data cube

set_frame(frame)

Set the frame for all components in the tree

see set_frame for details.

Parameters:
frame: `~scarlet.Frame`

Frame to adopt for this component

unfreeze()

Release all parameters

The tree will provide all parameters as optimizable parameters. Calling this function overrides previous setting of parameter.fixed for every parameter of this component tree.