| |
- Axis
- Fitter1D
- PkCommon
-
- Peak1D
- Peak2D
class Axis |
|
A class to handle isotropic spectral axes, used by PeakxD.
contains
shape The shape of the peak 1.0 for Lorentzian / 0.0 for Gaussian - intermediate values possible
pos the position of the peak along this axis, in Hz
width the width of the peak
phase the phase of the peak in degrees
pos_err the error on the previous quantities
width_err
phase_err
left The extension of the integration zone - in index
right |
|
Methods defined here:
- __init__(self, pos=0.0, width=1.0, phase=0.0, shape=1.0, pos_err=0.0, width_err=0.0, phase_err=0.0, left=0.0, right=0.0)
- #---------------------------------------------------------------------------
- __str__(self)
- #---------------------------------------------------------------------------
- table(self, sep=',')
- returns a string with the peak values separated with 'sep'
ideal for outputing to "excel" files
- table_hdr(self, sep=',')
- returns a string suitable to be used as a header for table()
|
class Fitter1D |
|
This class implements high level tools for fitting 1D Peaks.
start, end determines the spectral window to fit in index
pklist is the list of Peak to actually fit
fitmasklist is a list of peaks, telling what to fit and what not to fit, if it is not given,
a default mask is created and filled so that Amp and Position only are fitted
possible values are :
FitA (amp) FitP (Pos) FitW (width) FitP (phase) FitS (Lorentz-Gauss shape)
and combinations : FitAP FitAPW FitAPWP FitAPWS FitAPWPS
Results are returned in Fitter.FittedPeakList
return of info and error estimate is still to be done.
Fitter should be called with the spectrum to fit into the 1D buffer
A typical call is :
# initialize list of peak to fit
pl=[]
pl.append(Peak.Peak1D("Line 2", 6000000, 3507, 2.0))
pl.append(Peak.Peak1D("Line 3", 6000000, 3499, 2.0))
# initialize fitter
# first two arg are spectral window to fit (in index)
# then peak list
# then default mask defining which parameters to fit
fitter=Linefit.Fitter(1320, 1350, pl,Peaker1D.Fitter.FitAPW)
# start fitter
fitter.doFit()
# get fitted values
Peaker1D.report(fitter.FittedPeakList)
F = Fitter()
author : M-A Delsuc
some code rewritten from Vincent Catherinot java code
date : April 2008 |
|
Methods defined here:
- FitSize(self)
- returns the size of the fitting problem as a pair (npeak, npar)
where
npeak is the number of peak to fit
pvar is the number of parameters to fit
npar can take any value from 0 (nothing to fit) to 6*npeak (fit everything)
- __init__(self, start=0, end=0, pklist=[], fitmask=(1, 1, 0, 0, 0))
- doFit(self)
- realizes the fit, once all parameters are set
- getPeaks(self, fit)
- Get fitted peaks out of the fitter, and return as a list
- loadData(self)
- Load current Kernel 1D buffer for fitting.
This is done at Fitter initialisation, but can be redone any time.
- prepData(self)
- Prepare the data in the 1D buffer by isolating and applying Hilbert transform
- prepPeaks(self, fit)
- Prepare the peaks into memory
PeakList is a list of Peaks
returns the number of peak copied
- setFitMaskList(self, fitmask)
- set the list of the fitmask to be used for fitting, using the same mask for all peaks
- setFitMaskPeak(self, peak_index, fitmask=(1, 1, 0, 0, 0))
- Set the mask of the peak_index^th peak in self.PeakList
- setPeakList(self, pklist, fitmask=(1, 1, 0, 0, 0))
- set the list of peaks to fit,
pklist is the list of Peak to actually fit
fitmask tells what to fit and what not to fit, if it is not given, Amp and Position only are fitted
Data and other attributes defined here:
- FitA = (1, 0, 0, 0, 0)
- FitAP = (1, 1, 0, 0, 0)
- FitAPW = (1, 1, 1, 0, 0)
- FitAPWP = (1, 1, 1, 1, 0)
- FitAPWPS = (1, 1, 1, 1, 1)
- FitAPWS = (1, 1, 1, 0, 1)
- FitP = (0, 0, 0, 1, 0)
- FitS = (0, 0, 0, 0, 1)
- FitW = (0, 0, 1, 0, 0)
|
class Peak1D(PkCommon) |
|
A class to handle 1D peaks !
presents a clean and natural interface to peak handling
communicate with the peaks in the kernel with getFromKernel and copyToKernel
peak lists are naturally handled as list of Peak1D (!!!) |
|
Methods defined here:
- __init__(self, label='Peak', amp=0.0, pos=0.0, width=1.0, phase=0.0, shape=1.0, area=0.0, amp_err=0.0, pos_err=0.0, width_err=0.0, phase_err=0.0, area_err=0.0, left=0.0, right=0.0)
- __str__(self)
- copyToKernel(self, i)
- copy the value for this peak into the kernel
- getFromKernel(self, i)
- copy the value for peak i in kernel into this peak
values undefined by the kernel will be untouched
- table(self, sep=',')
- returns a string with the peak values separated with 'sep'
ideal for outputing to "excel" files
- table_hdr(self, sep=',')
- returns a string suitable to be used as a header for table()
|
class Peak2D(PkCommon) |
|
A class to handle 2D peaks !
presents a clean and natural interface to peak handling
communicate with the peaks in the kernel with getFromKernel and copyToKernel
peak lists are naturally handled as list of Peak2D (!!!) |
|
Methods defined here:
- __init__(self, label='Peak', amp=0.0, F1=(0.0, 1.0, 0.0, 1.0, 0, 0), F2=(0.0, 1.0, 0.0, 1.0, 0, 0), area=0.0, amp_err=0.0, F1_err=(0.0, 0.0, 0.0), F2_err=(0.0, 0.0, 0.0), area_err=0.0)
- __str__(self)
- copyToKernel(self, i)
- copy the value for this peak into the kernel
- getFromKernel(self, i)
- copy the value for peak i in kernel into this peak
values undefined by the kernel will be untouched
|
class PkCommon |
|
This class defines the parameters common to all PeakxD :
label The name of the peak
amp The amplitude (the height of the largest point)
area The area/volume of the peak
amp_err The error of the previous values
area_err |
|
Methods defined here:
- __init__(self, label='Peak', amp=0.0, area=0.0, amp_err=0.0, area_err=0.0)
- #---------------------------------------------------------------------------
| |