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:
- 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, andcomments.
- Returns:
A scene with a file-backed source spectrum.
- Return type:
- 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.
- update(reset=False, **kwargs)[source]
Update scene elements using double-underscore prefixed keywords.
- get_mag(area=None, which='*', as_dict=False)[source]
Get magnitude for specified scene elements.
- Parameters:
- Returns:
The magnitudes.
- Return type:
- 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:
- 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:
- 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:
- 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.