Scenes (wcc_etc.scene)

wcc_etc.scene.get_scene(name, mag, host=None, host_prop={}, background='zodi', background_prop={}, **kwargs)[source]

Get a Scene object with a source, an optional host, and an optional background.

Parameters:
  • name (str) – Name of the source spectrum.

  • mag (float) – Magnitude of the source.

  • host (str, optional) – Name of the host spectrum. Default is None.

  • host_prop (dict, optional) – Properties for the host spectrum. Default is {}.

  • background (str, optional) – Name of the background spectrum. Default is “zodi”.

  • background_prop (dict, optional) – Properties for the background spectrum. Default is {}.

  • **kwargs – Additional keyword arguments passed to get_scene_element for the source.

Returns:

The initialized Scene object.

Return type:

Scene

wcc_etc.scene.get_scene_from_file(source_file, mag=None, wave_column=0, flux_column=1, wave_unit='AA', flux_unit='FLAM', host=None, host_prop=None, background='zodi', background_prop=None, **kwargs)[source]

Build a Scene whose source spectrum is read from a wavelength/flux file.

Parameters:
  • source_file (str) – Path to a text file containing wavelength and flux columns.

  • mag (float or None, optional) – Magnitude used to normalize the source. If None, the file’s absolute flux is preserved.

  • wave_column (int or str, optional) – Wavelength and flux columns. String columns require a named table or names=True.

  • flux_column (int or str, optional) – Wavelength and flux columns. String columns require a named table or names=True.

  • wave_unit (str or Unit, optional) – Units for the wavelength and flux columns. Defaults are Angstrom and FLAM.

  • flux_unit (str or Unit, optional) – Units for the wavelength and flux columns. Defaults are Angstrom and FLAM.

  • **kwargs – Additional keyword arguments passed to get_scene. Useful file-reading options include delimiter, names, and comments.

Returns:

A scene with a file-backed source spectrum.

Return type:

Scene

wcc_etc.scene.get_scene_element(element=None, **kwargs)[source]

Generic top level function to instanciate a scene element.

Parameters:
  • element (str, dict, or None, optional) – Flexible variable to help instantiating a scene element. - If str: name of a specific pre-defined entry, like ‘zodi’. - If dict: configuration that will supersede default config. It overrides kwargs entries. - If None: not used, all rely on kwargs. Example equivalent calls: - get_scene_element(“G5IV”, mag=20) - get_scene_element({“name”: “G5IV”, “mag”: 20}) - get_scene_element(name=”G5IV”, mag=20)

  • **kwargs – Configuration parameters used as SceneElement.from_config(kwargs).

Returns:

The loaded scene element.

Return type:

SceneElement

class wcc_etc.scene.Scene(source=None, host=None, background=None, meta={})[source]

Bases: _MetaHolder_

A collection of SceneElements (source, host, background) representing a full observation scene.

Variables:
  • source (SceneElement) – The main source of interest.

  • host (SceneElement) – The host galaxy or environment.

  • background (SceneElement) – The sky background.

classmethod from_config(config)[source]

Create a Scene from a configuration dictionary.

Parameters:

config (dict) – Configuration dictionary containing ‘source’, ‘host’, and ‘background’ keys, each being a configuration for SceneElement.from_config.

Returns:

The initialized Scene.

Return type:

Scene

reset()[source]

Reset each element in the scene.

update(reset=False, **kwargs)[source]

Update scene elements using double-underscore prefixed keywords.

Parameters:
  • reset (bool, optional) – Not currently used. Default is False.

  • **kwargs – Keywords like ‘source__mag=20’ or ‘background__mag=22’.

Returns:

List of updated keys.

Return type:

list

get_elements(which='*', as_dict=False)[source]

Get specified scene elements.

Parameters:
  • which (str or list, optional) – Which elements to get (‘*’, ‘all’, ‘source’, ‘host’, ‘background’). Default is “*”.

  • as_dict (bool, optional) – Whether to return elements as a dictionary. Default is False.

Returns:

The requested scene elements.

Return type:

list or dict

get_mag(area=None, which='*', as_dict=False)[source]

Get magnitude for specified scene elements.

Parameters:
  • area (float or Quantity, optional) – The area for surface brightness normalization. Default is None.

  • which (str or list, optional) – Which elements to get magnitudes for. Default is “*”.

  • as_dict (bool, optional) – Whether to return as a dictionary. Default is False.

Returns:

The magnitudes.

Return type:

list or dict

get_spectrum(area=None, apply_mag=True, which='*', as_dict=False)[source]

Get spectrum for specified scene elements.

Parameters:
  • area (float or Quantity, optional) – The area for surface brightness normalization. Default is None.

  • apply_mag (bool, optional) – Whether to normalize the spectrum. Default is True.

  • which (str or list, optional) – Which elements to get spectra for. Default is “*”.

  • as_dict (bool, optional) – Whether to return as a dictionary. Default is False.

Returns:

The spectra.

Return type:

list or dict

get_observation(band=None, area=None, which='*', as_dict=False)[source]

Get observation for specified scene elements.

Parameters:
  • band (SpectralElement, optional) – The bandpass filter. Default is None.

  • area (float or Quantity, optional) – The area for surface brightness normalization. Default is None.

  • which (str or list, optional) – Which elements to get observations for. Default is “*”.

  • as_dict (bool, optional) – Whether to return as a dictionary. Default is False.

Returns:

The observations.

Return type:

list or dict

has_source()[source]

Check if the scene has a source element.

Return type:

bool

has_host()[source]

Check if the scene has a host element.

Return type:

bool

has_background()[source]

Check if the scene has a background element.

Return type:

bool

call_down(what, mapargs=None, allow_call=True, which='*', as_dict=False, **kwargs)[source]

Call a method on each target element in the collection.

Parameters:
  • what (str) – The name of the attribute or method to access on each element.

  • mapargs (array_like, optional) – Positional arguments to be mapped to each element call. Default is None.

  • allow_call (bool, optional) – If True and the attribute is callable, call it. Default is True.

  • which (str or list, optional) – Which elements to include. Default is “*”.

  • as_dict (bool, optional) – Whether to return results as a dictionary. Default is False.

  • **kwargs – Keyword arguments passed to the method call.

Returns:

The results from each element.

Return type:

list or dict

property source

The source SceneElement.

property host

The host SceneElement.

property background

The background SceneElement.

property element_names

Names of the potential elements in a scene.

property meta

Combined metadata for the scene and its elements.

property mutable_parameters

List of parameters that can be updated.