scopesim_targets.point_source.Binary#

class scopesim_targets.point_source.Binary(position: SkyCoord | tuple[float, float] | Mapping[str, float | Quantity] | None = None, offset: Mapping[str, float | Quantity] | None = None, spectra: Sequence[SourceSpectrum | SpectralType | str] | None = None, brightness: Any | Sequence[Any] | None = None, contrast: float | None = None)#

Bases: PointSourceTarget

Binary star.

Todo

Fix offset definition via distance and physical separation, see #107 (also applies to other target subclasses).

Examples

>>> tgt = Binary(
...     position={"distance": 100*u.pc},
...     spectra=("F0V", "M2V"),
...     brightness=("R", 10),
...     contrast=100.,  # F_pri / F_sec
...     offset={"separation": .1*u.AU},
... )

For more examples, see also the YAML syntax.

__init__(position: SkyCoord | tuple[float, float] | Mapping[str, float | Quantity] | None = None, offset: Mapping[str, float | Quantity] | None = None, spectra: Sequence[SourceSpectrum | SpectralType | str] | None = None, brightness: Any | Sequence[Any] | None = None, contrast: float | None = None) None#

Methods

__init__([position, offset, spectra, ...])

redshift_spectrum(spectrum, position)

Doppler shift spectrum based on position z or v_rad.

resolve_position([parent_position])

Resolve target position or offset.

resolve_spectrum(spectrum[, brightness])

Create SpeXtrum instance from spectrum identifier.

source_spectra([start])

Create spectra dict for Source conversion.

to_source()

Convert to ScopeSim Source object.

to_table([local_frame, spectra, refs])

Convert to table for Source conversion.

Attributes

brightness

Target brightness information.

brightness_secondary

Brightness of secondary component, if not set via contrast.

contrast

Contrast ratio between primary and secondary component.

offset

Target offset from parent.

position

Target position (center) as SkyCoord.

primary_spectrum

Spectral information of primary component.

secondary_spectrum

Spectral information of secondary component.

spectrum

Target spectral information.

property brightness: Brightness#

Target brightness information.

property brightness_secondary: Brightness#

Brightness of secondary component, if not set via contrast.

property contrast: float#

Contrast ratio between primary and secondary component.

The contrast ratio is interpreted as ratio between physical flux of the primary and secondary component, not difference in magnitudes.

Brightness of the secondary can also be specified via the brightness_secondary attribute instead, which supports magnitudes.

Todo

Add support for dimensionless Quantity and other numerical types in setter type check.

property offset: dict#

Target offset from parent.

property position: SkyCoord#

Target position (center) as SkyCoord.

property primary_spectrum: SourceSpectrum | SpectralType | str#

Spectral information of primary component.

static redshift_spectrum(spectrum: Spextrum, position: SkyCoord) Spextrum#

Doppler shift spectrum based on position z or v_rad.

resolve_position(parent_position: SkyCoord | None = None)#

Resolve target position or offset.

This uses the following lookup order: 1. self.position set? -> use that 2. parent position present?

  1. self.offset set? -> resolve offset to parent position

  2. otherwise use parent position

  1. self.offset set, but no parent position present -> Error

  2. default to (0, 0)

Parameters:

parent_position (SkyCoord | None, optional) – Position of any parent target. If None (the default), self.offset must not be set.

Raises:

ValueError – Raised if self.offset set, but parent_position is None.

Returns:

position – Resolved position as SkyCoord object.

Return type:

SkyCoord

static resolve_spectrum(spectrum: SourceSpectrum | SpectralType | str, brightness: Brightness | None = None) SourceSpectrum#

Create SpeXtrum instance from spectrum identifier.

Can resolve a SpectralType instance (next-closest available template spectrum) or a string that is a valid entry in the SpeXtrum database.

Todo

Actually implement this “next-closest available template”, see #68.

Return type:

Spextrum

property secondary_spectrum: SourceSpectrum | SpectralType | str#

Spectral information of secondary component.

source_spectra(start: int = 0) dict[int, SourceSpectrum]#

Create spectra dict for Source conversion.

property spectrum: SourceSpectrum | SpectralType | str#

Target spectral information.

to_source() Source#

Convert to ScopeSim Source object.

to_table(local_frame=None, spectra=None, refs=None) Table#

Convert to table for Source conversion.