Source code for ccpn.AnalysisMetabolomics.lib.normalisation

import numpy as np

[docs]def pqn(spectrumCluster): totalNormed = tsa(spectrumCluster) avg = totalNormed.mean(axis=0) quotients = totalNormed/avg medians = np.median(quotients, axis=1) pqn = (totalNormed.T/medians).T return pqn
[docs]def tsa(spectra): sums = spectra.sum(axis=1) tsa = (spectra.T / sums).T return tsa
[docs]def getSpectrumCluster(spectra): pointCount = spectra[0].pointCounts[0] array1 = np.empty([len(spectra), pointCount]) for i in range(len(spectra)): array1[i] = spectra[i].getSliceData() return array1
[docs]def updateSpectrumCluster(spectra, spectrumCluster): for i in range(len(spectra)): plot = spectra[i].spectrumViews[0].plot xData = spectra[i].spectrumViews[0].data[0] yData = spectrumCluster[i] plot.setData(xData, yData)