# Measurements¶

class pyspeckit.spectrum.measurements.Measurements(Spectrum, z=None, d=None, fluxnorm=None, miscline=None, misctol=10.0, ignore=None, derive=True, debug=False, restframe=False, ptol=2, sort=False)[source] [github] [bitbucket]

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.

Only works with Gaussians. To generalize:
1. make sure we manipulate modelpars correctly, i.e. read in entries corresponding to wavelength/frequency/whatever correctly.
Parameters: z: float or None redshift d: float or None distance in cm (used for luminosities) fluxnorm: bool Normalize the fluxes? miscline: dictionary miscline = [{‘name’: H_alpha’, ‘wavelength’: 6565}] misctol: tolerance (in Angstroms) for identifying an unmatched line to the line(s) we specify in miscline dictionary. sort: bool Sort the entries in order of observed wavelength (or velocity or frequency)
bisection(f, x_guess)[source] [github] [bitbucket]

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

bracket_root(f, x_guess, atol=0.0001)[source] [github] [bitbucket]

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

compute_amplitude(pars)[source] [github] [bitbucket]

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

compute_flux(pars)[source] [github] [bitbucket]

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

compute_fwhm(pars)[source] [github] [bitbucket]

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.

compute_luminosity(pars)[source] [github] [bitbucket]

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

derive()[source] [github] [bitbucket]

Calculate luminosity and FWHM for all spectral lines.

identify_by_position(ptol)[source] [github] [bitbucket]

Match observed lines to nearest reference line. Don’t use spacing at all.

ptol = tolerance (in angstroms) to accept positional match

identify_by_spacing()[source] [github] [bitbucket]

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.

separate()[source] [github] [bitbucket]

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

to_tex()[source] [github] [bitbucket]

Write out fit results to tex format.