pyMSpec package¶
Subpackages¶
Submodules¶
pyMSpec.MSdataset module¶
pyMSpec.centroid_detection module¶
-
pyMSpec.centroid_detection.estimate_centroid_simple_weighting(mzs, intensities, indices_list, peak_width_bins)[source]¶ Simple averaging to estimate the peak centroid Input:
mzs: profile spectrum mzs intensities: profile spectrum intensities indices_list: mz bin of local maxima- Output:
- mzs_c: centroids mzs intensities_c: centroid intensity (==peak maxima)
-
pyMSpec.centroid_detection.gradient_purePython(mzs, intensities, min_intensity, peak_width_bins)[source]¶ This function takes a vector of intensities and finds local maxima based on turning points in the first differential. It is a trivial algorithm that assumes sufficient signal processing has been performed that the spectra are locally smooth. Input
mzs: list of mz values for profile spectrum intensities: list of intensity values. must be same length as mzs- Output:
- mzs_c: list of apex mzs intensites_c: list of apex intensities
pyMSpec.instrument module¶
-
pyMSpec.instrument.Synapt¶ alias of
ConstantResolvingPower
-
pyMSpec.instrument.TOF¶ alias of
ConstantResolvingPower
-
pyMSpec.instrument.TOF_reflector¶ alias of
ConstantResolvingPower
-
pyMSpec.instrument.qTOF¶ alias of
ConstantResolvingPower
pyMSpec.mass_spectrum module¶
-
class
pyMSpec.mass_spectrum.MSn_spectrum(ms_level='')[source]¶ Bases:
pyMSpec.mass_spectrum.MassSpectruma data container for fragmentation spectrum
-
class
pyMSpec.mass_spectrum.MassSpectrum(profile_spec=[], centroid_spec=[])[source]¶ a data container for a single mass spectrum includes methods for signal processing
-
pyMSpec.mass_spectrum.mass_spectrum¶ alias of
MassSpectrum
pyMSpec.normalisation module¶
-
pyMSpec.normalisation.apply_normalisation(mzs, counts, type_str='', norm_args={})[source]¶ helper function to apply a normalisation function (with some input testing etc) :param counts: numpy array of values to normalise :param type_str: normalisation type to apply (name) :return: numpy array of normalised counts
-
pyMSpec.normalisation.check_zeros(counts)[source]¶ helper function to check if vector is all zero :param counts: :return: bool
-
pyMSpec.normalisation.mad(mzs, counts)[source]¶ normalisation function, divides each intensity by the median-absolute-deviation of all intensities :param counts: numpy array :return:counts normalised: numpy array
-
pyMSpec.normalisation.none(mzs, counts)[source]¶ does nothing, just returns input. is a dummy for programmatic case where a function must be supplied :param counts: numpy array :return: counts:
-
pyMSpec.normalisation.rms(mzs, counts)[source]¶ normalisation function, divides each intensity by the root-mean-square of all intensities :param counts: numpy array :return:counts normalised: numpy array
-
pyMSpec.normalisation.shift_and_scale(counts, scale=1.0, shift=0.0)[source]¶ applys the generic scaling a shifting operation :param counts: numpy array :param scale: float :param shift: float :return: numpy array of scaled and shifted values
-
pyMSpec.normalisation.sqrt(mzs, counts)[source]¶ normalisation function, returns the square root of intensities :param counts: numpy array :return:counts normalised: numpy array
pyMSpec.smoothing module¶
-
pyMSpec.smoothing.apodization(mzs, intensities, w_size=10)[source]¶ apodization with slepian window :param mzs: numpy array numpy array of mz values :param counts: numpy array numpy array of values to smooth :param w_size: int window size :return: mzs: numpy array :return: counts: numpy array
-
pyMSpec.smoothing.apply_smoothing(mzs, counts, type_str='', method_args={})[source]¶ helper function to apply a smoothing function (with some input testing etc) :param counts: numpy array of values to smooth :param type_str: smooting type to apply (name) :return: tuple (mzs: numpy array, counts: numpy array)
-
pyMSpec.smoothing.fast_change(mzs, intensities, diff_thresh=0.01)[source]¶ remove high frequency noise from the data :param mzs: numpy array numpy array of mz values :param counts: numpy array numpy array of values to smooth :param diff_thresh: float numeric change to remove :return: mzs: numpy array :return: counts: numpy array
-
pyMSpec.smoothing.median(mzs, intensities, w_size=3)[source]¶ apply median filter :param mzs: numpy array numpy array of mz values :param counts: numpy array numpy array of values to smooth :param w_size: int window size :return: mzs: numpy array :return: counts: numpy array
-
pyMSpec.smoothing.nosmooth(mzs, intensities)[source]¶ does nothing, just returns input. is a dummy for programmatic case where a function must be supplied :param counts: numpy array :return: mzs: numpy array :return: counts: numpy array
-
pyMSpec.smoothing.rebin(mzs, intensities, delta_mz=0.1)[source]¶ rebin spectrum :param mzs: numpy array numpy array of mz values :param counts: numpy array numpy array of values to smooth :param delta_mz: float, new mz bin width (constant across mz axis) :return: mzs: numpy array :return: counts: numpy array
-
pyMSpec.smoothing.sg_smooth(mzs, intensities, n_smooth=1, w_size=5)[source]¶ sav gol :param mzs: numpy array numpy array of mz values :param counts: numpy array numpy array of values to smooth :param n_smooth: int number of times to apply smoothing :param w_size: int window size :return: mzs: numpy array :return: counts: numpy array