SED module (progenitors.sed)¶
SED fitting and plotting: fit stellar parameters from photometry using blackbodies, Pickles, MIST, BPASS, or red supergiant models. Supports MCMC (emcee) and nested sampling (dynesty).
Analysis (sed_fitter, emcee, dynesty)¶
Synphot compatibility layer¶
Synphot compatibility layer for progenitors.sed.
Provides a uniform API on top of synphot for spectra, bandpasses, and observations. Public API: setref, get_spectral_data_root, ArraySpectrum, BlackBody, Observation, ObsBandpass, ArrayBandpass, FileSpectrum. Uses synphot; HST/JWST filters require stsynphot.
- progenitors.sed.synphot_compat.setref(area=None)[source]¶
No-op for compatibility with legacy code.
synphot passes area to countrate() when needed; not used for magnitude calculations.
- Parameters:
area (float, optional) – Telescope area (ignored).
- progenitors.sed.synphot_compat.get_spectral_data_root()[source]¶
Root directory for spectral data (e.g. Pickles, CDBS grid).
Prefers SYNPATH (synphot convention); falls back to PYSYN_CDBS (stsynphot/legacy). Returns empty string if neither is set.
- Return type:
- progenitors.sed.synphot_compat.ArraySpectrum(wave, flux, waveunits='angstrom', fluxunits='flam', name='')[source]¶
Build a spectrum from wavelength and flux arrays (synphot backend).
Returns a wrapper with .wave, .flux, .name.
- Parameters:
wave (array-like) – Wavelength values.
flux (array-like) – Flux values (same length as wave).
waveunits (str, optional) – Wavelength unit (e.g. ‘angstrom’, ‘nm’). Default is ‘angstrom’.
fluxunits (str, optional) – Flux unit: ‘flam’, ‘fnu’, ‘count’/’counts’, or astropy unit string. Default is ‘flam’.
name (str, optional) – Label for the spectrum.
- Returns:
Object with .wave, .flux, .name and .convert(unit) method.
- Return type:
_SpectrumWrapper
- progenitors.sed.synphot_compat.BlackBody(temp)[source]¶
Blackbody spectrum at given temperature (synphot backend).
Returns wrapper; use .convert(‘fnu’) then scale.
- Parameters:
temp (float) – Temperature in Kelvin.
- Returns:
Normalized blackbody with .wave, .flux.
- Return type:
_SpectrumWrapper
- progenitors.sed.synphot_compat.Observation(spectrum, bandpass, binset=None, force='taper', **kwargs)[source]¶
Observe a spectrum through a bandpass (synphot backend).
Use .effstim(‘abmag’) or .effstim(‘vegamag’).
- Parameters:
spectrum (_SpectrumWrapper or SourceSpectrum) – Source spectrum.
bandpass (SpectralElement or array bandpass) – Filter bandpass.
binset (array-like, optional) – Wavelength set for integration.
force (str, optional) – If ‘taper’, taper bandpass edges. Default is ‘taper’.
- Returns:
Object with .effstim(flux_unit) returning a float (e.g. magnitude).
- Return type:
_ObservationWrapper
- progenitors.sed.synphot_compat.ObsBandpass(name)[source]¶
Load a named filter bandpass.
Uses synphot for standard names; stsynphot for HST/JWST (e.g. wfc3,uvis1,f438w).
- Parameters:
name (str) – Filter name (e.g. ‘johnson,V’, ‘wfc3,uvis1,f438w’).
- Returns:
Bandpass transmission curve.
- Return type:
SpectralElement
- Raises:
ImportError – If HST/JWST filter requested and stsynphot is not installed.
- progenitors.sed.synphot_compat.ArrayBandpass(wave, trans, name='', waveunits='Angstrom')[source]¶
Build a bandpass from wavelength and transmission arrays.
- Parameters:
- Returns:
Bandpass for use with Observation.
- Return type:
SpectralElement
- progenitors.sed.synphot_compat.FileSpectrum(filename)[source]¶
Load a spectrum from a file (synphot backend; e.g. FITS).
- Parameters:
filename (str) – Path to spectrum file.
- Returns:
Object with .wave, .flux, .name.
- Return type:
_SpectrumWrapper
- Raises:
OSError, FileNotFoundError – If file cannot be opened.
Dust and RSG utilities¶
Constants¶
SED plotting and fitting constants.
Includes colors (RGB tuples), physical constants (e.g. SOLAR_LUM_CGS, BB_SCALE), dust/RSG scaling constants, and alternate column names for photometry tables.
Utilities¶
SED utilities: dust maps, coordinate parsing, number formatting.
Core helpers live in progenitors.formatting_utils and progenitors.sfd_dust.