Grid
¶
- class sed_analysis_tools.sed_analysis_tools.Grid(T_A: Unit("K"), L_A: Unit("solLum"), niter: int = 1, frac_err: float | ~numpy.ndarray | list = 0.001, D: Unit("pc") = <Quantity 10. pc>, threshold_nfilters: int = 3, threshold_ewr: float = 5, threshold_primary_match: float = 0.1, threshold_convergence_rate: float = 0.5, filter_set: ~sed_analysis_tools.sed_analysis_tools.FilterSet = <sed_analysis_tools.sed_analysis_tools.FilterSet object>, name: str = '', logT_B_list: list[float] = None, logL_B_list: list[float] = None)¶
A class to represent a grid of secondary stars for binary fitting.
- Parameters:
T_A (u.Quantity) – Temperature of the primary star A in Kelvin.
L_A (u.Quantity) – Luminosity of the primary star A in solar luminosities.
niter (int, optional) – Number of random iterations for fitting. Defaults to 1.
frac_err (Union[float, np.ndarray, list], optional) – Fractional error in flux. Must be greater than 0. Defaults to 0.001.
D (u.Quantity, optional) – Distance to the binary system in parsecs. Defaults to 10 pc.
threshold_nfilters (int, optional) – Threshold for the detection of poorly fitting filters. Defaults to 3.
threshold_ewr (float, optional) – Detection threshold for EWR to identify poorly fitting filters. Defaults to 5.
threshold_primary_match (float, optional) – Acceptable fractional error in the primary parameters (T and sf). Defaults to 0.1.
threshold_convergence_rate (float, optional) – Threshold for assessing the convergence rate. Defaults to 0.5.
filter_set (FilterSet, optional) – Filter set used for the observations. Defaults to a FilterSet with pivot wavelengths from 1600 Å to 50000 Å.
name (str, optional) – Name of the grid. Defaults to an empty string.
logT_B_list (list of float, optional) – List of logarithmic temperatures (log10(T/K)) for secondary star B. Must have the same length as logL_B_list.
logL_B_list (list of float, optional) – List of logarithmic luminosities (log10(L/solLum)) for secondary star B. Must have the same length as logT_B_list.
- T_A¶
Temperature of the primary star A.
- Type:
u.Quantity
- L_A¶
Luminosity of the primary star A.
- Type:
u.Quantity
- frac_err¶
Fractional error in flux.
- Type:
Union[float, np.ndarray, list]
- D¶
Distance to the binary system.
- Type:
u.Quantity
- niter¶
Number of iterations for random fitting.
- Type:
int
- threshold_nfilters¶
Threshold for detecting poorly fitting filters.
- Type:
int
- threshold_ewr¶
Detection threshold for EWR.
- Type:
float
- threshold_primary_match¶
Acceptable fractional error in the primary parameters.
- Type:
float
- threshold_convergence_rate¶
Threshold for assessing convergence.
- Type:
float
- x¶
Logarithmic wavelengths in Angstroms for the spectrum/SED, based on the filter set’s pivot wavelengths.
- Type:
np.ndarray
- name¶
Name of the grid.
- Type:
str
- logT_A¶
Logarithmic temperature (log10(T_A/K)) of the primary star.
- Type:
float
- logL_A¶
Logarithmic luminosity (log10(L_A/solLum)) of the primary star.
- Type:
float
- n_B¶
Number of secondary stars in the grid.
- Type:
int
- logT_B_list¶
List of logarithmic temperatures for secondary stars.
- Type:
list of float
- logL_B_list¶
List of logarithmic luminosities for secondary stars.
- Type:
list of float
- Raises:
NotImplementedError – If frac_err is set to 0.
ValueError – If logT_B_list and logL_B_list have different lengths.
- calculate_params(refit: bool = False) None ¶
Calculates and saves fitting parameters and SEDs.
- Parameters:
refit (bool, optional) – If True, refits and recalculates parameters, by default False.
- plot(plot_name: str = None) None ¶
Generate a series of plots and save to a file if specified.
- Parameters:
plot_name (str, optional) – The path to save the plot. If None, the plot is not saved.
- plot_Double_fitting_T2err(ax=None, cax=None, colorbar: bool = True, **kwargs) None ¶
Plot the percentage T_2 errors for the fitted secondary grid.
- Parameters:
ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure and axes are created.
cax (matplotlib.axes.Axes, optional) – The colorbar axes to use. If None, a new colorbar is created.
colorbar (bool, optional) – If True, include a colorbar. Defaults to True.
**kwargs (dict) – Additional keyword arguments passed to ax.scatter.
- plot_Double_fitting_lines(niter: int = None, ax=None, plot_poor: bool = True) None ¶
Plots the double fitting lines on the provided axis.
- Parameters:
niter (int, optional) – The iteration number for the fitting. If None, median values are used.
ax (plt.Axes, optional) – The axes to plot on. If None, a new figure and axes are created.
plot_poor (bool, optional) – Whether to plot poorly fitting results (with convergence_rate<0.5), by default True.
- plot_Double_fitting_points(ax=None, noisy: bool = False) None ¶
Plot the double fitting points on the provided axis.
- Parameters:
ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure and axes are created.
noisy (bool, optional) – If True, plot noisy data points with varying sizes. Defaults to False.
- plot_sed_patches(param: str = 'ewr_Single', ax=None) None ¶
Plots the SED patches on the provided axis. The ‘|’ markers are coloured according to param variable.
- Parameters:
param (str) – The parameter to color the SED patches. Defaults to ‘ewr_Single’
ax (plt.Axes, optional) – The axes to plot on. If None, a new figure and axes are created.
- plot_skeleton(ax=None, zorder: int = 0, hide_legend=False) None ¶
Plots the skeleton of the data on the provided axis.
- Parameters:
ax (plt.Axes, optional) – The axes to plot on. If None, a new figure and axes are created.
zorder (int, optional) – The z-order for the scatter plot, by default 0.
hide_legend (Bool) – Whether to show the legend. Defaults to False.