Platefit¶
- class pyplatefit.Platefit(contpars={}, linepars={}, eqwpars={}, mcmcpars={'nwalkers': 0, 'save_proba': False, 'steps': 0}, minpars={'method': 'least_square', 'xtol': 0.001})¶
Bases:
object
This class is a poorman version of Platefit.
Initialise a Platefit object
- Parameters:
- contpars: dictionary
input parameters to be passed to
Contfit
constructor- linepars: dictionary
input parameters to be passed to
Linefit
constructor- minpars: dictionary
minimization parameters to be passed to
Linefit
constructor- mcmcpars: dictionary
EMCEE minimization parameters to be passed to
Linefit
constructor- eqwpars: dictionary
input parameters to be passed to
EquivalentWidth
constructor
Methods Summary
comp_eqw
(spec, line_spec, z, lines_table)compute equivalent width for emission lines
fit
(spec, z[, ziter, fitcont, fitlines, ...])Perform continuum and emission and absorption lines fit on a spectrum
fit_abslines
(spec, z[, lsf])Perform absorption lines fit on a continuum subtracted spectrum
fit_cont
(spec, z, vdisp)Perform continuum lines fit on a spectrum
fit_lines
(line, z[, lsf])Perform emission lines fit on a continuum subtracted spectrum
info
(res)print fitting info form
fit
info_cont
(res)print a summary of continuum fit results
info_lines
(res[, full_output])print a summary of lines fit results
plot_cont
(ax, res)plot_lines
(ax, res[, start, iden, minsnr, ...])Methods Documentation
- comp_eqw(spec, line_spec, z, lines_table)¶
compute equivalent width for emission lines
- Parameters:
- spec
mpdaf.obj.Spectrum
raw spectrum
- line_spec
mpdaf.obj.Spectrum
continuum subtracted spectrum
- z
float
redshift
- lines_table: astropy.table.Table
input/output lines table to be updated with eqw results
- spec
- Returns:
None
The
lines_table
will
be
updated
with
the
following
columns:EQW : Rest frame equivalent width in A, by convention emission lines have negative eqw
EQW_ERR : Standard error in equivalent width in A
- fit(spec, z, ziter=False, fitcont=True, fitlines=True, fitabs=False, eqw=True, lsf=<function muse_lsf>, **kwargs)¶
Perform continuum and emission and absorption lines fit on a spectrum
- Parameters:
- spec
mpdaf.obj.Spectrum
continuum subtracted spectrum
- z
float
initial reshift
- ziterbool
if True, a first emission line fit is performed to refine the redshift before a new continuum subtraction and a complete line fit is performed (to save computation time, eemce option is disactivated for the first fit), default false
- fitcontbool
Fit and remove continuum prior to (absorption) line fitting.
- fitlinesbool
Fit emission lines
- fitabsbool
Fit absorption lines
- eqwbool
Compute Equivalent Width
- lsf
function
LSF model
- **kwargs
keyword
arguments
Additional arguments passed to
Linefit.fit
function.
- spec
- Returns:
- result
dict
result[‘lines’]: astropy line table (see
fit_lines
)result[‘ztable’]; astropy z table (see
fit_lines
)result[‘spec’]: MPDAF original spectrum
result[‘cont_spec’]: MPDAF spectrum, estimated continuum in observed frame (cont_fit + smooth residuals)
result[‘cont_fit’]: MPDAF spectrum, fitted continuum in observed frame
result[‘line_spec’]: MPDAF spectrum, continnum removed spectrum in observed frame
result[‘line_fit’]: MPDAF spectrum, fitted emission lines in observed frame
result[‘line_initfit’]: MPDAF spectrum, starting solution for emission line fit in observed frame
result[‘poly_cont’]: MPDAF spectrum, polynomial continuum estimation
result[‘abs_fit’]: MPDAF spectrum, absorption line fit
result[‘spec_fit’]: MPDAF spectrum, fitted line+continuum (+absorption) in observed frame
result[‘dcont’]: return dictionary from fit_cont (see
fit_cont
)result[‘dline’]: returned dictionary from fit_lines (see
fit_lines
)
- result
- fit_abslines(spec, z, lsf=<function muse_lsf>, **kwargs)¶
Perform absorption lines fit on a continuum subtracted spectrum
- Parameters:
- spec
mpdaf.obj.Spectrum
input spectrum
- z
float
reshift
- lsf
function
LSF model
- kwargs
keyword
arguments
Additional arguments passed to the
fit_lines
function.
- spec
- Returns:
- res
dictionary
See
Linefit.fit
- res
- fit_cont(spec, z, vdisp)¶
Perform continuum lines fit on a spectrum
- Parameters:
- line
mpdaf.obj.Spectrum
Continuum subtracted spectrum
- z
float
Reshift
- vdisp
float
Velocity dispersion in km/s
- line
- Returns:
- result
dict
result[‘table_spec’] astropy table with the following columns:
RESTWL: restframe vacuum wavelength
FLUX: data value in restframe
ERR: stddev of data value
CONTFIT: continuum fit (restframe)
CONTRESID: smoothed continuum residual (restframe)
CONT: continuum fit + residual
LINE: continuum subtracted
AIRWL: observed wavelength in air
result[‘cont_spec’]: MPDAF spectrum continuum (fit + smooth residual) in observed frame
result[‘cont_fit’]: MPDAF spectrum continuum (fit only) in observed frame
result[‘line_spec’]: MPDAF continuum subtracted spectrum in observed frame (spec - cont_spec)
result[‘success’]: True or False
result[‘z’]: Metallicity
result[‘ebv’]: E(B-V)
result[‘chi2’]: Chi2 fit
result[‘ages’]: fitted ages
result[‘weights’]: used weights
- result
- fit_lines(line, z, lsf=<function muse_lsf>, **kwargs)¶
Perform emission lines fit on a continuum subtracted spectrum
- Parameters:
- line
mpdaf.obj.Spectrum
continuum subtracted spectrum
- z
float
reshift
- lsf
function
LSF model
- kwargs
keyword
arguments
Additional arguments passed to the
fit_lines
function.
- line
- Returns:
- res
dictionary
See
Linefit.fit
- res
- info(res)¶
print fitting info form
fit
- Parameters:
- res:
results from
fit
- full_output: bool
if True write more information, default False
- info_lines(res, full_output=False)¶
print a summary of lines fit results
- Parameters:
- res:
results from
fit_lines
- full_output: bool
if True write more information, default False
- plot_cont(ax, res)¶
- plot_lines(ax, res, start=False, iden=True, minsnr=0, line=None, margin=5, dplot={'dl': 2.0, 'size': 10, 'y': 0.95})¶