pub struct SensorLayout {
pub name: String,
pub contacts: Vec<SensorSite>,
}Expand description
Physical sensor array geometry layout (e.g. multi-electrode arrays, acoustic arrays).
Fields§
§name: String§contacts: Vec<SensorSite>Implementations§
Source§impl SensorLayout
impl SensorLayout
pub fn new(name: impl Into<String>, contacts: Vec<SensorSite>) -> Self
pub fn total_channels(&self) -> usize
pub fn active_channels(&self) -> usize
Sourcepub fn get_site(&self, channel_id: usize) -> DspResult<&SensorSite>
pub fn get_site(&self, channel_id: usize) -> DspResult<&SensorSite>
Site of recording channel channel_id. O(1) when sites are stored in channel order (the
usual case), a scan otherwise.
pub fn get_contact(&self, channel_id: usize) -> DspResult<&SensorSite>
pub fn sites(&self) -> &[SensorSite]
Sourcepub fn select_channels(&self, channels: &[usize]) -> Self
pub fn select_channels(&self, channels: &[usize]) -> Self
Layout restricted to channels (recording channel ids of the parent), renumbered so that
the site of channels[i] gets channel id i — the layout of a channel subset.
Sourcepub fn to_channel_arrays(&self) -> (Vec<usize>, Vec<[f32; 2]>, Vec<usize>)
pub fn to_channel_arrays(&self) -> (Vec<usize>, Vec<[f32; 2]>, Vec<usize>)
Flat (channel_map, channel_positions_xy, channel_shanks) arrays as used by Phy / Kilosort
and Zarr stores.
Sourcepub fn from_channel_arrays(
name: impl Into<String>,
channel_map: &[usize],
positions: &[[f32; 2]],
shanks: &[usize],
) -> Option<Self>
pub fn from_channel_arrays( name: impl Into<String>, channel_map: &[usize], positions: &[[f32; 2]], shanks: &[usize], ) -> Option<Self>
Reconstructs a SensorLayout from flat (channel_map, channel_positions_xy, channel_shanks)
arrays (None when positions is empty). Missing channel_map or shanks entries fall back
to identity (i) and shank 0.
Source§impl SensorLayout
impl SensorLayout
Sourcepub fn remap(&self, map: &ChannelMap) -> DspResult<SensorLayout>
pub fn remap(&self, map: &ChannelMap) -> DspResult<SensorLayout>
The geometry of the channels after map (whose inputs are this layout’s channel ids):
output channel i sits where input order[i] did, renamed i.
Sourcepub fn depth_order(&self) -> ChannelMap
pub fn depth_order(&self) -> ChannelMap
A map that sorts the channels by shank, then depth (y, from the tip up), then x:
neighbouring rows of the data become neighbouring sites.
Trait Implementations§
Source§impl Clone for SensorLayout
impl Clone for SensorLayout
Source§impl Debug for SensorLayout
impl Debug for SensorLayout
Source§impl<'de> Deserialize<'de> for SensorLayout
impl<'de> Deserialize<'de> for SensorLayout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SensorLayout
impl PartialEq for SensorLayout
Source§impl Serialize for SensorLayout
impl Serialize for SensorLayout
impl StructuralPartialEq for SensorLayout
Auto Trait Implementations§
impl Forget for SensorLayout
impl Freeze for SensorLayout
impl Move for SensorLayout
impl RefUnwindSafe for SensorLayout
impl Send for SensorLayout
impl Sync for SensorLayout
impl Unpin for SensorLayout
impl UnsafeUnpin for SensorLayout
impl UnwindSafe for SensorLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more