Radio Fitting: N2H+ exampleΒΆ

Example hyperfine line fitting for the N2H+ 1-0 line.

import pyspeckit

# Load the spectrum
sp = pyspeckit.Spectrum('n2hp_opha_example.fits')

# Register the fitter
# The N2H+ fitter is 'built-in' but is not registered by default; this example
# shows how to register a fitting procedure
# 'multi' indicates that it is possible to fit multiple components and a
# background will not automatically be fit 4 is the number of parameters in the
# model (excitation temperature, optical depth, line center, and line width)
sp.xarr.velocity_convention = 'radio'
# Run the fitter

# Plot the results
# Re-run the fitter (to get proper error bars) and show the individual fit components
sp.specfit(fittype='n2hp_vtau', multifit=None, guesses=[15, 2, 4, 0.2],

# Save the figure (this step is just so that an image can be included on the web page)
Fit to the 15 hyperfine components of N2H+ simultaneously.  The (0)'s indicate that this is the 0'th velocity component being fit

[edit this page on github]

[edit this page on bitbucket]