massdash.structs.Data1D
- class massdash.structs.Data1D(data: array, intensity: array, label: str = 'None')
Bases:
ABCAbstract class of storing a 1D data set where have the data vs intensity
- adjust_length(length)
Adjusts the length of the Data1D object.
If the length is smaller than the current length, the data will be sliced to the given length. If the length is larger than the current length, the data will be padded with zeros on both sides.
E.g. if the data array is [1, 2, 3] and the desired length is 7, the returned array will be [0, 0, 1, 2, 3, 0, 0].
E.g. if the data array is [1, 2, 3] and the desired length is 1, the returned data array will be [1].
Pad the data and intensity arrays with zeros to a given length. Modifies the object in place.
- Parameters:
length (int) – The length of the output array
- Returns:
tuple of padded/truncated data and intensity
- Return type:
(new_data, new_intensity)
- empty() bool
Check if the Chromatogram is empty.
- Returns:
True if both rt and intensity are empty, False otherwise.
- Return type:
bool
- filter(boundary: Tuple[float, float]) cls
Filter the 1D object to only include data points within a given boundary.
- Parameters:
boundary (tuple) – A tuple containing the left and right boundaries of the region of interest. The unit is either m/z, IM or RT depending on underlying object
- Returns:
A Data1D child (Chromatogram, Mobilogram, Spectrum) copy with filtered intensity values.
- Return type:
Data1D instance
- max(boundary: ~typing.Tuple[float, float] | None = None) -> (<class 'float'>, <class 'float'>)
Calculate the highest intensity within a given boundary.
- Parameters:
boundary (tuple) – A tuple containing the left and right boundaries.
- Returns:
The highest intensity within the given boundary.
- Return type:
float
- median(boundary: Tuple[float, float] | None = None) float
Calculate the median intensity of a given boundary in the chromatogram data.
- Parameters:
chrom_data (list) – A list of tuples containing the retention time and intensity values of a chromatogram.
boundary (tuple) – A tuple containing the left and right boundaries of the region of interest.
- Returns:
The median intensity value of the data points within the given boundary.
- Return type:
float
- sum(boundary: Tuple[float, float] | None = None) float
Calculates the integrated intensity of a chromatogram within a given boundary.
- Parameters:
boundary (tuple) – A tuple containing the left and right boundaries of the integration range.
- Returns:
The integrated intensity of the chromatogram within the given boundary.
- Return type:
float
- toPandasDfHelper_(columnName) DataFrame
Helper for converting a 1D data to pandas dataframe