lsst.scarlet.lite ge1c02a5578+afb4790f61
 
Loading...
Searching...
No Matches
lsst.scarlet.lite.models.parametric.ParametricComponent Class Reference
Inheritance diagram for lsst.scarlet.lite.models.parametric.ParametricComponent:
lsst.scarlet.lite.component.Component lsst.scarlet.lite.models.parametric.EllipticalParametricComponent

Public Member Functions

 __init__ (self, tuple bands, Box bbox, Parameter|np.ndarray spectrum, Parameter|np.ndarray morph_params, Callable morph_func, Callable morph_grad, Callable morph_prox, Callable|np.ndarray morph_step, Callable|None prox_spectrum=None, float floor=1e-20)
 
tuple[float, float] peak (self)
 
float y0 (self)
 
float x0 (self)
 
np.ndarray spectrum (self)
 
CartesianFrame frame (self)
 
np.ndarray radial_params (self)
 
np.ndarray morph (self, CartesianFrame|None frame=None)
 
Callable prox_morph (self)
 
Callable grad_morph (self)
 
Callable morph_step (self)
 
Image get_model (self, CartesianFrame|None frame=None)
 
np.ndarray prox_spectrum (self, np.ndarray spectrum)
 
np.ndarray grad_spectrum (self, np.ndarray input_grad, np.ndarray spectrum, np.ndarray morph)
 
 update (self, int it, np.ndarray input_grad)
 
bool resize (self, Box model_box)
 
None parameterize (self, Callable parameterization)
 
ScarletComponentBaseData to_data (self)
 
ParametricComponent __getitem__ (self, Any indices)
 
ParametricComponent __deepcopy__ (self, dict[int, Any] memo)
 
ParametricComponent __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

 floor = floor
 
 y0
 
 radial_params
 
 frame
 

Protected Member Functions

np.ndarray _get_morph (self, CartesianFrame|None frame=None)
 

Protected Attributes

 _spectrum = parameter(spectrum)
 
 _params = parameter(morph_params)
 
 _func = morph_func
 
 _morph_grad = morph_grad
 
 _morph_prox = morph_prox
 
Callable _morph_step = morph_step
 
Callable _prox_spectrum = self.prox_spectrum
 
- Protected Attributes inherited from lsst.scarlet.lite.component.Component
tuple _bands = bands
 
Box _bbox = bbox
 

Detailed Description

A parametric model of an astrophysical source

Parameters
----------
bands:
    The bands used in the model.
bbox:
    The bounding box that holds the model.
spectrum:
    The spectrum of the component.
morph_params:
    The parameters of the morphology.
morph_func:
    The function to generate the 2D morphology image
    based on `morphParams`.
morph_grad:
    The function to calculate the gradient of the
    likelihood wrt the morphological parameters.
morph_prox:
    The proximal operator for the morphology parameters.
morph_step:
    The function that calculates the gradient of the
    morphological model.
prox_spectrum:
    Proximal operator for the spectrum.
    If `prox_spectrum` is `None` then the default proximal
    operator `self.prox_spectrum` is used.
floor:
    The minimum value of the spectrum, used to prevent
    divergences in the gradients.

Member Function Documentation

◆ __copy__()

ParametricComponent lsst.scarlet.lite.models.parametric.ParametricComponent.__copy__ ( self)
Create a copy of this component

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

◆ __deepcopy__()

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

Parameters
----------
memo:
    The memoization dictionary used by `copy.deepcopy`.
Returns
-------
component : ParametricComponent
    A new component that is a deep copy of this one.

◆ __getitem__()

ParametricComponent lsst.scarlet.lite.models.parametric.ParametricComponent.__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: ParametricComponent
    A new component that is a sub-component of this one.

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

◆ _get_morph()

np.ndarray lsst.scarlet.lite.models.parametric.ParametricComponent._get_morph ( self,
CartesianFrame | None frame = None )
protected
The 2D image of the morphology

This callable generates an image of the morphology
in the given frame.

Parameters
----------
frame:
    The frame (bounding box, pixel grid) that the image is
    placed in.

Returns
-------
result:
    The image of the morphology in the `frame`.

◆ frame()

CartesianFrame lsst.scarlet.lite.models.parametric.ParametricComponent.frame ( self)
The coordinate system that contains the model

Reimplemented in lsst.scarlet.lite.models.parametric.EllipticalParametricComponent.

◆ get_model()

Image lsst.scarlet.lite.models.parametric.ParametricComponent.get_model ( self,
CartesianFrame | None frame = None )
Generate the full model for this component

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

◆ grad_morph()

Callable lsst.scarlet.lite.models.parametric.ParametricComponent.grad_morph ( self)
The function that calculates the gradient of the
morphological model

◆ grad_spectrum()

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

Parameters
----------
input_grad:
    Gradient of the likelihood wrt the component model
spectrum:
    The model of the spectrum.
morph:
    The model of the morphology.

Returns
-------
result:
    The gradient of the likelihood wrt. the spectrum.

◆ morph()

np.ndarray lsst.scarlet.lite.models.parametric.ParametricComponent.morph ( self,
CartesianFrame | None frame = None )
The morphological model

◆ morph_step()

Callable lsst.scarlet.lite.models.parametric.ParametricComponent.morph_step ( self)
The function that calculates the gradient of the
morphological model

◆ parameterize()

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

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

◆ peak()

tuple[float, float] lsst.scarlet.lite.models.parametric.ParametricComponent.peak ( self)
The center of the component

◆ prox_morph()

Callable lsst.scarlet.lite.models.parametric.ParametricComponent.prox_morph ( self)
The function used to constrain the morphological model

◆ prox_spectrum()

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

Parameters
----------
spectrum:
    The spectrum of the model.

◆ radial_params()

np.ndarray lsst.scarlet.lite.models.parametric.ParametricComponent.radial_params ( self)
The parameters used to model the radial function

Reimplemented in lsst.scarlet.lite.models.parametric.EllipticalParametricComponent.

◆ resize()

bool lsst.scarlet.lite.models.parametric.ParametricComponent.resize ( self,
Box model_box )
Resize the box that contains the model

Not yet implemented, so for now the model box
does not grow. If this is ever implemented in production,
in the long run this will be based on a cutoff value for the model.

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

◆ spectrum()

np.ndarray lsst.scarlet.lite.models.parametric.ParametricComponent.spectrum ( self)
The array of spectrum values

◆ to_data()

ScarletComponentBaseData lsst.scarlet.lite.models.parametric.ParametricComponent.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.models.parametric.ParametricComponent.update ( self,
int it,
np.ndarray input_grad )
Update the component parameters from an input gradient

Parameters
----------
it:
    The current iteration of the optimizer.
input_grad:
    Gradient of the likelihood wrt the component model

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

Reimplemented in lsst.scarlet.lite.models.parametric.EllipticalParametricComponent.

◆ x0()

float lsst.scarlet.lite.models.parametric.ParametricComponent.x0 ( self)
The x-center of the component

◆ y0()

float lsst.scarlet.lite.models.parametric.ParametricComponent.y0 ( self)
The y-center of the component

Member Data Documentation

◆ frame

lsst.scarlet.lite.models.parametric.ParametricComponent.frame

◆ radial_params

lsst.scarlet.lite.models.parametric.ParametricComponent.radial_params

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