Source#
- class scarlet2.Source(center, spectrum, morphology)[source]#
Bases:
ComponentSource model
The class is the basic parameterization for sources in
Scene.- Parameters:
center (
array,astropy.coordinates.SkyCoord) – Center position. If given as astropy sky coordinate, it will be transformed with the WCS of the model frame.spectrum (
array,Spectrum) – The spectrum of the source.morphology (
array,Morphology) – The morphology of the source.
Examples
A source declaration is restricted to a context of a
Scene, which defines theFrameof the entire model.>>> with Scene(model_frame) as scene: >>> source = Source(center, spectrum, morphology)
A source can comprise one or multiple
Component, which can be added byadd_component()or operators += (for an additive component) or *= (for a multiplicative component).>>> with Scene(model_frame) as scene: >>> source = Source(center, spectrum, morphology) >>> source *= DustComponent(center, dust_spectrum, dust_morphology)
- add_component(component, op)[source]#
Add component to this source
- Parameters:
component (
Component) – The component to include in this source. It will be combined with the previous component according to the operator op.op (
callable) – Operator to combine this component with those before it in the listcomponents. Conventional operators from theoperatorpackage can be used. Signature: op(x,y) -> z, where all terms have the same shapes
- center: jnp.ndarray#
Center position, in pixel coordinates of the model frame
- component_ops: list#
List of operators to combine components for the final model
- components: list#
List of components in this source
- get(name=None)#
Get parameter(s) from this module
- Parameters:
name (
str, optional) – Name of parameter. If not set, returns all parameters.- Returns:
requested data arrays for parameters
- Return type:
dict
- morphology: jnp.array, Morphology#
Morphology model
- property parameters#
Parameters defined for this module
- Returns:
name: (node, param) mapping for all parameters
- Return type:
dict
- set(values)#
Set parameter(s) from this module with values
- Parameters:
values (
dict[str,jnp.array]) – values to replace parameters with, identified by their name- Returns:
new module with parameter(s) replaced by values
- Return type: