mocca.decomposition namespace
Submodules
mocca.decomposition.alternative_objective_funcs module
Created on Wed Feb 23 09:17:34 2022
@author: haascp
- mocca.decomposition.alternative_objective_funcs.get_all_comp_sum(parafac_factors, comp_tensor_shape, show_parafac_analytics)[source]
Iterative PARAFAC approach is a maximization problem. Based on the component tensor data shape, the maximal sum of integrals is found for every component part in the data tensor. The integrals of these component integrals are summed up. This sum is the maximization objective for the iterative PARAFAC approach.
- mocca.decomposition.alternative_objective_funcs.get_all_non_comp_sum(parafac_factors, comp_tensor_shape, show_parafac_analytics)[source]
Iterative PARAFAC approach is a minimization problem. Based on the component tensor data shape, the maximal sum of integrals is found for every component part in the data tensor. The integrals of all other components in this component part are summed up and should be ideally zero (only component spectrum contributes to component part of tensor). This final sum is the minimization objective for the iterative PARAFAC approach.
- mocca.decomposition.alternative_objective_funcs.get_comp_sum(parafac_factors, start_slice, end_slice)[source]
Get summed integrals from the highest inegral component in one slice of PARAFAC factors.
- mocca.decomposition.alternative_objective_funcs.get_impure_integral_sum(parafac_factors, show_parafac_analytics)[source]
This objective function assumes that the PARAFAC model is best, when the summed integral of all components in the impure peak slice is maximized.
mocca.decomposition.data_tensor module
Created on Fri Jan 14 09:04:46 2022
@author: haascp
- mocca.decomposition.data_tensor.create_data_tensor(parafac_data)[source]
Takes a list of peak data and returns a data tensor in the format used for PARAFAC decomposition.
- mocca.decomposition.data_tensor.get_comp_peak_data_list(relevant_comp, boundaries, iter_offset)[source]
Returns a list of maximum-aligned peak data of the comp peaks of the relevant components. Moreover, returns the shape of the component list (how many slices per component in the list).
- mocca.decomposition.data_tensor.get_comp_peaks(relevant_comp)[source]
Returns exactly five peaks from which the given component was created. If less than 5 peaks were used to create the component, the peaks are multiplied as long as five peaks are reached.
- mocca.decomposition.data_tensor.get_offset_peak_to_comp(created_from_peak, comp)[source]
Returns the time offset of the maxima of oeak and quali component.
- mocca.decomposition.data_tensor.get_parafac_tensor(impure_peak, quali_comp_db, iter_offset, show_parafac_analytics)[source]
Processor function of the data tensor creation. Takes in the impure peak, the qualitative component db and an iteration offset and returns a DataTensor object which is used for PARAFAC decomposition.
- mocca.decomposition.data_tensor.get_relevant_comp(impure_peak, quali_comp_db)[source]
Returns component which is not unknown or impurity (-> only components which were given by the user via compound) and which overlap with the impure peak. If multiple components overlapping the component with the best UV-Vis correlation coefficient is returned.
- mocca.decomposition.data_tensor.get_tensor_boundaries(impure_peak, relevant_comp, iter_offset)[source]
Returns a tuple containing the leftest and rightest peak/component boundaries. The boundaries are corrected by the iteration offset if the iterative PARAFAC algorithm is used.
- mocca.decomposition.data_tensor.get_zero_ext_impure_peak_data(impure_peak, boundaries, iter_offset)[source]
Returns zero-extended (to the boundaries) peak data of the impure peak. The location of the peak is corrected by the iteration offset in case the iterative PARAFAC algorithm is applied.
- mocca.decomposition.data_tensor.get_zero_extended_peak_data(peak_data, left, boundaries)[source]
Returns zero-extended (to the boundaries) peak data.
mocca.decomposition.iterative_parafac module
Created on Sun Jan 16 11:15:19 2022
@author: haascp
mocca.decomposition.model module
Created on Tue Feb 22 11:15:42 2022
@author: haascp
- class mocca.decomposition.model.DataTensor(tensor: ndarray, boundaries: tuple, relevant_comp: QualiComponent, comp_tensor_shape: tuple, y_offset: float)[source]
Bases:
object
Model of data tensors used as input for the PARAFAC decomposition algorithm.
- relevant_comp: QualiComponent
- class mocca.decomposition.model.ParafacModel(impure_peak: CorrectedPeak | IntegratedPeak, n_comps: int, pca_explained_variance: list, weights: list, factors: list, data_tensor: DataTensor, iter_offset: int, iter_objective_func: list | None = None, peaks: List[CorrectedPeak | IntegratedPeak] | None = None)[source]
Bases:
object
Stores all relevant information of a PARAFAC model.
- create_parafac_peaks(absorbance_threshold, spectrum_correl_coef_thresh)[source]
If two UV-Vis traces in the PARAFAC components are too similar, no PARAFAC peaks are created. PARAFAC peaks’ dataseta are created synthetically generated by using the PARAFAC factors of the model and filling the rest of the array up with zeros. PARAFAC peaks get an index of -impure_peak.idx
- data_tensor: DataTensor
- impure_peak: CorrectedPeak | IntegratedPeak
- peaks: List[CorrectedPeak | IntegratedPeak] | None = None
mocca.decomposition.parafac_funcs module
Created on Fri Jan 14 08:57:14 2022
@author: haascp
- mocca.decomposition.parafac_funcs.estimate_pca_n_comps(data_tensor, impure_peak, show_parafac_analytics)[source]
Returns an estimate of the number of components in the impure peak.
mocca.decomposition.utils module
Created on Fri Jan 14 09:01:51 2022
@author: haascp
- mocca.decomposition.utils.check_absorbance_thresh(parafac_peak, absorbance_threshold)[source]
Checks if maximum absorbance in synthetically created PARAFAC peak dataset exceeds absorbance threshold.
- mocca.decomposition.utils.check_any_compound_overlap(peak, quali_comp_db)[source]
Checks if a given peak overlaps with any component in the quali_comp_db.
- mocca.decomposition.utils.check_comp_in_impure(parafac_model, absorbance_threshold)[source]
Checks if the maximum absorbance of the known PARAFAC component in the impure peak exceeds the absorbance threshold.
- mocca.decomposition.utils.check_comp_overlap(peak, comp)[source]
Checks if a given peak overlaps with a given component.