scarlet.blend¶
- class scarlet.blend.Blend(sources, observations)[source]¶
Bases:
CombinedComponent
The blended scene
The class represents a scene as collection of and provides the functions to fit it to data.
- Attributes:
bbox
Bounding box of the blend
children
List of child models
frame
Hyper-spectral characteristics is this model
log_likelihood
Log likelihood at each iteration
parameters
List of parameters, including from the children
Methods
check_parameters
()Check that all parameters have finite elements
fit
([max_iter, e_rel, min_iter, noise_factor])Fit the model for each source to the data
get_model
(*parameters[, frame])Get the model of the entire blend
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
- property bbox¶
Bounding box of the blend
- fit(max_iter=200, e_rel=0.001, min_iter=1, noise_factor=0, **alg_kwargs)[source]¶
Fit the model for each source to the data
- Parameters:
- max_iter: int
Maximum number of iterations if the algorithm doesn’t converge
- e_rel: float
Relative error for convergence of the loss function
- min_iter: int
Maximum number of iterations if the algorithm doesn’t converge
- alg_kwargs: dict
Keywords for the proxmin.adaprox optimizer
- get_model(*parameters, frame=None)[source]¶
Get the model of the entire blend
- Parameters:
- parameters: tuple of optimization parameters
- frame: `scarlet.Frame`
Alternative Frame to project the model into
- Returns:
- model: array
(Bands, Height, Width) data cube
- property log_likelihood¶
Log likelihood at each iteration
The fitting method computes and sums the negative log-likelihood for the each observation given the current model as loss function for the optimization.
- Returns:
- log_likelihood: array of (positive) log-likelihood