pyspeckit 0.1 documentation

MeasurementsΒΆ

class pyspeckit.spectrum.measurements.Measurements(Spectrum, z=None, d=None, xunits=None, fluxnorm=None, miscline=None, misctol=10, ignore=None, derive=True, debug=False)

Bases: object

This can be called after a fit is run. It will inherit the specfit object and derive as much as it can from modelpars. Just do: spec.measure(z, xunits, fluxnorm)

Notes: If z (redshift) or d (distance) are present, we can compute integrated line luminosities rather than just fluxes. Provide distance in cm.

Currently will only work with Gaussians. To generalize:
1. make sure we manipulate modelpars correctly, i.e. read in entries corresponding to wavelength/frequency/whatever correctly.
misclines = dictionary
miscline = {{‘name’: H_alpha’, ‘wavelength’: 6565, ‘etc’: 0}, {}}
Measurements.bisection(f, x_guess)

Find root of function using bisection method. Absolute tolerance of 1e-4 is being used.

Measurements.bracket_root(f, x_guess, atol=0.0001)

Bracket root by finding points where function goes from positive to negative.

Measurements.compute_amplitude(pars)

Calculate amplitude of emission line. Should be easy - add multiple components if they exist. Currently assumes multiple components have the same centroid.

Measurements.compute_flux(pars)

Calculate integrated flux of emission line. Works for multi-component fits too. Unnormalized.

Measurements.compute_fwhm(pars)

Determine full-width at half maximum for multi-component fit numerically, or analytically if line has only a single component. Uses bisection technique for the former with absolute tolerance of 1e-4.

Measurements.compute_luminosity(pars)

Determine luminosity of line (need distance and flux units).

Measurements.derive()

Calculate luminosity and FWHM for all spectral lines.

Measurements.identify()

Determine identity of lines in self.modelpars. Fill entries of self.lines dictionary.

Note: This method will be infinitely slow for more than 10 or so lines.

Measurements.separate()

For multicomponent lines, separate into broad and narrow components (assume only one of components is narrow).

Measurements.to_tex()

Write out fit results to tex format.