pub struct BinaryArrayMap3D {
pub ion_mobility_dimension: Vec<f64>,
pub ion_mobility_type: ArrayType,
pub ion_mobility_unit: Unit,
pub arrays: Vec<BinaryArrayMap>,
pub additional_arrays: BinaryArrayMap,
/* private fields */
}Expand description
Represent a set of BinaryArrayMap that has been split across an
ion mobility dimension.
This effectively removes an ion mobility DataArray and for each unique
value in that array, creates a new BinaryArrayMap with subsets of each
other DataArray that co-occur at the same ion mobility coordinate.
Because BinaryArrayMap3D spreads DataArray over multiple ion mobility
bins, it cannot share a single [ParamList] for each of the dimensions. Instead,
all split ArrayType have their [ParamList] moved to separate storage accessed
using [params_of] and its siblins. These [ParamList] will be propagated by Self::stack
and BinaryArrayMap3D::unstack as appropriate.
Fields§
§ion_mobility_dimension: Vec<f64>§ion_mobility_type: ArrayType§ion_mobility_unit: Unit§arrays: Vec<BinaryArrayMap>§additional_arrays: BinaryArrayMapImplementations§
Source§impl BinaryArrayMap3D
impl BinaryArrayMap3D
Sourcepub fn from_ion_mobility_dimension(
ion_mobility_dimension: Vec<f64>,
ion_mobility_type: ArrayType,
ion_mobility_unit: Unit,
) -> BinaryArrayMap3D
pub fn from_ion_mobility_dimension( ion_mobility_dimension: Vec<f64>, ion_mobility_type: ArrayType, ion_mobility_unit: Unit, ) -> BinaryArrayMap3D
Create an empty BinaryArrayMap3D with a defined ion mobility dimension
but no content at each ion mobility point.
§Panics
If the ion mobility dimension contains a NaN value
Sourcepub fn from_ion_mobility_dimension_and_arrays(
ion_mobility_dimension: Vec<f64>,
ion_mobility_type: ArrayType,
ion_mobility_unit: Unit,
arrays: Vec<BinaryArrayMap>,
) -> BinaryArrayMap3D
pub fn from_ion_mobility_dimension_and_arrays( ion_mobility_dimension: Vec<f64>, ion_mobility_type: ArrayType, ion_mobility_unit: Unit, arrays: Vec<BinaryArrayMap>, ) -> BinaryArrayMap3D
Construct a BinaryArrayMap3D from a defined ion mobility dimension and
a Vec of BinaryArrayMap at each point.
§Panics
If the ion mobility dimension contains a NaN value or ion_mobility_dimension.len() != arrays.len()
Sourcepub fn params_of(&self, array_type: &ArrayType) -> Option<&Vec<Param>>
pub fn params_of(&self, array_type: &ArrayType) -> Option<&Vec<Param>>
Get a reference to the [ParamList] for the specified ArrayType, if one exists.
§See also
Self::params_of_mutto mutate existing [ParamList] for extantArrayTypeSelf::insert_params_ofto create or overwrite the [ParamList] for anArrayType
Sourcepub fn params_of_mut(
&mut self,
array_type: &ArrayType,
) -> Option<&mut Vec<Param>>
pub fn params_of_mut( &mut self, array_type: &ArrayType, ) -> Option<&mut Vec<Param>>
Get a mutable reference to the [ParamList] for the specified ArrayType, if one exists.
§See also
Self::params_ofto read existing [ParamList] for extantArrayTypeSelf::insert_params_ofto create or overwrite the [ParamList] for anArrayTypeSelf::params_of_entryto create or modify the [ParamList] using a lower level Entry API
Sourcepub fn params_of_entry(
&mut self,
array_type: ArrayType,
) -> Entry<'_, ArrayType, Vec<Param>>
pub fn params_of_entry( &mut self, array_type: ArrayType, ) -> Entry<'_, ArrayType, Vec<Param>>
A lower level create or update version of Self::insert_params_of that uses the
underlying HashMap’s Entry API
Sourcepub fn insert_params_of(
&mut self,
array_type: ArrayType,
params: Vec<Param>,
) -> Option<Vec<Param>>
pub fn insert_params_of( &mut self, array_type: ArrayType, params: Vec<Param>, ) -> Option<Vec<Param>>
Set the [ParamList] for the specified ArrayType.
Returns any previous [ParamList] associated with that ArrayType.
§See also
Self::params_ofto read existing [ParamList] for extantArrayTypeSelf::params_of_mutto mutate existing [ParamList] for extantArrayTypeSelf::params_of_entryto create or modify the [ParamList] using a lower level Entry API
Sourcepub fn get_ion_mobility(&self, ion_mobility: f64) -> Option<&BinaryArrayMap>
pub fn get_ion_mobility(&self, ion_mobility: f64) -> Option<&BinaryArrayMap>
Get the associated arrays at the requested ion mobility, if they exist
Sourcepub fn search_ion_mobility(
&self,
ion_mobility: f64,
error_tolerance: f64,
) -> Option<(&BinaryArrayMap, f64)>
pub fn search_ion_mobility( &self, ion_mobility: f64, error_tolerance: f64, ) -> Option<(&BinaryArrayMap, f64)>
Perform a binary search on the ion mobility dimension and find the nearest
point to ion_mobility within error_tolerance absolute distance.
Returns the BinaryArrayMap at that point and the distance from ion_mobility
matched.
Sourcepub fn search_ion_mobility_index(
&self,
ion_mobility: f64,
error_tolerance: f64,
) -> Option<(usize, f64)>
pub fn search_ion_mobility_index( &self, ion_mobility: f64, error_tolerance: f64, ) -> Option<(usize, f64)>
Perform a binary search on the ion mobility dimension and find the nearest
point to ion_mobility within error_tolerance absolute distance.
Unlike Self::search_ion_mobility, this returns the index in the ion mobility
dimension that matched and the ion mobility value at that index.
Sourcepub fn get_ion_mobility_mut(
&mut self,
ion_mobility: f64,
) -> Option<&mut BinaryArrayMap>
pub fn get_ion_mobility_mut( &mut self, ion_mobility: f64, ) -> Option<&mut BinaryArrayMap>
Get the a mutable reference to the associated arrays at the requested ion mobility, if they exist.
The ion mobility value must be an exact match
Sourcepub fn iter(&self) -> impl Iterator<Item = (f64, &BinaryArrayMap)>
pub fn iter(&self) -> impl Iterator<Item = (f64, &BinaryArrayMap)>
Iterate over the ion mobility dimension and associated arrays at each point.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (f64, &mut BinaryArrayMap)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (f64, &mut BinaryArrayMap)>
Iterate over the ion mobility dimension and a mutable reference to the associated arrays at each point.
Sourcepub fn unstack(&self) -> Result<BinaryArrayMap, ArrayRetrievalError>
pub fn unstack(&self) -> Result<BinaryArrayMap, ArrayRetrievalError>
Flatten this array into a single BinaryArrayMap.
The flattened map is sorted by m/z and ion mobility. If no m/z array is found, no sorting is done, and the flattened order is left in roughly ion mobility sorted order.
§Errors
ArrayRetrievalError errors related to array decoding occur if
any DataArray cannot be decoded, or if an expected array is absent.
Sourcepub fn stack(source: &BinaryArrayMap) -> Result<Self, ArrayRetrievalError>
pub fn stack(source: &BinaryArrayMap) -> Result<Self, ArrayRetrievalError>
Convert a BinaryArrayMap into a BinaryArrayMap3D if it has an ion mobility dimension.
Any arrays that aren’t the same length as the ion mobility dimension will be in
BinaryArrayMap3D::additional_arrays.
This uses exact ion mobility values as keys, bit-level equality. If ion mobility values are computed, they may vary at trivial bits and be equivalent, but not equal.
§Errors
ArrayRetrievalError errors related to array decoding occur if any DataArray
cannot be decoded, or if an expected array is absent.
Trait Implementations§
Source§impl Clone for BinaryArrayMap3D
impl Clone for BinaryArrayMap3D
Source§fn clone(&self) -> BinaryArrayMap3D
fn clone(&self) -> BinaryArrayMap3D
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BinaryArrayMap3D
impl Debug for BinaryArrayMap3D
Source§impl Default for BinaryArrayMap3D
impl Default for BinaryArrayMap3D
Source§fn default() -> BinaryArrayMap3D
fn default() -> BinaryArrayMap3D
Source§impl TryFrom<&BinaryArrayMap3D> for BinaryArrayMap
A BinaryArrayMap aliases TryFrom on BinaryArrayMap3D with BinaryArrayMap3D::unstack
impl TryFrom<&BinaryArrayMap3D> for BinaryArrayMap
A BinaryArrayMap aliases TryFrom on BinaryArrayMap3D with BinaryArrayMap3D::unstack
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
Source§impl TryFrom<&BinaryArrayMap> for BinaryArrayMap3D
A BinaryArrayMap3D aliases TryFrom on BinaryArrayMap with BinaryArrayMap3D::stack
impl TryFrom<&BinaryArrayMap> for BinaryArrayMap3D
A BinaryArrayMap3D aliases TryFrom on BinaryArrayMap with BinaryArrayMap3D::stack
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
Source§impl TryFrom<BinaryArrayMap3D> for BinaryArrayMap
impl TryFrom<BinaryArrayMap3D> for BinaryArrayMap
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
Source§impl TryFrom<BinaryArrayMap> for BinaryArrayMap3D
impl TryFrom<BinaryArrayMap> for BinaryArrayMap3D
Source§fn try_from(value: BinaryArrayMap) -> Result<Self, Self::Error>
fn try_from(value: BinaryArrayMap) -> Result<Self, Self::Error>
A wrapper around BinaryArrayMap3D::stack