neuralib.imaging.suite2p.core.Suite2PResult
- final class neuralib.imaging.suite2p.core.Suite2PResult[source]
Bases:
objectsuite2p result container
Dimension parameters:
N: number of neurons
F: number pf frames
W: image width
H: image height
- 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
Red cell probability 2D array. Array[float, [N, 2]]
- redcell_threshold: float | None
Red cell probability threshold
- runtime_frate_check: float | None
If not None, check frame rate lower bound
- classmethod launch_gui(directory)[source]
DEPRECATED. launch the suite2p GUI
- Parameters:
directory (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – directory contain all the s2p output files. e.g., <SUITE2P_OUTPUT>/suite2p/plane<P>
- Returns:
- Return type:
None
- classmethod load(directory, cell_prob_thres=0.5, red_cell_threshold=0.65, channel=0, runconfig_frate=30.0)[source]
Load suite2p result from directory
- Parameters:
directory (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – 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
runconfig_frate (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]]
- __init__(directory, f_raw, f_neu, spks, stat, ops, iscell, cell_prob_thres, redcell=None, redcell_threshold=None, runtime_frate_check=None)
Method generated by attrs for class Suite2PResult.
- 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
- 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