I/O and configuration (wcc_etc.io)

wcc_etc.io.read_config(filename, source='config')[source]

Read a single configuration file.

  • If the input filename does not specifically include a path, it will be looked for in the default PACKAGE_PATH directory.

  • Currently, only .toml configuration files are supported.

Parameters:
  • filename (str or dict) – Filename of the configuration file or a dictionary (returned as is). If no extension is provided, .toml is assumed.

  • source (str, optional) – The directory where the file is supposed to be stored (e.g., “config”). Used if the filename is not a full path. Default is “config”.

Returns:

Configuration as a nested dictionary.

Return type:

dict

Raises:
  • ValueError – If no extension is associated with the given filename.

  • NotImplementedError – If the configuration file extension is not supported.

wcc_etc.io.get_sensor_config(kind, band, gain_mode=None, **kwargs)[source]

Get sensor configuration for a specific detector kind and band.

Parameters:
  • kind (str) – The kind of sensor (e.g., ‘zwo’, ‘qcmos’, ‘sony’, ‘imx’).

  • band (str) – The observation band (e.g., ‘bb’, ‘u’, ‘g’, ‘r’, ‘i’, ‘z’).

  • gain_mode (str, optional) – Gain mode for detectors that have several (qCMOS: ‘high’ or ‘low’). None keeps the config default.

  • **kwargs – Additional keyword arguments to override or add to the configuration.

Returns:

The combined configuration dictionary.

Return type:

dict

Raises:
  • ValueError – If the specified band is not available for the sensor kind.

  • NotImplementedError – If the throughput curve for the specified band is not yet implemented.

wcc_etc.io.resolve_bandpass(bandpass)[source]

Resolve a bandpass to a synphot SpectralElement.

'johnson_v' and the SDSS filters ('sdss_u' … 'sdss_z'; case-insensitive) are loaded from package data, so no network access is needed. Any other string defers to synphot’s built-in SpectralElement.from_filter. A SpectralElement is returned unchanged.

Parameters:

bandpass (str or SpectralElement) – The bandpass name or object.

Return type:

synphot.SpectralElement

wcc_etc.io.VEGA_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/schmidt-observatories-wcc-etc/checkouts/latest/src/wcc_etc/data/astrophysics/alpha_lyr_stis_011.fits'

Bundled CALSPEC Vega (alpha_lyr_stis_011), the VEGAMAG zero-point spectrum.

wcc_etc.io.SENSORFILTER_FOCUS: dict = {'qcmos:bb': '0wave', 'qcmos:g': '0wave', 'qcmos:i': '0wave', 'qcmos:u': '0wave', 'qcmos:z': '0wave', 'zwo:bb': '0wave', 'zwo:bb2': '2wave', 'zwo:g': '0wave', 'zwo:halpha2': '0wave', 'zwo:halpha20': '0wave', 'zwo:halpha6': '0wave', 'zwo:hbeta': '0wave', 'zwo:heii': '0wave', 'zwo:i': '0wave', 'zwo:r': '0wave', 'zwo:r+1': '1wave', 'zwo:r-1': '1wave', 'zwo:u': '0wave', 'zwo:z': '0wave'}

Focus level ("0wave", "1wave", "2wave") of every sensor:filter label in sensor_info, e.g. SENSORFILTER_FOCUS["zwo:r+1"] == "1wave".

wcc_etc.io.SENSORFILTER_IMPLEMENTED: dict = {'qcmos:bb': True, 'qcmos:g': True, 'qcmos:i': True, 'qcmos:u': True, 'qcmos:z': True, 'zwo:bb': True, 'zwo:bb2': True, 'zwo:g': True, 'zwo:halpha2': True, 'zwo:halpha20': True, 'zwo:halpha6': True, 'zwo:hbeta': False, 'zwo:heii': False, 'zwo:i': True, 'zwo:r': True, 'zwo:r+1': True, 'zwo:r-1': True, 'zwo:u': True, 'zwo:z': True}

Whether a throughput curve is bundled for every sensor:filter label.

wcc_etc.io.KIND_NAMES = {'imx': 'zwo', 'imx455': 'zwo', 'sony': 'zwo'}

Detector nicknames accepted by get_sensor_config() in place of the canonical kind, e.g. "sony" / "imx" / "imx455" for "zwo".