neurocarto.probe_npx.npx
- class neurocarto.probe_npx.npx.ProbeType
Probe profile.
References:
- code: int
Alias for field number 0
- n_shank: int
Alias for field number 1
- n_col_shank: int
Alias for field number 2
- n_electrode_shank: int
Alias for field number 3
- n_channels: int
Alias for field number 4
- c_space: float
Alias for field number 5
- r_space: float
Alias for field number 6
- s_space: int
Alias for field number 7
- n_reference: int
Alias for field number 8
- property n_row_shank: int
- property n_bank: int
number of total banks
- static __new__(_cls, code, n_shank, n_col_shank, n_electrode_shank, n_channels, c_space, r_space, s_space, n_reference)
Create new instance of ProbeType(code, n_shank, n_col_shank, n_electrode_shank, n_channels, c_space, r_space, s_space, n_reference)
- Parameters:
code (int)
n_shank (int)
n_col_shank (int)
n_electrode_shank (int)
n_channels (int)
c_space (float)
r_space (float)
s_space (int)
n_reference (int)
- class neurocarto.probe_npx.npx.Electrode
- ap_band_gain: int
- lf_band_gain: int
- ap_hp_filter: bool
- bank_a: int
- bank_b: int
- __init__(shank, column, row, in_used=True)
- Parameters:
shank (int)
column (int)
row (int)
in_used (bool | int)
- shank: Final[int]
- column: Final[int]
- row: Final[int]
- in_used: bool
- class neurocarto.probe_npx.npx.ReferenceInfo
ReferenceInfo(code, type, shank, channel)
- code: int
Alias for field number 0
- type: Literal['ext', 'tip', 'bank', 'ground', 'unknown']
Alias for field number 1
- shank: int
Alias for field number 2
- channel: int
Alias for field number 3
- classmethod max_reference_value(probe_type)
get max possible value for probe type.
- Parameters:
probe_type (ProbeType)
- Return type:
int
- classmethod of(probe_type, reference)
get information of reference value.
- Parameters:
probe_type (ProbeType)
reference (int)
- Returns:
- Return type:
Self
- static __new__(_cls, code, type, shank, channel)
Create new instance of ReferenceInfo(code, type, shank, channel)
- Parameters:
code (int)
type (Literal['ext', 'tip', 'bank', 'ground', 'unknown'])
shank (int)
channel (int)
- class neurocarto.probe_npx.npx.ChannelMap
Neuropixels channelmap
- __init__(probe_type, electrodes=None, *, meta=None)
- Parameters:
probe_type (int | str | ProbeType | ChannelMap) – probe type code, ProbeType or a ChannelMap for coping.
electrodes (Sequence[int | tuple[int, int] | tuple[int, int, int] | Electrode | None] | None) – pre-add electrodes
meta (NpxMeta | None)
- classmethod parse(source)
Parse imro table.
- Parameters:
source (str) – an imro table.
- Returns:
- Return type:
Self
- classmethod from_meta(path)
Read imro table from SpikeGLX meta file.
- Parameters:
path (str | Path) – file path
- Returns:
- Return type:
Self
- classmethod from_imro(path)
Read imro file.
- Parameters:
path (str | Path) – file path
- Returns:
- Return type:
Self
- classmethod from_probe(probe)
From probeinterface.Probe
Note
The package
probeinterfaceis optional dependency.- Parameters:
probe (Probe)
- Returns:
- Return type:
Self
- to_imro()
format as imro table
- Return type:
str
- save_imro(path)
save into imro file
- Parameters:
path (str | Path)
- to_probe()
to probeinterface.Probe
Note
The package
probeinterfaceis optional dependency.- Returns:
- Return type:
Probe
- to_numpy(unit='cr')
To a numpy array. Empty channels are skipped.
The layout of returned array is depending on the unit
cr: column and row, returnArray[int, N, (S, C, R)]xy: x and y position, returnArray[um:int, N, (X, Y)]sxy: x and y position with shank, returnArray[int, N, (S, X, Y)]
- Parameters:
unit (Literal['cr', 'xy', 'sxy']) – electrode ordering kind
- Returns:
- Return type:
ndarray[tuple[int, …], dtype[int64]]
- to_pandas()
To a pandas dataframe.
Use
-1to fill empty channels.shank column row in_used x y channel 0 -1 -1 -1 False -1 -1 1 1 1 144 True 282 2160 ... ... ... ... ... ... ...
Note
The package
pandasis optional dependency.- Returns:
a pandas dataframe
- Return type:
pd.DataFrame
- to_polars()
To a polars dataframe.
Use
nullto fill empty channels.┌─────────┬───────┬────────┬──────┬─────────┬──────┬──────┐ │ channel ┆ shank ┆ column ┆ row ┆ in_used ┆ x ┆ y │ │ i64 ┆ i64? ┆ i64? ┆ i64? ┆ bool ┆ i64? ┆ i64? │ ╞═════════╪═══════╪════════╪══════╪═════════╪══════╪══════╡ │ 0 ┆ null ┆ null ┆ null ┆ false ┆ null ┆ null │ │ 1 ┆ 1 ┆ 1 ┆ 144 ┆ true ┆ 282 ┆ 2160 │ └─────────┴───────┴────────┴──────┴─────────┴──────┴──────┘
Note
The package
polarsis optional dependency.- Returns:
a polars dataframe
- Return type:
pl.DataFrame
- property n_shank: int
number of shanks
- property n_col_shank: int
number of columns per shank
- property n_row_shank: int
number of rows per shank
- property n_electrode_shank: int
number of electrodes per shank
- property n_channels: int
number of total channels
- property n_electrode_block: int
number of electrode blocks
- property reference: int
reference type. see
ReferenceInfofor more information.
- property reference_info: ReferenceInfo
reference information.
- property channel_shank: ndarray[tuple[int, ...], dtype[float64]]
- Returns:
Array[shank:int|NaN, C]
- property channel_pos_x: ndarray[tuple[int, ...], dtype[float64]]
- Returns:
Array[um:float, C]
- property channel_pos_y: ndarray[tuple[int, ...], dtype[float64]]
- Returns:
Array[um:float, C]
- property channel_pos: ndarray[tuple[int, ...], dtype[float64]]
- Returns:
Array[um:float, C, 2]
- get_channel(channel)
Get electrode via channel ID
- Parameters:
channel (int) – channel ID.
- Returns:
found electrode
- Return type:
Electrode | None
- property channels: Channels
- get_electrode(electrode)
Get electrode via electrode ID, or position.
- property electrodes: Electrodes
- disconnect_channels()
list of channel that it is not in used, or it is disconnected.
Nonechannels are not included in the return list.- Returns:
list of channel numbers.
- Return type:
list[int]
- add_electrode(electrode, in_used=True, exist_ok=False)
Add an electrode into this channelmap.
- Parameters:
- Returns:
a correspond electrode.
- Raises:
ValueError – electrode position out of range
ChannelHasUsedError – channel has been used by other electrode in this channelmap.
- Return type:
- neurocarto.probe_npx.npx.channel_coordinate(shank_map, electrode_unit='cr', include_unused=False)
Get coordinate of all channels.
- Parameters:
shank_map (ChannelMap)
electrode_unit (ELECTRODE_UNIT) – ‘xy’=(X,Y), ‘cr’=(S,C,R)
include_unused – including disconnected channels
- Returns:
Array[um:float, E, (S, C, R)|(X, Y)]. NaN if electrode is missing.
- Return type:
NDArray[np.float64]
- neurocarto.probe_npx.npx.electrode_coordinate(probe_type, electrode_unit='cr')
Get coordinate of all electrodes.
- Parameters:
probe_type (int | str | ChannelMap | ProbeType)
electrode_unit (ELECTRODE_UNIT) – ‘xy’=(X,Y), ‘cr’=(S,C,R)
- Returns:
Array[um:int, E, (S, C, R)|(X, Y)]
- Return type:
NDArray[np.int_]