lsst.scarlet.lite ge1c02a5578+b0138be388
 
Loading...
Searching...
No Matches
lsst.scarlet.lite.component.FactorizedComponent Class Reference
Inheritance diagram for lsst.scarlet.lite.component.FactorizedComponent:
lsst.scarlet.lite.component.Component lsst.scarlet.lite.models.free_form.FactorizedFreeFormComponent

Public Member Functions

 __init__ (self, tuple bands, Parameter|np.ndarray spectrum, Parameter|np.ndarray morph, Box bbox, tuple[int, int]|None peak=None, np.ndarray|None bg_rms=None, float|None bg_thresh=0.25, float floor=1e-20, Monotonicity|None monotonicity=None, int padding=5, bool is_symmetric=False)
 
tuple[int, int]|None peak (self)
 
tuple[int, int]|None component_center (self)
 
np.ndarray spectrum (self)
 
np.ndarray morph (self)
 
tuple shape (self)
 
Image get_model (self)
 
 grad_spectrum (self, np.ndarray input_grad, np.ndarray spectrum, np.ndarray morph)
 
 grad_morph (self, np.ndarray input_grad, np.ndarray morph, np.ndarray spectrum)
 
np.ndarray prox_spectrum (self, np.ndarray spectrum)
 
np.ndarray prox_morph (self, np.ndarray morph)
 
bool resize (self, Box model_box)
 
 update (self, int it, np.ndarray input_grad)
 
None parameterize (self, Callable parameterization)
 
ScarletComponentBaseData to_data (self)
 
 __str__ (self)
 
 __repr__ (self)
 
FactorizedComponent __getitem__ (self, Any indices)
 
FactorizedComponent __deepcopy__ (self, dict[int, Any] memo)
 
FactorizedComponent __copy__ (self)
 
- Public Member Functions inherited from lsst.scarlet.lite.component.Component
 __init__ (self, tuple bands, Box bbox)
 
Box bbox (self)
 
tuple bands (self)
 
Component __getitem__ (self, Any indices)
 
Component __copy__ (self)
 
Component __deepcopy__ (self, dict[int, Any] memo)
 
Component copy (self, bool deep=False)
 

Public Attributes

 bg_rms = bg_rms
 
 bg_thresh = bg_thresh
 
 floor = floor
 
 monotonicity = monotonicity
 
 padding = padding
 
 is_symmetric = is_symmetric
 
 morph
 

Protected Attributes

 _spectrum = parameter(spectrum)
 
 _morph = parameter(morph)
 
tuple[int, int]|None _peak = peak
 
- Protected Attributes inherited from lsst.scarlet.lite.component.Component
tuple _bands = bands
 
Box _bbox = bbox
 

Detailed Description

A component that can be factorized into spectrum and morphology
parameters.

Parameters
----------
bands:
    The bands of the spectral dimension, in order.
spectrum:
    The parameter to store and update the spectrum.
morph:
    The parameter to store and update the morphology.
peak:
    Location of the peak for the source.
bbox:
    The `Box` in the `model_bbox` that contains the source.
bg_rms:
    The RMS of the background used to threshold, grow,
    and shrink the component.
bg_thresh:
    The threshold to use for the background RMS.
    If `None`, no background thresholding is applied, otherwise
    a sparsity constraint is applied to the morpholigy that
    requires flux in at least one band to be bg_thresh multiplied by
    `bg_rms` in that band.
floor:
    Minimum value of the spectrum or center morphology pixel
    (depending on which is normalized).
monotonicity:
    The monotonicity operator to use for making the source monotonic.
    If this parameter is `None`, the source will not be made monotonic.
padding:
    The amount of padding to add to the component bounding box
    when resizing the component.
is_symmetric:
    Whether the component is symmetric or not.
    If `True`, the morphology will be symmetrized using
    `prox_uncentered_symmetry`.
    If `False`, the morphology will not be symmetrized.

Member Function Documentation

◆ __copy__()

FactorizedComponent lsst.scarlet.lite.component.FactorizedComponent.__copy__ ( self)
Create a copy of this component.

Returns
-------
component : FactorizedComponent
    A new component that is a shallow copy of this one.

◆ __deepcopy__()

FactorizedComponent lsst.scarlet.lite.component.FactorizedComponent.__deepcopy__ ( self,
dict[int, Any] memo )
Create a deep copy of this component.

Parameters
----------
memo: dict[int, Any]
    The memoization dictionary used by `copy.deepcopy`.

Returns
-------
component : FactorizedComponent
    A new component that is a deep copy of this one.

◆ __getitem__()

FactorizedComponent lsst.scarlet.lite.component.FactorizedComponent.__getitem__ ( self,
Any indices )
Get a sub-component corresponding to the given indices.

Parameters
----------
indices: Any
    The indices to use to slice the component model.

Returns
-------
component: FactorizedComponent
    A new component that is a sub-component of this one.

Raises
------
IndexError :
    If the index includes a ``Box`` or spatial indices.

◆ component_center()

tuple[int, int] | None lsst.scarlet.lite.component.FactorizedComponent.component_center ( self)
The center of the component in its bounding box

This is likely to be different than `Component.center`,
since `Component.center` is the center of the component in the
full model, whereas `component_center` is the center of the component
inside its bounding box.

Returns
-------
center:
    The center of the component in its bounding box

◆ get_model()

Image lsst.scarlet.lite.component.FactorizedComponent.get_model ( self)
Build the model from the spectrum and morphology

Reimplemented from lsst.scarlet.lite.component.Component.

◆ grad_morph()

lsst.scarlet.lite.component.FactorizedComponent.grad_morph ( self,
np.ndarray input_grad,
np.ndarray morph,
np.ndarray spectrum )
Gradient of the morph wrt. the component model

◆ grad_spectrum()

lsst.scarlet.lite.component.FactorizedComponent.grad_spectrum ( self,
np.ndarray input_grad,
np.ndarray spectrum,
np.ndarray morph )
Gradient of the spectrum wrt. the component model

◆ morph()

np.ndarray lsst.scarlet.lite.component.FactorizedComponent.morph ( self)
The array of morphology values

◆ parameterize()

None lsst.scarlet.lite.component.FactorizedComponent.parameterize ( self,
Callable parameterization )
Convert the component parameter arrays into Parameter instances

Parameters
----------
parameterization: Callable
    A function to use to convert parameters of a given type into
    a `Parameter` in place. It should take a single argument that
    is the `Component` or `Source` that is to be parameterized.

Reimplemented from lsst.scarlet.lite.component.Component.

◆ peak()

tuple[int, int] | None lsst.scarlet.lite.component.FactorizedComponent.peak ( self)
The peak of the component

Returns
-------
peak:
    The peak of the component

◆ prox_morph()

np.ndarray lsst.scarlet.lite.component.FactorizedComponent.prox_morph ( self,
np.ndarray morph )
Apply a prox-like update to the morphology

Reimplemented in lsst.scarlet.lite.models.free_form.FactorizedFreeFormComponent.

◆ prox_spectrum()

np.ndarray lsst.scarlet.lite.component.FactorizedComponent.prox_spectrum ( self,
np.ndarray spectrum )
Apply a prox-like update to the spectrum

Reimplemented in lsst.scarlet.lite.models.free_form.FactorizedFreeFormComponent.

◆ resize()

bool lsst.scarlet.lite.component.FactorizedComponent.resize ( self,
Box model_box )
Test whether or not the component needs to be resized

Reimplemented from lsst.scarlet.lite.component.Component.

Reimplemented in lsst.scarlet.lite.models.free_form.FactorizedFreeFormComponent.

◆ shape()

tuple lsst.scarlet.lite.component.FactorizedComponent.shape ( self)
Shape of the resulting model image

◆ spectrum()

np.ndarray lsst.scarlet.lite.component.FactorizedComponent.spectrum ( self)
The array of spectrum values

◆ to_data()

ScarletComponentBaseData lsst.scarlet.lite.component.FactorizedComponent.to_data ( self)
Convert the component to persistable ScarletComponentBaseData

Returns
-------
component_data: ScarletComponentBaseData
    The data object containing the component information

Reimplemented from lsst.scarlet.lite.component.Component.

◆ update()

lsst.scarlet.lite.component.FactorizedComponent.update ( self,
int it,
np.ndarray input_grad )
Update the spectrum and morphology parameters

Reimplemented from lsst.scarlet.lite.component.Component.


The documentation for this class was generated from the following file: