API Reference¶
-
class
cpyMSpec.spectrum.CentroidedSpectrum[source]¶ Bases:
cpyMSpec.spectrum.SpectrumBaseCentroided peaks of a profile/theoretical spectrum
-
charged(charge)[source]¶ Adds/subtracts electrons and returns a new object.
Parameters: charge (integer) – number of electrons to add Returns: a spectrum with appropriately shifted masses Return type: CentroidedSpectrum
-
copy()[source]¶ Returns: a (deep) copy of the instance Return type: CentroidedSpectrum
-
trimmed(n_peaks)[source]¶ Parameters: n_peaks – number of peaks to keep Returns: an isotope pattern with removed low-intensity peaks Return type: CentroidedSpectrum
-
-
class
cpyMSpec.spectrum.InstrumentModel(instrument_type, resolving_power, at_mz=200)[source]¶ Bases:
object
-
class
cpyMSpec.spectrum.ProfileSpectrum(mzs, intensities)[source]¶ Bases:
cpyMSpec.spectrum.SpectrumBaseRepresents profile spectrum data, which means: * neighbor mass differences are supposed to be locally approximately equal; * occasional gaps might be present, indicating zero-intensity regions
-
centroids(window_size=5)[source]¶ Detects peaks in raw data.
Parameters: - mzs – sorted array of m/z values
- intensities – array of corresponding intensities
- window_size – size of m/z averaging window
Returns: isotope pattern containing the centroids
Return type:
-
copy()[source]¶ Returns: a (deep) copy of the instance Return type: ProfileSpectrum
-
-
class
cpyMSpec.spectrum.SpectrumBase[source]¶ Bases:
object-
addCharge(charge)[source]¶ Adds/subtracts mass of electrons in-place. such that the charge increases by the specified amount.
Parameters: charge (integer) – number of electrons to add
-
intensities¶ Returns: peak intensities Return type: list of floats
-
masses¶ Returns: peak masses Return type: list of floats
-
size¶ Returns: number of peaks in the spectrum Return type: int
-
-
class
cpyMSpec.spectrum.TheoreticalSpectrum[source]¶ Bases:
cpyMSpec.spectrum.SpectrumBaseA bag of isotopic peaks computed for a single or multiple sum formulas.
-
centroids(instrument, min_abundance=0.0001, points_per_fwhm=25)[source]¶ Estimates centroided peaks for a given instrument model.
Parameters: - instrument – instrument model
- min_abundance – minimum abundance for including a peak
- points_per_fwhm – grid density used for envelope calculation
Returns: peaks visible with the instrument used
Return type:
-
-
cpyMSpec.spectrum.isotopePattern(sum_formula, threshold=0.0001, rel_threshold=True, desired_prob=None)[source]¶ Calculates isotopic peaks for a sum formula.
Parameters: - sum_formula (str) – text representation of an atomic composition
- threshold (float) – minimum peak abundance
- rel_threshold (bool) – if True, threshold is relative to the highest peak, otherwise it is a probability
- desired_prob (float | None) – total probability covered by the result; if set, threshold parameter is ignored