tidyms.MSSpectrum¶
- class MSSpectrum(mz: ndarray, spint: ndarray, time: float | None = None, ms_level: int = 1, polarity: int | None = None, instrument: str = 'qtof', is_centroid: bool = True)¶
Representation of a Mass Spectrum. Manages conversion to centroid and plotting of data.
- Attributes:
- mzarray
m/z data
- spintarray
Intensity data
- timefloat or None
Time at which the spectrum was acquired
- ms_levelint
MS level of the scan
- polarityint or None
Polarity used to acquire the data.
- instrument{“qtof”, “orbitrap”}, default=”qtof”
MS instrument type. Used to set default values in methods.
- is_centroidbool
True if the data is in centroid mode.
- find_centroids(min_snr: float = 10.0, min_distance: float | None = None) Tuple[ndarray, ndarray]¶
Find centroids in the spectrum.
- Parameters:
- min_snrpositive number, default=10.0
Minimum signal-to-noise ratio of the peaks.
- min_distancepositive number or None, default=None
Minimum distance between consecutive peaks. If
None, the value is set to 0.01 ifself.instrumentis"qtof"or to 0.005 ifself.instrumentis"orbitrap".
- Returns:
- centroidarray
m/z centroids. If
self.is_centroidisTrue, returnsself.mz.- areaarray
peak area. If
self.is_centroidisTrue, returnsself.spint.
- plot(fig_params: dict | None = None, line_params: dict | None = None, show: bool = True) figure¶
Plot the spectrum using Bokeh.
- Parameters:
- fig_paramsdict or None, default=None
key-value parameters to pass to
bokeh.plotting.figure.- line_paramsdict, or None, default=None
key-value parameters to pass to
bokeh.plotting.figure.line.- showbool, default=True
If True calls
bokeh.plotting.showon the Figure.
- Returns:
- bokeh.plotting.figure