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:
objectThis class implement Emission Line fit
Initialize line fit parameters and return a Linefit object
- Parameters
- vel
tupleoffloats 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).
- vdisp
tupleoffloats 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_lya
tupleoffloat Minimum, init and maximum values of Lya rest frame velocity dispersion in km/s (default: 50,150,700).
- gamma_lya
tupleoffloats Minimum, init and maximum values of the skeness parameter for the asymetric gaussain fit (default: -1,2,10).
- gamma_2lya1
tupleoffloats Minimum, init and maximum values of the skeness parameter for the left component of the double asymetric gaussain fit (default: -10,-2,0).
- gamma_2lya2
tupleoffloats Minimum, init and maximum values of the skeness parameter for the right component of the double asymetric gaussain fit (default: 0,2,10).
- sep_2lya
tupleoffloats Minimum, init and maximum values of the peak separation in km/s of the double asymetric gaussain fit (default: 50,200,700)
- windmax
float maximum half size window in A to find peak values around initial wavelength value (default: 10).
- xtol
float relative error in the solution for the leastq fitting (default: 1.e-4).
- ftol
float relative error in the sum of square for the leastsq fitting (default: 1.e-6).
- maxfev
int max number of iterations by parameter for the leastsq fitting (default 50)
- nstd_relsize
float relative size (wrt to FWHM) of the wavelength window used for NSTD line estimation (used in bootstrap only), default: 3.0
- minsnr
float minimum SNR to display line ID in plots (default 3.0)
- line_ratios
listoftuples list of line_ratios, defaulted to [(“CIII1907”, “CIII1909”, 0.6, 1.2), (“OII3726”, “OII3729”, 1.0, 2.0)]
- minpars
dictionary Parameters to pass to minimize (lmfit) (default dict(method=’least_square’, xtol=1.e-3)
WIP: polydegabs=12, polyiterabs=3, polywmask=3.0,
- vel
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_spec
mpdaf.obj.Spectrum input spectrum
- z
float initial redshift
- **kwargs
keywordarguments Additional arguments passed to the
fit_absfunction.
- line_spec
- Returns
- res
dictionary 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
- res
- fit(line_spec, z, **kwargs)
perform line fit on a mpdaf spectrum
- Parameters
- line_spec
mpdaf.obj.Spectrum input spectrum (must be continnum subtracted)
- z
float initial redshift
- **kwargs
keywordarguments Additional arguments passed to the
fit_linesfunction.
- line_spec
- Returns
- res
dictionary 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
- res
- 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
- ax
matplotlib.axes.Axes Axes instance in which to draw the plot
- res
dictionary results of
fit- startbool
plot initial value before fit
- idenbool
write line label on plot
- minsnr
float minimum to write line label
- margin
float margin between left and right wavelength as define in lines table
- startbool
plot iniial values before fit
- dplot
dictionary parameters to draw line labels
dl: offset in wavelength
y: location in y (0-1)
size: font size
- ax