libpyhat.transform.baseline_code package
Submodules
libpyhat.transform.baseline_code.airpls module
- class libpyhat.transform.baseline_code.airpls.AirPLS(smoothness_param=100, max_iters=10, conv_thresh=0.001, verbose=False)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.airpls.airpls_baseline(intensities, smoothness_param=100, max_iters=10, conv_thresh=0.001, verbose=False)[source]
Baseline corr. using adaptive iteratively reweighted penalized least squares. Also known as airPLS, 2010. http://pubs.rsc.org/EN/content/articlehtml/2010/an/b922045c https://code.google.com/p/airpls/ https://airpls.googlecode.com/svn/trunk/airPLS.py
libpyhat.transform.baseline_code.als module
- class libpyhat.transform.baseline_code.als.ALS(asymmetry_param=0.05, smoothness_param=1000000.0, max_iters=10, conv_thresh=1e-05, verbose=False)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.als.als_baseline(intensities, asymmetry_param=0.05, smoothness_param=1000000.0, max_iters=10, conv_thresh=1e-05, verbose=False)[source]
Perform asymmetric least squares baseline removal. * http://www.science.uva.nl/~hboelens/publications/draftpub/Eilers_2005.pdf
smoothness_param: Relative importance of smoothness of the predicted response. asymmetry_param (p): if y > z, w = p, otherwise w = 1-p.
Setting p=1 is effectively a hinge loss.
libpyhat.transform.baseline_code.common module
- class libpyhat.transform.baseline_code.common.Baseline[source]
Bases:
object
libpyhat.transform.baseline_code.dietrich module
- class libpyhat.transform.baseline_code.dietrich.Dietrich(half_window=16, num_erosions=10)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.dietrich.dietrich_baseline(bands, intensities, half_window=16, num_erosions=10)[source]
Fast and precise automatic baseline correction of … NMR spectra, 1991. http://www.sciencedirect.com/science/article/pii/002223649190402F http://www.inmr.net/articles/AutomaticBaseline.html
libpyhat.transform.baseline_code.fabc module
- class libpyhat.transform.baseline_code.fabc.FABC(dilation_param=50, smoothness_param=1000.0)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.fabc.fabc_baseline(intensities, dilation_param=50, smoothness_param=1000.0)[source]
Fully Automatic Baseline Correction, by Carlos Cobas (2006). http://www.sciencedirect.com/science/article/pii/S1090780706002266
libpyhat.transform.baseline_code.kajfosz_kwiatek module
- class libpyhat.transform.baseline_code.kajfosz_kwiatek.KajfoszKwiatek(top_width=0, bottom_width=50, exponent=2, tangent=False)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.kajfosz_kwiatek.kajfosz_kwiatek_baseline(bands, intensities, top_width=0, bottom_width=50, exponent=2, tangent=False)[source]
This function uses an enhanced version of the algorithm published by Kajfosz, J. and Kwiatek, W.M. (1987) “Non-polynomial approximation of background in x-ray spectra.” Nucl. Instrum. Methods B22, 78-81.
- top_width:
Specifies the width of the polynomials which are concave upward. The top_width is the full width in energy units at which the magnitude of the polynomial is 0.1 of max. The default is 0, which means that concave upward polynomials are not used.
- bottom_width:
Specifies the width of the polynomials which are concave downward. The bottom_width is the full width in energy units at which the magnitude of the polynomial is 0.1 of max. The default is 50.
- exponent:
Specifies the power of polynomial which is used. The power must be an integer. The default is 2, i.e. parabolas. Higher exponents, for example EXPONENT=4, results in polynomials with flatter tops and steeper sides, which can better fit spectra with steeply sloping backgrounds.
- tangent:
Specifies that the polynomials are to be tangent to the slope of the spectrum. The default is vertical polynomials. This option works best on steeply sloping spectra. It has trouble in spectra with big peaks because the polynomials are very tilted up inside the peaks.
For more info, see: cars9.uchicago.edu/software/idl/mca_utility_routines.html#FIT_BACKGROUND
libpyhat.transform.baseline_code.median module
libpyhat.transform.baseline_code.min_spline module
This baseline removal method is a simple alternative inspired by the wavelet+spline method described for ChemCam. It divides the spectrum up into windows of a user-specified size, finds the minimum value within each window that is also a local minimum, and then fits a cubic spline.
libpyhat.transform.baseline_code.polyfit module
- class libpyhat.transform.baseline_code.polyfit.PolyFit(poly_order=5, num_stdv=3.0)[source]
Bases:
Baseline
- libpyhat.transform.baseline_code.polyfit.polyfit_baseline(bands, intensities, poly_order=5, num_stdv=3.0, max_iter=200)[source]
Iteratively fits a polynomial, discarding far away points as peaks. Similar in spirit to ALS and related methods. Automated method for subtraction of fluorescence from biological Raman spectra Lieber & Mahadevan-Jansen 2003
libpyhat.transform.baseline_code.rubberband module
libpyhat.transform.baseline_code.wavelet_a_trous module
Algorithm based on Appendix A of Starck, J.L., Murtagh, F., 2006. Handbook of Astronomical Data Analysis, 2nd ed. Springer-Verlag.
This is the algorithm used as the basis for ChemCam’s denoise and baseline removal as described in Wiens, R.C., et al., 2013. Pre-flight calibration and initial data processing for the ChemCam laser-induced breakdown spectroscopy instrument on the Mars Science Laboratory rover. Spectrochimica Acta Part B: Atomic Spectroscopy 82, 1–27. doi:10.1016/j.sab.2013.02.003
libpyhat.transform.baseline_code.wavelet_spline module
This baseline removal method is based on the description of continuum removal in Wiens, R.C., et al., 2013. Pre-flight calibration and initial data processing for the ChemCam laser-induced breakdown spectroscopy instrument on the Mars Science Laboratory rover. Spectrochimica Acta Part B: Atomic Spectroscopy 82, 1–27. doi:10.1016/j.sab.2013.02.003
It uses the wavelet a trous algorithm described in Starck, J.L., Murtagh, F., 2006. Handbook of Astronomical Data Analysis, 2nd ed. Springer-Verlag. to decompose the spectrum, then reconstructs the spectrum up to a specified level, finds the local minima in that smoothed spectrum, then fits a cubic spline to the nearest local minima in the actual spectrum.
Note: this doesn’t give identical results to the continuum removal used by ChemCam, but it is pretty close.