Performance
The emission fit can become slow when the absorption fit contains many CNM components. The expensive part is testing possible CNM foreground/background orders and WNM foreground fractions.
For ncold cold components and nwarm warm components, the number of
candidate nonlinear emission fits can scale roughly as:
ncold! * len(F) ** nwarm
Practical speed tips
Set
peak_emimanually when you know the likely emission component centers. This avoids a larger automatic search.Reduce
Fduring exploration. For example, usespec_fit.F = [0.5]for a fast first pass, then restore[0, 0.5, 1]for a final run.Limit absorption components by setting
peak_absmanually or usingnum_coldwhen the automatic fit over-splits noisy absorption spectra.Set
max_auto_warm_componentsto cap the automatic emission search when you want automatic centers but do not want to test many WNM components.Keep
align_data=Truewhen absorption and emission velocity grids differ.
Example fast first pass
spec_fit.peak_emi = []
spec_fit.max_auto_warm_components = 1
spec_fit.F = [0.5]
spec_fit.num_cold = 5
spec_fit.fit_and_plot()
After the fit is stable, rerun with the fuller configuration if needed:
spec_fit.F = [0, 0.5, 1]
spec_fit.num_cold = 0
spec_fit.renew = True
spec_fit.fit_and_plot()