lightcurvelynx.effects.effect_model

The base EffectModel class used for all effects.

Classes

EffectModel

A physical or systematic effect to apply to an observation.

Module Contents

class EffectModel(*, rest_frame=True, effect_name=None, **kwargs)[source]

A physical or systematic effect to apply to an observation.

Effects are not ParameterizedNodes but can have arguments that are ParameterizedNodes. These arguments are stored as parameters in the model node (BasePhysicalModel) when add_effect() is called. This allows the effect to easily use existing parameters from the model node as well as new parameters specific to the effect. The model node samples these parameters and passes them in the call to apply().

The EffectModel class is designed to be subclassed, and the subclasses should implement the apply() method to define the specific effect being applied.

rest_frame[source]

Whether the effect is applied in the rest frame of the observation (True) or in the observed frame (False).

Type:

bool

effect_name[source]

The name of the effect for logging and accessing parameters. If no name is provided, the class name is used.

Type:

string

parameters[source]

A dictionary of parameters for the effect. Maps the parameter names to their setters.

Type:

dict

rest_frame = True[source]
effect_name = None[source]
parameters[source]
__str__()[source]
__repr__()[source]
add_effect_parameter(name, setter)[source]

Add a parameter to the effect.

Note

These parameters are automatically added to the corresponding model nodes so they are sampled and recorded with the model’s other parameters.

Parameters:
  • name (str) – The name of the parameter.

  • setter (function) – A function that sets the parameter value.

abstractmethod apply(flux_density, times=None, wavelengths=None, **kwargs)[source]

Apply the effect to observations (flux_density values).

Parameters:
  • flux_density (numpy.ndarray) – A length T X N matrix of flux density values (in nJy).

  • times (numpy.ndarray, optional) – A length T array of times (in MJD).

  • wavelengths (numpy.ndarray, optional) – A length N array of wavelengths (in angstroms).

  • **kwargs (dict, optional) – Any additional keyword arguments, including any additional parameters needed to apply the effect.

Returns:

flux_density – A length T x N matrix of flux densities after the effect is applied (in nJy).

Return type:

numpy.ndarray

abstractmethod apply_bandflux(bandfluxes, *, times=None, filters=None, **kwargs)[source]

Apply the effect to band fluxes.

Parameters:
  • bandfluxes (numpy.ndarray) – A length T array of band fluxes (in nJy).

  • times (numpy.ndarray, optional) – A length T array of times (in MJD).

  • filters (numpy.ndarray, optional) – A length N array of filters. If not provided, the effect is applied to all band fluxes.

  • **kwargs (dict, optional) – Any additional keyword arguments, including any additional parameters needed to apply the effect.

Returns:

bandfluxes – A length T array of band fluxes after the effect is applied (in nJy).

Return type:

numpy.ndarray