System

class src.binary_sed_fitting.System(name, distance, e_distance, data, run_name='0', filters_to_drop=[])

Class for working with multi-component SEDs. At present, maximum 3 components are supported.

name

Name of the system.

Type:

str

distance

Distance to the system [pc].

Type:

float

e_distance

Error in the distance measurement [pc].

Type:

float

run_name

Name of the run.

Type:

str

filters_to_drop

List of filters to be dropped before fitting the SED. Default is an empty list.

Type:

list

components

List of components within the system.

Type:

list

Total

Star object representing the total fitted flux.

Type:

Star

<component>

Star object for a given component (e.g. System.A, System.B, System.C or System.Total).

Type:

Star

__init__(name, distance, e_distance, data, run_name='0', filters_to_drop=[])

Initialize a System object.

Parameters:
  • name (str) – The name of the system.

  • distance (float) – The distance to the system [pc].

  • e_distance (float) – The error in the distance measurement [pc].

  • data (DataFrame) – Input data for the system.

  • run_name (str, optional) – Name of the run (default is ‘0’).

  • filters_to_drop (list, optional) – List of filters to drop from the data (default is []).

Notes

Initializes a Star object (System.Total) representing the total fitted flux for the system based on the input data.

create_residual_star(component, model, wavelength_range=[0, 1000000000], r_limits='blackbody')

Create a residual star object for a specific component based on residual flux.

Parameters:
  • component (str) – Identifier for the component for which residual star is to be created.

  • model (Model object) – Model information for the residual star.

  • wavelength_range (list, optional) – Range of wavelengths to consider for fitting. Default is [0, 1,000,000,000].

  • r_limits (str, optional) – R limits for setting the component. Default is ‘blackbody’.

Raises:

AttributeError – If the component is already defined in the System.

Notes

Updates: System.Total, System., System.components

This method computes residual flux from self.Total.data_all by subtracting flux from all fitted components present in the System.

plot(add_noisy_seds=False, show_plot=True, folder=None, FR_cutoff=0.5, _median=False)

Plot detailed information about the system.

Parameters:
  • add_noisy_seds (bool, optional) – Include noisy SEDs in the plot. Default is False.

  • show_plot (bool, optional) – Whether to display the plot. Default is True.

  • folder (str, optional) – Folder to save the plot. No plot is saved if folder is None.

  • FR_cutoff (float, optional) – Fractional residual cutoff for plotting. Default is 0.5.

  • _median (bool, optional) – Use median for calculations. Default is False.

plot_public(add_noisy_seds=False, median=False, show_plot=True, folder=None)

Plot summarised information about the system.

Parameters:
  • add_noisy_seds (bool, optional) – Include noisy SEDs in the plot. Default is False.

  • median (bool, optional) – Use median for calculations. Default is False.

  • show_plot (bool, optional) – Whether to display the plot. Default is True.

  • folder (str, optional) – Folder to save the plot. No plot is saved if folder is None.

save_summary()

Save a summary of the current state of the instance to a CSV file.

Notes

If the log file (data/log_starsystem_fitting.csv) does not exist, creates a new one. Otherwise, appends to the existing log file.

setup_A_component(model, wavelength_range=[0, 1000000000], r_limits='blackbody')

Set up the A component of the system.

Parameters:
  • model (Model object) – Model information for the A component.

  • wavelength_range (list, optional) – Range of wavelengths to consider for fitting. Default is [0, 1,000,000,000].

  • r_limits (str, optional) – R limits for setting the component. Default is ‘blackbody’.

Raises:

AttributeError – If ‘A’ component is already defined.

Notes

Updates: System.A, System.components

Initializes the A component of the system as a Star object (self.A), using the provided model information (model), wavelength range (wavelength_range), and R limits (r_limits).

Updates self.A with the appropriate data and attributes, and adds ‘A’ to the list of components (self.components) within the system.

update_Total_flux(median=False)

Update the self.Total flux based on all fitted component fluxes.

Parameters:

median (bool, optional) – Use median parameters for calculations.

Notes

Updates: System.Total.data_all, System.Total.data, System.Total.data_not_fitted, System.Total.N_Np, System.Total.chi2, System.Total.chi2_r, System.Total.vgf2, System.Total.vgfb2