scarlet.component¶
- class scarlet.component.CombinedComponent(components, operation='add')[source]¶
Bases:
Component
Combination of multiple ~scarlet.Component instances
- Parameters:
- components: list of `~scarlet.Component`
- operation: ‘add’ or ‘multiply’
The combination operation of the children’s models
- 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
- class scarlet.component.Component(frame, *parameters, children=None, bbox=None)[source]¶
Bases:
Model
Base class for hyperspectral models given parameters.
The class allows for hierarchical ordering through children.
- Parameters:
- frame: `~scarlet.Frame`
Characterization of the model
- parameters: list of `~scarlet.Parameter`
- children: list of `~scarlet.Model`
Subordinate models.
- bbox: `~scarlet.Box`
Bounding box of this model
- Attributes:
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
model_to_box
([bbox, model])Project a model into a frame
update
()Update internal state or configuration of the model
- property bbox¶
Hyper-spectral bounding box of this model
- property frame¶
Hyper-spectral characteristics is this model
- model_to_box(bbox=None, model=None)[source]¶
Project a model into a frame
- Parameters:
- model: array
Image of the model to project. This must be the same shape as self.bbox. If model is None then self.get_model() is used.
- bbox: `~scarlet.bbox.Box`
The to project the model into. If bbox is None then the model is projected into self.model_frame.bbox.
- Returns:
- projected_model: array
(Channels, Height, Width) image of the model
- class scarlet.component.CubeComponent(frame, cube, bbox=None)[source]¶
Bases:
Component
A single component in a blend
Uses full hyperspectral cube parameterization.
- Parameters:
- frame: `~scarlet.Frame`
The spectral and spatial characteristics of this component.
- cube: `~scarlet.Parameter`
3D array (C, Height, Width) of the hyperspectral cube.
- bbox: `~scarlet.Box`
Hyper-spectral bounding box of this component.
- 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
- class scarlet.component.FactorizedComponent(frame, spectrum, morphology)[source]¶
Bases:
Component
A single component in a blend
Uses the non-parametric factorization Spectrum x Morphology.
- Parameters:
- frame: `~scarlet.Frame`
The spectral and spatial characteristics of the full model.
- bbox: `~scarlet.Box`
Hyper-spectral bounding box of this component.
- spectrum: `~scarlet.Spectrum`
Parameterization of the spectrum
- morphology: `~scarlet.Morphology`
Parameterization of the morphology.
- 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
- 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
- property morphology¶
Extract the morphology parameter
- property spectrum¶
Extract the spectrum parameter.