neuralib.suite2p.core.Suite2PResult
- final class neuralib.suite2p.core.Suite2PResult[source]
Bases:
objectsuite2p result container
Dimension parameters:
N: number of neurons
F: number pf frames
W: image width
H: image height
- __init__(directory, f_raw, f_neu, spks, stat, ops, iscell, cell_prob_thres, redcell=None, redcell_threshold=None, runtime_frate_check=None)
- Parameters:
directory (Path)
f_raw (ndarray)
f_neu (ndarray)
spks (ndarray)
stat (ndarray)
ops (Suite2pGUIOptions)
iscell (ndarray)
cell_prob_thres (float | None)
redcell (ndarray | None)
redcell_threshold (float | None)
runtime_frate_check (float | None)
- Return type:
None
Methods
__init__(directory, f_raw, f_neu, spks, ...)Retrieves a mapping between neuron IDs and their corresponding raw indices based on whether the cell detection probabilities meet a specified threshold.
ROIs pixel (N, 2)
load(directory[, cell_prob_thres, ...])Load suite2p result from directory
load_total_neuron_number(directory[, cell_prob])Load number of neuron based on iscell.npy
Attributes
probability that the ROI is a cell based on the default classifier.
suite2p approximate frame rate per plane, exact value should be checked in .sbx or .mat
if has a second channel
image height (in pixel)
mean image for chan0(1st).
mean image for chan1(2nd).
image width (in pixel)
The timescale of the sensor (in seconds)
number of frame number
number of neurons after load.
number of optical plane
number of identified neuron based on red cell threshold
neuropil coefficient, normally should be ~0.7
(frames, block_size).
Array[float, F]
Array[float, F]
percentile of trace to use as baseline if ops['baseline'] = constant_percentile
red cell probability, Array[float, N]
Red cell probability 2D array.
Red cell probability threshold
x-shifts of recording at each timepoint.
peak of phase correlation between frame and reference image at each timepoint.
y-shifts of recording at each timepoint.
If not None, check frame rate lower bound
Gaussian filter width in seconds
window for max/min filter in seconds
Directory contain all the s2p output files
Fluorescence traces 2D array.
Neuropil fluorescence traces 2D array.
Deconvolved activity 2D array.
GUI imaging after registration, i.e., x, ypixel., etc.
GUI options
Cell probability for each ROI.
Cell probability threshold for loading the data
- directory: Path
Directory contain all the s2p output files
- f_raw: ndarray
Fluorescence traces 2D array. Array[float, [N, F]]
- f_neu: ndarray
Neuropil fluorescence traces 2D array. Array[float, [N, F]]
- spks: ndarray
Deconvolved activity 2D array. Array[float, [N, F]]
- stat: ndarray
GUI imaging after registration, i.e., x, ypixel., etc. Array[Suite2pRoiStat, N]
- ops: Suite2pGUIOptions
GUI options
- iscell: ndarray
Cell probability for each ROI. Array[float, [N, 2]]
- cell_prob_thres: float | None
Cell probability threshold for loading the data
- redcell: ndarray | None = None
Red cell probability 2D array. Array[float, [N, 2]]
- redcell_threshold: float | None = None
Red cell probability threshold
- runtime_frate_check: float | None = None
If not None, check frame rate lower bound
- classmethod load(directory, cell_prob_thres=0.5, red_cell_threshold=0.65, channel=0, runtime_check_frame_rate=30.0)[source]
Load suite2p result from directory
- Parameters:
directory (str | Path | PathLike[str]) – Directory contain all the s2p output files. e.g., */suite2p/plane[P]
cell_prob_thres (float | None) – Cell probability. If float type, mask for the value in
iscell[:, 1]. If None, use the binary criteria in GUI outputred_cell_threshold (float) – Red cell threshold
channel (int) – channel (PMT) Number for the functional channel. i.e., 0 if GCaMP, 1 if jRGECO in scanbox setting
runtime_check_frame_rate (float | None) – if not None, check frame rate lower-bound to make sure the s2p runconfig
- Returns:
- Return type:
Self
- property has_chan2: bool
if has a second channel
- property n_neurons: int
number of neurons after load. could be less than GUI ROI number if use higher cell_prob in
load()
- property n_frame: int
number of frame number
- property cell_prob: ndarray
probability that the ROI is a cell based on the default classifier. Array[float, N]
- property n_red_neuron: int
number of identified neuron based on red cell threshold
- property red_cell_prob: ndarray | None
red cell probability, Array[float, N]
- property signal_baseline: float
Gaussian filter width in seconds
- property window_baseline: float
window for max/min filter in seconds
- property fs: float
suite2p approximate frame rate per plane, exact value should be checked in .sbx or .mat
- property neucoeff: float
neuropil coefficient, normally should be ~0.7
- property prctile_baseline: float
percentile of trace to use as baseline if ops[‘baseline’] = constant_percentile
- property n_plane: int
number of optical plane
- property image_width: int
image width (in pixel)
- property image_height: int
image height (in pixel)
- property image_mean: ndarray
mean image for chan0(1st). Array[float, [H, W]]
- property image_mean_ch2: ndarray
mean image for chan1(2nd). Array[float, [H, W]]
- property indicator_tau: float
The timescale of the sensor (in seconds)
- property rigid_x_offsets: ndarray
x-shifts of recording at each timepoint. Array[int, F]
- property rigid_y_offsets: ndarray
y-shifts of recording at each timepoint. Array[int, F]
- property rigid_xy_offset: ndarray
peak of phase correlation between frame and reference image at each timepoint. Array[float, F]
- property nonrigid_x_offsets: ndarray
(frames, block_size). Array[float, F]
- property nonrigid_y_offsets: ndarray
Array[float, F]
- property nonrigid_xy_offsets: ndarray
Array[float, F]
- classmethod load_total_neuron_number(directory, cell_prob=0.5)[source]
Load number of neuron based on iscell.npy
- Parameters:
directory (Path) – directory contains the iscell.npy
cell_prob (float | None) – cell probability, bool type: use the binary criteria in GUI output float type: value in
iscell[:, 1]
- Returns:
Number of neurons
- Return type:
int
- get_neuron_id_mapping()[source]
Retrieves a mapping between neuron IDs and their corresponding raw indices based on whether the cell detection probabilities meet a specified threshold. If no cell detection probabilities are provided, the mapping assumes all indices are valid neurons.
- Returns:
A Polars DataFrame containing two columns: neuron_id and raw_index.
- Return type:
DataFrame
- __init__(directory, f_raw, f_neu, spks, stat, ops, iscell, cell_prob_thres, redcell=None, redcell_threshold=None, runtime_frate_check=None)
- Parameters:
directory (Path)
f_raw (ndarray)
f_neu (ndarray)
spks (ndarray)
stat (ndarray)
ops (Suite2pGUIOptions)
iscell (ndarray)
cell_prob_thres (float | None)
redcell (ndarray | None)
redcell_threshold (float | None)
runtime_frate_check (float | None)
- Return type:
None