TransientArraySpectrum#

class scarlet2.TransientArraySpectrum(data, epochs=None, epoch_selector=<function TransientArraySpectrum.<lambda>>)[source]#

Bases: Spectrum

Variable source in a transient scene with possible quiescent periods

In the frames of transient scenes, the attribute channels are overloaded and defined with a spectral and a temporal component, e.g. channel = (band, epoch). This class is for models that vary in time, especially if they have periods of inactivity. The length of data is given by the number channels in the model frame, but during inactive epochs, the emission is set to zero.

Parameters:
  • data (array) – Spectrum array. Contains as many elements as there are spectro-temporal channels in the model.

  • epochs (list, array, optional) – List of temporal “epoch” identifiers for the active phases of the source.

  • epoch_selector (callable, optional) – Identify the temporal “epoch” component from the name/ID used in the channels of the model frame

Examples

>>> # model channels: [('G',0),('G',1),('R',0),('R',1),('R',2)]
>>> spectrum = jnp.ones(5)
>>> epochs = [0, 1]
>>> epoch_selector = lambda channel: channel[1]
>>> TransientArraySpectrum(spectrum, epochs, epoch_selector=epoch_selector)

This sets the spectrum to active during epochs 0 and 1, and mask the spectrum element for (‘R’,2) with zero.

__call__()[source]#

What to run when the TransientArraySpectrum is called

data: array#

Data to describe the variable spectrum.

The length of this vector is identical to the number of channels in the model frame.

epochs: list#

Identifier for the list of active epochs. If set to None, all epochs are considered active

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

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:

Module

property shape#

The shape of the spectrum data