libpyhat.transform package
Subpackages
- libpyhat.transform.baseline_code package
- Submodules
- libpyhat.transform.baseline_code.airpls module
- libpyhat.transform.baseline_code.als module
- libpyhat.transform.baseline_code.common module
- libpyhat.transform.baseline_code.dietrich module
- libpyhat.transform.baseline_code.fabc module
- libpyhat.transform.baseline_code.kajfosz_kwiatek module
- libpyhat.transform.baseline_code.median module
- libpyhat.transform.baseline_code.min_spline module
- libpyhat.transform.baseline_code.polyfit module
- libpyhat.transform.baseline_code.rubberband module
- libpyhat.transform.baseline_code.wavelet_a_trous module
- libpyhat.transform.baseline_code.wavelet_spline module
- Module contents
- libpyhat.transform.dim_reductions package
Submodules
libpyhat.transform.cal_tran module
- class libpyhat.transform.cal_tran.admm_ds(rho=1, beta=0.2, epsilon=1e-05, max_iter=100, verbose=True, reg='lasso')[source]
Bases:
object
- libpyhat.transform.cal_tran.call_cal_tran(A, B, C, dataAmatchcol, dataBmatchcol, params, spect_label='wvl', dataAname='A', dataBname='B', dataCname='C')[source]
- class libpyhat.transform.cal_tran.forward_backward_ds(t=0.001, svt=1, l1=1, epsilon=1e-05, max_iter=20, verbose=True)[source]
Bases:
object
- class libpyhat.transform.cal_tran.ipd_ds(t=0.0002, svt=10, l1=10, epsilon=1e-05, max_iter=50, verbose=True)[source]
Bases:
object
libpyhat.transform.cal_tran_cv module
libpyhat.transform.caltran_utils module
- libpyhat.transform.caltran_utils.check_data(data1, data2, label1, label2, spect_label='wvl')[source]
- libpyhat.transform.caltran_utils.prepare_data(A, B, metaColNameA='Target', metaColNameB='Target', averageRepeats=True, colvar='wvl', meta_label='meta')[source]
- libpyhat.transform.caltran_utils.soft_thresh(X, thresh)[source]
Solves argmin_X 1/2 ||X-Y||_F^2 + thresh ||X||_1 proximal operator for l1-norm (sparsifier) See: http://www.simonlucey.com/soft-thresholding/
- libpyhat.transform.caltran_utils.svt_thresh(X, thresh)[source]
Solves argmin_X 1/2 ||X-Y||_F^2 + thresh ||X||_* proximal operator for spectral norm (rank reducer) See: http://www-stat.stanford.edu/~candes/papers/SVT.pdf
libpyhat.transform.continuum module
- libpyhat.transform.continuum.continuum_correction(data, fit_wvls, method='linear', poly_order=2, divide=True, verbose=True)[source]
- libpyhat.transform.continuum.linear(data, fit_wvls)[source]
Compute a continuum using a line between two points
Parameters
data : PyHAT spectral data object
fit_wvls: [x1,x2] x1: lower wavelength to use as line starting point x2: higher wavelength to use as line end point
Returns: y: Array of y values at all wavelengths in the data object (not just those used in the fit)
- libpyhat.transform.continuum.polynomial(data, fit_wvls, order=2)[source]
Compute a continuum using a polynomial fit.
Parameters
data : PyHAT spectral data object
fit_wvls: The wavelengths over which to perform the fit
Returns: y: Array of y values at all wavelengths in the data object (not just those used in the fit)
- libpyhat.transform.continuum.regression(data, fit_wvls)[source]
Compute a continuum using a standard linear regression.
Parameters
data : PyHAT spectral data object
fit_wvls: The wavelengths over which to perform the fit
Returns: y: Array of y values at all wavelengths in the data object (not just those used in the fit)
libpyhat.transform.deriv module
libpyhat.transform.dim_red module
libpyhat.transform.interp module
libpyhat.transform.lra module
Low Rank Alignment algorithm by T. Boucher and C.J. Carey from https://github.com/all-umass/low_rank_alignment This method has been demonstrated to be effective for calibration transfer on LIBS spectra: http://www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/download/9972/9880
- libpyhat.transform.lra.dollar_sign(num_s_points, num_bar_points)[source]
returns a tuple of (3d points, 1d labels)
libpyhat.transform.mask module
libpyhat.transform.meancenter module
Created on Sun Mar 27 13:07:07 2016
@author: [username deleted]
libpyhat.transform.multiply_vector module
libpyhat.transform.norm module
libpyhat.transform.peak_area module
libpyhat.transform.remove_baseline module
libpyhat.transform.scale module
libpyhat.transform.shift_spect module
- libpyhat.transform.shift_spect.shift_spect(df, shifts, spect_label='wvl', meta_label='meta')[source]
This function takes a data frame containing spectra and shifts them by a specified amount.
Arguments: df = The data frame. Spectra should be stored in rows, with each column having a multi-indexed column name. The
top level should be the specified ‘spect_label’ string, the second level should be a floating point value indicating the wavelength.
shifts = The amounts by which the spectra should be shifted. spect_label = the string used to label spectral data. Defaults to ‘wvl’
libpyhat.transform.smooth module
- libpyhat.transform.smooth.boxcar(y, window_size=3, axis=0, **kwargs)[source]
Smooth the input vector using the mean of the neighboring values, where neighborhood size is defined by the window.
Parameters
- yarray
The vector to be smoothed.
- window_sizeint
An odd integer describing the window size.
- axisint
Ignored in the 1d case. In the 2d case, this is the axis along which to apply the convolution.
Returns
- : array
The smoothed array.
libpyhat.transform.stretch module
- libpyhat.transform.stretch.gethist_cdf(array, num_bins=128)[source]
This function calculates the cumulative distribution function of a given array and requires that both the input array and the number of bins be provided.
Parameters
- arrayndarray
(n,m,p) array
Returns Returns: ———-
- : cdf
A CDF (cumulative distribution function) graph that can be used for plotting.
- : bins
The bins of the associated CDF graph
- libpyhat.transform.stretch.histequ_stretch(array)[source]
Stretch a given ndarray using a histogram
Parameters
- arrayndarray
(n,m,p) array
Returns
- : ndarray
the processed ndarray
- libpyhat.transform.stretch.inverse_stretch(array)[source]
Stretch a given ndarray using the inverse
Parameters
- arrayndarray
(n,m,p) array
Returns
- : ndarray
the processed ndarray