Configuration
SpectraDecomposing keeps the original script-style configuration as
attributes. Set these before calling fit_and_plot().
Core options
nameSource name written into plots and CSV files.
align_dataIf
True, interpolate absorption and emission spectra onto a shared velocity grid before fitting.peak_absOptional absorption component centers. Leave as
[]for automatic Gaussian selection.peak_emiOptional emission component centers. Setting this manually can make the emission fit much faster.
TsminLower bound for CNM spin temperature.
TskyBackground sky temperature. Use
2.73for CMB-only, or add synchrotron emission if available.FForeground fraction values tested for WNM components. The default is
[0, 0.5, 1].max_auto_warm_componentsOptional cap for automatically selected WNM components. Leave as
Nonefor the full search, or set a small integer for faster examples.
Output options
savecsvIf
True, writeFulldata.csv,CNMonlydata.csv, andWNMonlydata.csv.datapathDirectory where CSV files are written.
renewIf
True, remove old rows with the samenamebefore writing new results. This is useful when redoing a fit.
Example
spec_fit = SpectraDecomposing(x, y, yerr, xemi, yemi, yemi_err)
spec_fit.name = "example_spec"
spec_fit.v_shift = 4
spec_fit.peak_abs = []
spec_fit.peak_emi = []
spec_fit.max_auto_warm_components = 1
spec_fit.Tsmin = 10
spec_fit.Tsky = 2.73
spec_fit.F = [0, 0.5, 1]
spec_fit.align_data = True
spec_fit.savecsv = True
spec_fit.renew = True
spec_fit.datapath = "examples/example_spec_csv_outputs"
spec_fit.fit_and_plot()