Binary

class sed_analysis_tools.sed_analysis_tools.Binary(T_A: Unit("K"), T_B: Unit("K"), L_A: Unit("solLum"), L_B: Unit("solLum"), frac_err: float | ~numpy.ndarray | list = 0, seed: int = 0, D: Unit("pc") = <Quantity 10. pc>, threshold_ewr: float = 5, filter_set: ~sed_analysis_tools.sed_analysis_tools.FilterSet = <sed_analysis_tools.sed_analysis_tools.FilterSet object>, name: str = '')

A class to represent a binary star system with two stars.

Parameters:
  • T_A (u.Quantity) – Temperature of the first star in Kelvin.

  • T_B (u.Quantity) – Temperature of the second star in Kelvin.

  • L_A (u.Quantity) – Luminosity of the first star in solar luminosities.

  • L_B (u.Quantity) – Luminosity of the second star in solar luminosities.

  • frac_err (Union[float, np.ndarray, list], optional) – Fractional error in flux for the combined spectrum. Defaults to 0.

  • seed (int, optional) – Random seed for reproducibility. Defaults to 0.

  • D (u.Quantity, optional) – Distance to the binary system in parsecs. Defaults to 10 pc.

  • threshold_ewr (float, optional) – Detection threshold for EWR to identify poorly fitting filters (with abs(EWR) > threshold_ewr). Defaults to 5.

  • filter_set (FilterSet, optional) – The filter set used for observations. Defaults to a FilterSet with pivot wavelengths from 1600 Å to 50000 Å.

  • name (str, optional) – Name of the binary system. Defaults to an empty string.

A

The first star in the binary system.

Type:

Star

B

The second star in the binary system.

Type:

Star

threshold_ewr

Detection threshold for EWR.

Type:

float

D

Distance to the binary system.

Type:

u.Quantity

filter_set

The filter set associated with the binary system.

Type:

FilterSet

x

Logarithmic wavelengths in Angstroms for the spectrum/SED, based on the filter set’s pivot wavelengths.

Type:

np.ndarray

frac_err

Fractional error in flux for the combined spectrum.

Type:

Union[float, np.ndarray, list]

seed

Random seed for reproducibility.

Type:

int

name

Name of the binary system.

Type:

str

spectrum

Combined spectrum of the binary system (A + B).

Type:

Spectrum

spectrum_ratio

Ratio of the second star’s spectrum to the first star’s spectrum.

Type:

Spectrum

None explicitly defined yet.
estimate_errors(niter: int = 100, verbose: bool = True, threshold_primary_match: float = 0.1) None

Estimate errors by fitting models multiple times and evaluating the parameter spread.

Parameters:
  • niter (int, optional) – Number of random iterations for error estimation. Defaults to 100.

  • verbose (bool, optional) – If True, print results and convergence information. Defaults to True.

  • threshold_primary_match (float, optional) – Threshold for matching primary star parameters in fitting. Defaults to 0.10.

evaluate_pseudo_secondaries(grid_size: int = 5, niter: int = 100, refit: bool = False) None

Evaluate a grid of pseudo-secondaries near the HRD position of B component.

Parameters:
  • grid_size (int, optional) – Size of the grid for parameter exploration. grid_size*grid_size pseudo-secondaries wioll be created. Defaults to 5.

  • niter (int, optional) – Number of random iterations for each parameter set. Defaults to 100.

  • refit (bool, optional) – Whether to refit the parameters during the evaluation. Defaults to False.

fit_bb_Double(use_priors: bool = False, threshold_primary_match: None | float = None, **kwargs) None

Fit a double blackbody model to the binary system’s spectrum.

Parameters:
  • use_priors (bool, optional) – Whether to use prior values for fitting. Defaults to False.

  • threshold_primary_match (None or float, optional) – Threshold for matching primary star parameter in fitting. Defaults to None.

  • **kwargs – Additional keyword arguments passed to the fitting function.

fit_bb_Single(**kwargs) None

Fit a single blackbody model to the binary system’s spectrum.

Parameters:

**kwargs – Additional keyword arguments passed to the fitting function.

plot(ax=None, **kwargs) None

Plot the input spectrum of the binary system and its individual components.

Parameters:
  • ax (matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, a new figure and axes are created.

  • **kwargs – Additional keyword arguments passed to the plotting function.

plot_error_and_pseudo_secondaries(ax=None, plot_name: None | str = None) None

Plot both the error estimation and the grid of pseudo-secondaries.

Parameters:
  • ax (None or matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, a new figure is created.

  • plot_name (None or str, optional) – Path to save the plot. If None, the plot is not saved.

plot_estimated_errors(ax=None, plot_name: None | str = None) None

Plot estimated errors and median values on the HR diagram.

Parameters:
  • ax (None or matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, a new figure is created.

  • plot_name (None or str, optional) – Path to save the plot. If None, the plot is not saved.

plot_fitted(mode: str, axes=None, plot_name: None | str = None) None

Plot the fitted spectrum of the binary system.

Parameters:
  • mode (str) – Mode for plotting (e.g., fitting results).

  • axes (None or matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, a new plot is created.

  • plot_name (None or str, optional) – Path to save the plot. If None, the plot is not saved.

Return type:

None

plot_pseudo_secondaries(ax=None, plot_name: None | str = None) None

Plot the grid of pseudo-secondaries.

Parameters:
  • ax (None or matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, a new figure is created.

  • plot_name (None or str, optional) – Path to save the plot. If None, the plot is not saved.