Utility functions¶
Astronomical calculations¶
- src.binary_sed_fitting.calc_sf(radius: Unit('m'), distance: Unit('m'))¶
Calculate scaling factor for given radius and distance
- Parameters:
radius (Quantity) – Radius [Rsun]
distance (Quantity) – distance [pc]
- Returns:
sf – Scaling factor
- Return type:
Quantity
- src.binary_sed_fitting.calc_radius(sf, distance: Unit('m'))¶
Radius for given scaling factor and distance
- Parameters:
sf (float or list) – Scaling factor
distance (Quantity) – distance [pc]
- Returns:
radius – radius [Rsun]
- Return type:
Quantity
- src.binary_sed_fitting.calc_luminosity(radius: Unit('m'), Te: Unit('K'))¶
Calculate luminosity from radius and temperature
- Parameters:
radius (Quantity) – radius [Rsun]
Te (Quantity) – Temperature [K]
- Returns:
luminosity – luminosity [Lsun]
- Return type:
Quantity
Loading data (i/o)¶
- src.binary_sed_fitting.load_data(file_name, mode)¶
Load star data.
- Parameters:
file_name (str) – File name containing data.
mode (str) – Data loading mode (‘csv’ or ‘vosa’).
- Returns:
data – Loaded data.
- Return type:
DataFrame
- src.binary_sed_fitting.gather_extinction_corrected_data_from_VOSA(file_name, load_params=False)¶
Gather extinction-corrected data from VOSA single-fit file.
- Parameters:
file_name (str) – File name containing VOSA data.
load_params (bool, optional) – Load additional parameters. Defaults to False.
- Returns:
data – Extinction-corrected data.
- Return type:
DataFrame
Helper functions¶
- src.binary_sed_fitting.save_fig(plot_name, show_plot, folder, format='jpg')¶
Save a matplotlib figure to a specified folder and handle display options.
- Parameters:
plot_name (str) – The name of the file to save the plot as, including the file extension (e.g., ‘plot.png’).
show_plot (bool) – If True, the plot will be shown after saving. If False, the plot will be closed after saving.
folder (str) – The directory in which to save the plot.
format (str) – Format of the plot (jpg, pdf etc.)
- src.binary_sed_fitting.fancy_text(text, buffer=12)¶
Create a fancy title with a specified buffer around the text.
- Parameters:
text (str) – The text to be displayed as the title.
buffer (int, optional) – The buffer of padding around the text. Default is 12.
- Returns:
A formatted string with the fancy title.
- Return type:
str
- src.binary_sed_fitting.estimate_runtime(current_iteration, total_iterations, start_time, message='Processing')¶
Estimates time of completion.
- Parameters:
current_iteration (int) – The current iteration.
total_iterations (int) – Total number of iterations.
start_time (float) – The start time of the process.
message (str, optional) – Custom message for progress. Defaults to ‘Processing’.