Linefit

class pyplatefit.Linefit(vel=(-500, 0, 500), vdisp=(5, 50, 300), velabs=(-500, 0, 500), vdispabs=(5, 50, 300), polydegabs=12, polyiterabs=3, polywmask=3.0, vdisp_lya=(50, 150, 700), gamma_lya=(-1, 2, 10), windmax=10, minsnr=3.0, nstd_relsize=3.0, gamma_2lya1=(-10, -2, 0), gamma_2lya2=(0, 2, 10), sep_2lya=(80, 500, 1000), line_ratios=[('CIII1907', 'CIII1909', 0.6, 1.2), ('OII3726', 'OII3729', 0.3, 1.5)], minpars={'method': 'least_square', 'xtol': 0.001}, mcmcpars={'nwalkers': 0, 'save_proba': False, 'steps': 0})

Bases: object

This class implement Emission Line fit

Initialize line fit parameters and return a Linefit object

Parameters:
veltuple of floats

Minimum, init and maximum values of velocity offset in km/s for emission lines (default: -500,0,500).

velabs: tuple of floats

Minimum, init and maximum values of rest frame velocity dispersion in km/s for absorption lines (default: 5,80,300).

vdisptuple of floats

init and maximum values of rest frame velocity dispersion in km/s for emission lines (default: 5,80,300).

vdispabs: tuple of floats

Minimum, init and maximum values of rest frame velocity dispersion in km/s for absorption lines(default: 5,80,300).

vdisp_lyatuple of float

Minimum, init and maximum values of Lya rest frame velocity dispersion in km/s (default: 50,150,700).

gamma_lyatuple of floats

Minimum, init and maximum values of the skeness parameter for the asymetric gaussain fit (default: -1,2,10).

gamma_2lya1tuple of floats

Minimum, init and maximum values of the skeness parameter for the left component of the double asymetric gaussain fit (default: -10,-2,0).

gamma_2lya2tuple of floats

Minimum, init and maximum values of the skeness parameter for the right component of the double asymetric gaussain fit (default: 0,2,10).

sep_2lyatuple of floats

Minimum, init and maximum values of the peak separation in km/s of the double asymetric gaussain fit (default: 50,200,700)

windmaxfloat

maximum half size window in A to find peak values around initial wavelength value (default: 10).

xtolfloat

relative error in the solution for the leastq fitting (default: 1.e-4).

ftolfloat

relative error in the sum of square for the leastsq fitting (default: 1.e-6).

maxfevint

max number of iterations by parameter for the leastsq fitting (default 50)

nstd_relsizefloat

relative size (wrt to FWHM) of the wavelength window used for NSTD line estimation (used in bootstrap only), default: 3.0

minsnrfloat

minimum SNR to display line ID in plots (default 3.0)

line_ratioslist of tuples

list of line_ratios, defaulted to [(“CIII1907”, “CIII1909”, 0.6, 1.2), (“OII3726”, “OII3729”, 1.0, 2.0)]

minparsdictionary

Parameters to pass to minimize (lmfit) (default dict(method=’least_square’, xtol=1.e-3)

WIP: polydegabs=12, polyiterabs=3, polywmask=3.0,

Methods Summary

absfit(spec, z, **kwargs)

perform an absorption line fit on a mpdaf spectrum

fit(line_spec, z, **kwargs)

perform line fit on a mpdaf spectrum

info(res[, full_output])

Print fit informations

plot(ax, res[, start, iden, minsnr, line, ...])

plot fit results

Methods Documentation

absfit(spec, z, **kwargs)

perform an absorption line fit on a mpdaf spectrum

Parameters:
line_specmpdaf.obj.Spectrum

input spectrum

zfloat

initial redshift

**kwargskeyword arguments

Additional arguments passed to the fit_abs function.

Returns:
resdictionary

See fit_lines, return in addition the following spectrum in the observed frame line_spec initial spectrum, init_linefit spectrum of the starting solution for the line fit, line_fit spectrum of the line fit

fit(line_spec, z, **kwargs)

perform line fit on a mpdaf spectrum

Parameters:
line_specmpdaf.obj.Spectrum

input spectrum (must be continnum subtracted)

zfloat

initial redshift

**kwargskeyword arguments

Additional arguments passed to the fit_lines function.

Returns:
resdictionary

See fit_lines, return in addition the following spectrum in the observed frame line_spec initial spectrum, init_linefit spectrum of the starting solution for the line fit, line_fit spectrum of the line fit

info(res, full_output=False)

Print fit informations

Parameters:
resdictionary

results of fit

plot(ax, res, start=False, iden=True, minsnr=0, line=None, margin=5, dplot={'dl': 2.0, 'size': 10, 'y': 0.95})

plot fit results

Parameters:
axmatplotlib.axes.Axes

Axes instance in which to draw the plot

resdictionary

results of fit

startbool

plot initial value before fit

idenbool

write line label on plot

minsnrfloat

minimum to write line label

marginfloat

margin between left and right wavelength as define in lines table

startbool

plot iniial values before fit

dplotdictionary

parameters to draw line labels

  • dl: offset in wavelength

  • y: location in y (0-1)

  • size: font size