Mobilogram#
- class pyopenms.Mobilogram#
Bases:
objectThe representation of a 1D ion mobilogram. Raw data access is provided by get_peaks, peaks_struct, and set_peaks. Indexing and iteration yield copies of the peaks; write changes back with mob[i] = peak Extra data arrays can be accessed through getFloatDataArrays / getIntegerDataArrays / getStringDataArrays
Usage:
rt = mobilogram.getRT() drift_time_unit = mobilogram.getDriftTimeUnit() mobility, intensities = mobilogram.get_peaks()
- __init__() None#
- __init__(arg: pyopenms.Mobilogram, /) None
Methods
__init__()Compute the total ion count (sum of all peak intensities)
clear()Clears all data: deletes all peaks, associated data arrays (float, integer, string), and resets the mobility and intensity ranges
Clear all ranges
df_columns([columns])Returns a list of column names that to_df() would produce.
findNearest(mb)Overloaded function.
Returns the ion mobility drift time unit
Returns the ion mobility drift time unit as string
Get float data arrays
Returns a copy of the integer data arrays
Get maximum intensity value
Get maximum mobility value
Get minimum intensity value
Get minimum mobility value
getRT()Returns the retention time (in seconds)
Returns a copy of the string data arrays
get_data_dict([columns])Returns a dictionary of NumPy arrays with mobility, intensities, and metadata.
get_df(*args, **kwargs)Deprecated: Use to_df() instead.
get_df_columns(*args, **kwargs)Deprecated: Use df_columns() instead.
Get mobility and intensity arrays as numpy arrays
isSorted()Checks if all peaks are sorted with respect to ascending mobility
Returns zero-copy structured array with fields 'mobility' (float64) and 'intensity' (float32).
push_back(peak)Add a peak
reserve(new_size)resize(new_size)Resize the peak array
setDriftTimeUnit(dt)Sets the ion mobility drift time unit
setFloatDataArrays(fda)Set float data arrays
setIntegerDataArrays(ida)Sets the integer data arrays
setRT(rt)Sets the retention time (in seconds)
setStringDataArrays(sda)Sets the string data arrays
set_peaks(mob, intensity[, metadata])Overloaded function.
size()Returns the number of peaks
sortByIntensity([reverse])Lexicographically sorts the peaks by their intensity Sorts the peaks according to ascending intensity (lowest to highest) when reverse is False.
Lexicographically sorts the peaks by their position (mobility)
to_arrow([columns])Returns an Apache Arrow Table representation of the Mobilogram.
to_df([columns])Returns a pandas DataFrame representation of the Mobilogram.
- calculateTIC() float#
Compute the total ion count (sum of all peak intensities)
- clear() None#
Clears all data: deletes all peaks, associated data arrays (float, integer, string), and resets the mobility and intensity ranges
- clearRanges() None#
Clear all ranges
- df_columns(columns='default')#
Returns a list of column names that to_df() would produce.
- findNearest(mb: float) int#
- findNearest(mb: float, tolerance: float) int
- findNearest(mb: float, tolerance_left: float, tolerance_right: float) int
Overloaded function.
findNearest(mb: float) -> int
Returns the index of the closest peak in mobility
findNearest(mb: float, tolerance: float) -> int
Returns the index of the closest peak in the provided tolerance window (-1 if none match)
findNearest(mb: float, tolerance_left: float, tolerance_right: float) -> int
Returns the index of the closest peak in the provided tolerance window (-1 if none match)
- getDriftTimeUnit() pyopenms.DriftTimeUnit#
Returns the ion mobility drift time unit
- getDriftTimeUnitAsString() str#
Returns the ion mobility drift time unit as string
- getFloatDataArrays() list[pyopenms.FloatDataArray]#
Get float data arrays
- getIntegerDataArrays() list[pyopenms.IntegerDataArray]#
Returns a copy of the integer data arrays
- getMaxIntensity() float#
Get maximum intensity value
- getMaxMobility() float#
Get maximum mobility value
- getMinIntensity() float#
Get minimum intensity value
- getMinMobility() float#
Get minimum mobility value
- getRT() float#
Returns the retention time (in seconds)
- getStringDataArrays() list[pyopenms.StringDataArray]#
Returns a copy of the string data arrays
- get_data_dict(columns=None)#
Returns a dictionary of NumPy arrays with mobility, intensities, and metadata.
- get_df(*args, **kwargs)#
Deprecated: Use to_df() instead.
- get_df_columns(*args, **kwargs)#
Deprecated: Use df_columns() instead.
- get_peaks() tuple#
Get mobility and intensity arrays as numpy arrays
- isSorted() bool#
Checks if all peaks are sorted with respect to ascending mobility
- peaks_struct() object#
Returns zero-copy structured array with fields ‘mobility’ (float64) and ‘intensity’ (float32).
- push_back(peak: pyopenms.MobilityPeak1D) None#
Add a peak
- reserve(new_size: int) None#
- resize(new_size: int) None#
Resize the peak array
- setDriftTimeUnit(dt: pyopenms.DriftTimeUnit) None#
Sets the ion mobility drift time unit
- setFloatDataArrays(fda: collections.abc.Sequence[pyopenms.FloatDataArray]) None#
Set float data arrays
- setIntegerDataArrays(ida: collections.abc.Sequence[pyopenms.IntegerDataArray]) None#
Sets the integer data arrays
- setRT(rt: float) None#
Sets the retention time (in seconds)
- setStringDataArrays(sda: collections.abc.Sequence[pyopenms.StringDataArray]) None#
Sets the string data arrays
- set_peaks(mob: object, intensity: object, metadata: str = 'error') None#
- set_peaks(peaks: object, *, metadata: str = 'error') None
Overloaded function.
set_peaks(mob: object, intensity: object, metadata: str = 'error') -> None
Set mobility and intensity from numpy arrays
The binary data arrays are not resized.
metadatadecides what happens when the new peak count would leave a non-empty float, string or integer data array mis-sized:error(the default) raises and leaves the container untouched,cleardrops the arrays that no longer fit, andkeepkeeps them, leaving the container internally inconsistent. Arrays that are already the right length, and empty ones, are kept in every case, so replacing peaks with an equally long set never touches them.set_peaks(peaks: object, *, metadata: str = 'error') -> None
Set peaks from [mobility_array, intensity_array]
The binary data arrays are not resized.
metadatadecides what happens when the new peak count would leave a non-empty float, string or integer data array mis-sized:error(the default) raises and leaves the container untouched,cleardrops the arrays that no longer fit, andkeepkeeps them, leaving the container internally inconsistent. Arrays that are already the right length, and empty ones, are kept in every case, so replacing peaks with an equally long set never touches them.
- size() int#
Returns the number of peaks
- sortByIntensity(reverse: bool = False) None#
Lexicographically sorts the peaks by their intensity Sorts the peaks according to ascending intensity (lowest to highest) when reverse is False. When reverse is True, sorts by descending intensity (highest to lowest). Meta data arrays will be sorted accordingly
- sortByPosition() None#
Lexicographically sorts the peaks by their position (mobility)
The mobilogram is sorted with respect to position (mobility). Meta data arrays will be sorted accordingly
- to_arrow(columns=None)#
Returns an Apache Arrow Table representation of the Mobilogram.
- to_df(columns=None)#
Returns a pandas DataFrame representation of the Mobilogram.
- updateRanges() None#