Fitter
¶
- class sed_analysis_tools.sed_analysis_tools.Fitter¶
- static bb_Double(source: Star | Binary = None, p0: List[float] = [5000.0, -20, 5000, -20], threshold_primary_match: float | None = None) ndarray ¶
Fit a double blackbody model to the spectrum.
- Parameters:
source (Union["Star", "Binary"]) – Source object containing spectrum and other properties (default is None).
p0 (List[float]) – Initial guess for fit parameters [T_1, logsf_1, T_2, logsf_2] (default is [5000.0, -20, 5000.0, -20]).
threshold_primary_match (Optional[float]) – Threshold for validating the primary blackbody fit match (default is None).
- Returns:
Optimized fit parameters [T_1, logsf_1, T_2, logsf_2]. Returns NaNs if fit fails or is rejected.
- Return type:
np.ndarray
- static bb_Single(source: Star | Binary = None, p0: List[float] = [5000.0, -20]) ndarray ¶
Fit a single blackbody model to the spectrum.
- Parameters:
source (Union["Star", "Binary"]) – Source object containing spectrum and other properties (default is None).
p0 (List[float]) – Initial guess for fit parameters [Temperature (K), Log Scaling Factor] (default is [5000.0, -20]).
- Returns:
Optimized fit parameters [T, logsf]. Returns NaNs if fit fails or is rejected.
- Return type:
np.ndarray
- static get_logflux_bb_Double(*, T_1: float, logsf_1: float, T_2: float, logsf_2: float, filter_set: FilterSet = None, plot: bool = False) float | ndarray ¶
Calculate the flux for a double blackbody model with the given filter set.
- Parameters:
T_1 (float) – Temperature of the first blackbody in Kelvin.
logsf_1 (float) – Logarithmic scaling factor for the first blackbody.
T_2 (float) – Temperature of the second blackbody in Kelvin.
logsf_2 (float) – Logarithmic scaling factor for the second blackbody.
filter_set (FilterSet, optional) – The filter set to convolve the blackbody spectra with. If mode is “no_filters”, fluxes are calculated directly for the wavelengths in filter_set.x.
plot (bool, optional) – Whether to generate a plot of the spectra and photometry (default is False).
- Returns:
Logarithmic flux values corresponding to the filter set wavelengths or synthesized photometry.
- Return type:
np.ndarray or float
- static get_logflux_bb_Single(*, T: float, logsf: float, filter_set: FilterSet | None = None, plot: bool = False) float | ndarray ¶
Compute flux for a single blackbody model.
- Parameters:
T (float) – Blackbody temperature in Kelvin.
logsf (float) – Logarithmic scaling factor.
filter_set (Optional[FilterSet]) – Set of filters to convolve the blackbody with (default is None).
plot (bool) – Whether to plot the result (default is False).
- Returns:
Logarithmic flux for the blackbody model.
- Return type:
float or np.ndarray
- static synth_phot(wavelength: Unit('m'), flux: Unit('erg / (Angstrom s cm2)'), filter_response: ndarray) Quantity ¶
Compute synthetic photometry by integrating flux with a filter response.
- Parameters:
wavelength (astropy.Quantity (u.m)) – Wavelength array.
flux (astropy.Quantity (u.erg / u.cm**2 / u.s / u.Angstrom)) – Flux density array.
filter_response (np.ndarray) – Filter transmission response.
- Returns:
Integrated flux in units of ergs/cm^2/s/Å.
- Return type:
astropy.Quantity
- static x_T_logsf_to_logflux_bb(x: float | List[float] | ndarray, T: float, logsf: float) float | ndarray ¶
Compute the logarithmic flux for a blackbody given wavelength, temperature, and scaling factor.
- Parameters:
x (float or array-like) – Logarithm of the wavelength in Angstroms.
T (float) – Temperature of the blackbody in Kelvin.
logsf (float) – Logarithmic scaling factor (related to radius and distance).
- Returns:
Logarithmic blackbody flux in ergs/cm^2/s/Å.
- Return type:
float or np.ndarray