neuralib.spikes.cascade.CascadeSpikePrediction

class neuralib.spikes.cascade.CascadeSpikePrediction[source]

Bases: object

__init__(dff, model_type, *, threshold=0, padding=0, verbose=True, chunks_mode_limit=10, cache_dir=None)[source]
Parameters:
  • dff (ndarray) – dF/F activity to be predicted. Array[float, [N, F]|F]

  • model_type (Literal['Global_EXC_1Hz_smoothing500ms', 'Global_EXC_1Hz_smoothing1000ms', 'Zebrafish_1Hz_smoothing1000ms', 'Global_EXC_2Hz_smoothing300ms', 'Global_EXC_2Hz_smoothing500ms', 'Global_EXC_2Hz_smoothing1000ms', 'Global_EXC_2.5Hz_smoothing400ms_high_noise', 'Global_EXC_3Hz_smoothing400ms', 'Global_EXC_3Hz_smoothing400ms_high_noise', 'Global_EXC_3Hz_smoothing400ms_causalkernel', 'Global_EXC_4.25Hz_smoothing300ms', 'Global_EXC_4.25Hz_smoothing300ms_high_noise', 'Global_EXC_4.25Hz_smoothing300ms_causalkernel', 'Global_EXC_5Hz_smoothing200ms', 'Global_EXC_5Hz_smoothing200ms_causalkernel', 'Global_EXC_6Hz_smoothing200ms', 'Global_EXC_6Hz_smoothing200ms_causalkernel', 'Global_EXC_7Hz_smoothing200ms', 'Global_EXC_7Hz_smoothing200ms_causalkernel', 'Global_EXC_7.5Hz_smoothing200ms_high_noise', 'Global_EXC_7.5Hz_smoothing200ms', 'Global_EXC_7.5Hz_smoothing200ms_causalkernel', 'OGB_zf_pDp_7.5Hz_smoothing200ms', 'OGB_zf_pDp_7.5Hz_smoothing200ms_causalkernel', 'Global_EXC_10Hz_smoothing50ms', 'Global_EXC_10Hz_smoothing50ms_causalkernel', 'Global_EXC_10Hz_smoothing100ms', 'Global_EXC_10Hz_smoothing100ms_causalkernel', 'Global_EXC_10Hz_smoothing200ms', 'Global_EXC_10Hz_smoothing200ms_causalkernel', 'Global_EXC_12.5Hz_smoothing100ms', 'Global_EXC_12.5Hz_smoothing100ms_causalkernel', 'Global_EXC_12.5Hz_smoothing200ms', 'Global_EXC_12.5Hz_smoothing200ms_causalkernel', 'Global_EXC_15Hz_smoothing50ms', 'Global_EXC_15Hz_smoothing50ms_causalkernel', 'Global_EXC_15Hz_smoothing100ms_high_noise', 'Global_EXC_15Hz_smoothing100ms', 'Global_EXC_15Hz_smoothing100ms_causalkernel', 'Global_EXC_15Hz_smoothing200ms', 'Global_EXC_15Hz_smoothing200ms_causalkernel', 'Global_INH_15Hz_smoothing100ms', 'Global_EXC_17.5Hz_smoothing100ms', 'Global_EXC_17.5Hz_smoothing100ms_causalkernel', 'Global_EXC_17.5Hz_smoothing200ms', 'Global_EXC_17.5Hz_smoothing200ms_causalkernel', 'Global_EXC_20Hz_smoothing100ms', 'Global_EXC_20Hz_smoothing100ms_causalkernel', 'Global_EXC_20Hz_smoothing200ms', 'Global_EXC_20Hz_smoothing200ms_causalkernel', 'Global_EXC_25Hz_smoothing100ms', 'Global_EXC_25Hz_smoothing100ms_causalkernel', 'Global_EXC_25Hz_smoothing50ms', 'Global_EXC_25Hz_smoothing50ms_causalkernel', 'Global_EXC_30Hz_smoothing25ms', 'Global_EXC_30Hz_smoothing25ms_causalkernel', 'Global_EXC_30Hz_smoothing50ms', 'Global_EXC_30Hz_smoothing50ms_high_noise', 'Global_EXC_30Hz_smoothing50ms_causalkernel', 'Global_EXC_30Hz_smoothing100ms', 'Global_EXC_30Hz_smoothing100ms_causalkernel', 'Global_EXC_30Hz_smoothing200ms', 'Global_EXC_30Hz_smoothing100ms_causalkernel_high_noise', 'Global_EXC_30Hz_smoothing100ms_high_noise', 'Global_EXC_30Hz_smoothing200ms_causalkernel_high_noise', 'Global_EXC_40Hz_smoothing25ms_causalkernel', 'Global_EXC_40Hz_smoothing25ms', 'Global_EXC_40Hz_smoothing25ms_high_noise', 'Global_EXC_40Hz_smoothing50ms', 'Global_EXC_40Hz_smoothing50ms_high_noise', 'Global_EXC_40Hz_smoothing50ms_causalkernel', 'Global_INH_30Hz_smoothing50ms', 'Global_INH_30Hz_smoothing100ms', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_1_frame', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_2_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_4_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_6_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_8_frames', 'GCaMP6f_mouse_30Hz_smoothing200ms', 'Spinal_cord_excitatory_30Hz_smoothing50ms', 'Spinal_cord_inhibitory_30Hz_smoothing50ms', 'Spinal_cord_excitatory_3Hz_smoothing400ms_high_noise', 'Spinal_cord_inhibitory_3Hz_smoothing400ms_high_noise', 'Spinal_cord_excitatory_2.5Hz_smoothing400ms', 'Spinal_cord_inhibitory_2.5Hz_smoothing400ms', 'GC8_EXC_5Hz_smoothing400ms_high_noise', 'GC8_EXC_5Hz_smoothing800ms_high_noise', 'GC8_EXC_7.5Hz_smoothing100ms_high_noise', 'GC8_EXC_7.5Hz_smoothing200ms_high_noise', 'GC8_EXC_10Hz_smoothing150ms_high_noise', 'GC8_EXC_10Hz_smoothing75ms_high_noise', 'GC8_EXC_15Hz_smoothing100ms_high_noise', 'GC8_EXC_15Hz_smoothing50ms_high_noise', 'GC8_EXC_30Hz_smoothing25ms_high_noise', 'GC8_EXC_30Hz_smoothing50ms_high_noise', 'GC8_EXC_40Hz_smoothing15ms_high_noise', 'GC8_EXC_40Hz_smoothing30ms_high_noise']) – MODEL_TYPE

  • threshold (int | bool) – Allowed values: 0, 1 or False. 0: All negative values are set to 0. 1 or True: Threshold signal to set every signal which is smaller than the expected signal size of an action potential to zero (with dilated mask) False: No thresholding. The result can contain negative values as well

  • padding (float) – Value which is inserted for datapoints, where no prediction can be made (because of window around timepoint of prediction). Default value: np.nan, another recommended value would be 0 which circumvents some problems with following analysis.

  • verbose (bool) – Verbose of model information

  • chunks_mode_limit (float) – Decrease the number if memory issue dealing with large input arrays.

  • cache_dir (str | Path | PathLike[str] | None) – Cache directory for saving the model. If None, then used default under ~/.cache/neuralib

Methods

__init__(dff, model_type, *[, threshold, ...])

get_available_models()

Get all the available in available_model_yaml

get_config()

ModelConfig of specified model

run_spike_prediction()

Spike prediction

Attributes

available_model_yaml

All models link/info yaml

config_file

Config filepath of specified model

model_dir

Directory of specified model

model_link

Link of specified model

__init__(dff, model_type, *, threshold=0, padding=0, verbose=True, chunks_mode_limit=10, cache_dir=None)[source]
Parameters:
  • dff (ndarray) – dF/F activity to be predicted. Array[float, [N, F]|F]

  • model_type (Literal['Global_EXC_1Hz_smoothing500ms', 'Global_EXC_1Hz_smoothing1000ms', 'Zebrafish_1Hz_smoothing1000ms', 'Global_EXC_2Hz_smoothing300ms', 'Global_EXC_2Hz_smoothing500ms', 'Global_EXC_2Hz_smoothing1000ms', 'Global_EXC_2.5Hz_smoothing400ms_high_noise', 'Global_EXC_3Hz_smoothing400ms', 'Global_EXC_3Hz_smoothing400ms_high_noise', 'Global_EXC_3Hz_smoothing400ms_causalkernel', 'Global_EXC_4.25Hz_smoothing300ms', 'Global_EXC_4.25Hz_smoothing300ms_high_noise', 'Global_EXC_4.25Hz_smoothing300ms_causalkernel', 'Global_EXC_5Hz_smoothing200ms', 'Global_EXC_5Hz_smoothing200ms_causalkernel', 'Global_EXC_6Hz_smoothing200ms', 'Global_EXC_6Hz_smoothing200ms_causalkernel', 'Global_EXC_7Hz_smoothing200ms', 'Global_EXC_7Hz_smoothing200ms_causalkernel', 'Global_EXC_7.5Hz_smoothing200ms_high_noise', 'Global_EXC_7.5Hz_smoothing200ms', 'Global_EXC_7.5Hz_smoothing200ms_causalkernel', 'OGB_zf_pDp_7.5Hz_smoothing200ms', 'OGB_zf_pDp_7.5Hz_smoothing200ms_causalkernel', 'Global_EXC_10Hz_smoothing50ms', 'Global_EXC_10Hz_smoothing50ms_causalkernel', 'Global_EXC_10Hz_smoothing100ms', 'Global_EXC_10Hz_smoothing100ms_causalkernel', 'Global_EXC_10Hz_smoothing200ms', 'Global_EXC_10Hz_smoothing200ms_causalkernel', 'Global_EXC_12.5Hz_smoothing100ms', 'Global_EXC_12.5Hz_smoothing100ms_causalkernel', 'Global_EXC_12.5Hz_smoothing200ms', 'Global_EXC_12.5Hz_smoothing200ms_causalkernel', 'Global_EXC_15Hz_smoothing50ms', 'Global_EXC_15Hz_smoothing50ms_causalkernel', 'Global_EXC_15Hz_smoothing100ms_high_noise', 'Global_EXC_15Hz_smoothing100ms', 'Global_EXC_15Hz_smoothing100ms_causalkernel', 'Global_EXC_15Hz_smoothing200ms', 'Global_EXC_15Hz_smoothing200ms_causalkernel', 'Global_INH_15Hz_smoothing100ms', 'Global_EXC_17.5Hz_smoothing100ms', 'Global_EXC_17.5Hz_smoothing100ms_causalkernel', 'Global_EXC_17.5Hz_smoothing200ms', 'Global_EXC_17.5Hz_smoothing200ms_causalkernel', 'Global_EXC_20Hz_smoothing100ms', 'Global_EXC_20Hz_smoothing100ms_causalkernel', 'Global_EXC_20Hz_smoothing200ms', 'Global_EXC_20Hz_smoothing200ms_causalkernel', 'Global_EXC_25Hz_smoothing100ms', 'Global_EXC_25Hz_smoothing100ms_causalkernel', 'Global_EXC_25Hz_smoothing50ms', 'Global_EXC_25Hz_smoothing50ms_causalkernel', 'Global_EXC_30Hz_smoothing25ms', 'Global_EXC_30Hz_smoothing25ms_causalkernel', 'Global_EXC_30Hz_smoothing50ms', 'Global_EXC_30Hz_smoothing50ms_high_noise', 'Global_EXC_30Hz_smoothing50ms_causalkernel', 'Global_EXC_30Hz_smoothing100ms', 'Global_EXC_30Hz_smoothing100ms_causalkernel', 'Global_EXC_30Hz_smoothing200ms', 'Global_EXC_30Hz_smoothing100ms_causalkernel_high_noise', 'Global_EXC_30Hz_smoothing100ms_high_noise', 'Global_EXC_30Hz_smoothing200ms_causalkernel_high_noise', 'Global_EXC_40Hz_smoothing25ms_causalkernel', 'Global_EXC_40Hz_smoothing25ms', 'Global_EXC_40Hz_smoothing25ms_high_noise', 'Global_EXC_40Hz_smoothing50ms', 'Global_EXC_40Hz_smoothing50ms_high_noise', 'Global_EXC_40Hz_smoothing50ms_causalkernel', 'Global_INH_30Hz_smoothing50ms', 'Global_INH_30Hz_smoothing100ms', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_1_frame', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_2_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_4_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_6_frames', 'Global_EXC_30Hz_smoothing50ms_asymmetric_window_8_frames', 'GCaMP6f_mouse_30Hz_smoothing200ms', 'Spinal_cord_excitatory_30Hz_smoothing50ms', 'Spinal_cord_inhibitory_30Hz_smoothing50ms', 'Spinal_cord_excitatory_3Hz_smoothing400ms_high_noise', 'Spinal_cord_inhibitory_3Hz_smoothing400ms_high_noise', 'Spinal_cord_excitatory_2.5Hz_smoothing400ms', 'Spinal_cord_inhibitory_2.5Hz_smoothing400ms', 'GC8_EXC_5Hz_smoothing400ms_high_noise', 'GC8_EXC_5Hz_smoothing800ms_high_noise', 'GC8_EXC_7.5Hz_smoothing100ms_high_noise', 'GC8_EXC_7.5Hz_smoothing200ms_high_noise', 'GC8_EXC_10Hz_smoothing150ms_high_noise', 'GC8_EXC_10Hz_smoothing75ms_high_noise', 'GC8_EXC_15Hz_smoothing100ms_high_noise', 'GC8_EXC_15Hz_smoothing50ms_high_noise', 'GC8_EXC_30Hz_smoothing25ms_high_noise', 'GC8_EXC_30Hz_smoothing50ms_high_noise', 'GC8_EXC_40Hz_smoothing15ms_high_noise', 'GC8_EXC_40Hz_smoothing30ms_high_noise']) – MODEL_TYPE

  • threshold (int | bool) – Allowed values: 0, 1 or False. 0: All negative values are set to 0. 1 or True: Threshold signal to set every signal which is smaller than the expected signal size of an action potential to zero (with dilated mask) False: No thresholding. The result can contain negative values as well

  • padding (float) – Value which is inserted for datapoints, where no prediction can be made (because of window around timepoint of prediction). Default value: np.nan, another recommended value would be 0 which circumvents some problems with following analysis.

  • verbose (bool) – Verbose of model information

  • chunks_mode_limit (float) – Decrease the number if memory issue dealing with large input arrays.

  • cache_dir (str | Path | PathLike[str] | None) – Cache directory for saving the model. If None, then used default under ~/.cache/neuralib

property available_model_yaml: Path

All models link/info yaml

get_available_models()[source]

Get all the available in available_model_yaml

Return type:

list[Literal[‘Global_EXC_1Hz_smoothing500ms’, ‘Global_EXC_1Hz_smoothing1000ms’, ‘Zebrafish_1Hz_smoothing1000ms’, ‘Global_EXC_2Hz_smoothing300ms’, ‘Global_EXC_2Hz_smoothing500ms’, ‘Global_EXC_2Hz_smoothing1000ms’, ‘Global_EXC_2.5Hz_smoothing400ms_high_noise’, ‘Global_EXC_3Hz_smoothing400ms’, ‘Global_EXC_3Hz_smoothing400ms_high_noise’, ‘Global_EXC_3Hz_smoothing400ms_causalkernel’, ‘Global_EXC_4.25Hz_smoothing300ms’, ‘Global_EXC_4.25Hz_smoothing300ms_high_noise’, ‘Global_EXC_4.25Hz_smoothing300ms_causalkernel’, ‘Global_EXC_5Hz_smoothing200ms’, ‘Global_EXC_5Hz_smoothing200ms_causalkernel’, ‘Global_EXC_6Hz_smoothing200ms’, ‘Global_EXC_6Hz_smoothing200ms_causalkernel’, ‘Global_EXC_7Hz_smoothing200ms’, ‘Global_EXC_7Hz_smoothing200ms_causalkernel’, ‘Global_EXC_7.5Hz_smoothing200ms_high_noise’, ‘Global_EXC_7.5Hz_smoothing200ms’, ‘Global_EXC_7.5Hz_smoothing200ms_causalkernel’, ‘OGB_zf_pDp_7.5Hz_smoothing200ms’, ‘OGB_zf_pDp_7.5Hz_smoothing200ms_causalkernel’, ‘Global_EXC_10Hz_smoothing50ms’, ‘Global_EXC_10Hz_smoothing50ms_causalkernel’, ‘Global_EXC_10Hz_smoothing100ms’, ‘Global_EXC_10Hz_smoothing100ms_causalkernel’, ‘Global_EXC_10Hz_smoothing200ms’, ‘Global_EXC_10Hz_smoothing200ms_causalkernel’, ‘Global_EXC_12.5Hz_smoothing100ms’, ‘Global_EXC_12.5Hz_smoothing100ms_causalkernel’, ‘Global_EXC_12.5Hz_smoothing200ms’, ‘Global_EXC_12.5Hz_smoothing200ms_causalkernel’, ‘Global_EXC_15Hz_smoothing50ms’, ‘Global_EXC_15Hz_smoothing50ms_causalkernel’, ‘Global_EXC_15Hz_smoothing100ms_high_noise’, ‘Global_EXC_15Hz_smoothing100ms’, ‘Global_EXC_15Hz_smoothing100ms_causalkernel’, ‘Global_EXC_15Hz_smoothing200ms’, ‘Global_EXC_15Hz_smoothing200ms_causalkernel’, ‘Global_INH_15Hz_smoothing100ms’, ‘Global_EXC_17.5Hz_smoothing100ms’, ‘Global_EXC_17.5Hz_smoothing100ms_causalkernel’, ‘Global_EXC_17.5Hz_smoothing200ms’, ‘Global_EXC_17.5Hz_smoothing200ms_causalkernel’, ‘Global_EXC_20Hz_smoothing100ms’, ‘Global_EXC_20Hz_smoothing100ms_causalkernel’, ‘Global_EXC_20Hz_smoothing200ms’, ‘Global_EXC_20Hz_smoothing200ms_causalkernel’, ‘Global_EXC_25Hz_smoothing100ms’, ‘Global_EXC_25Hz_smoothing100ms_causalkernel’, ‘Global_EXC_25Hz_smoothing50ms’, ‘Global_EXC_25Hz_smoothing50ms_causalkernel’, ‘Global_EXC_30Hz_smoothing25ms’, ‘Global_EXC_30Hz_smoothing25ms_causalkernel’, ‘Global_EXC_30Hz_smoothing50ms’, ‘Global_EXC_30Hz_smoothing50ms_high_noise’, ‘Global_EXC_30Hz_smoothing50ms_causalkernel’, ‘Global_EXC_30Hz_smoothing100ms’, ‘Global_EXC_30Hz_smoothing100ms_causalkernel’, ‘Global_EXC_30Hz_smoothing200ms’, ‘Global_EXC_30Hz_smoothing100ms_causalkernel_high_noise’, ‘Global_EXC_30Hz_smoothing100ms_high_noise’, ‘Global_EXC_30Hz_smoothing200ms_causalkernel_high_noise’, ‘Global_EXC_40Hz_smoothing25ms_causalkernel’, ‘Global_EXC_40Hz_smoothing25ms’, ‘Global_EXC_40Hz_smoothing25ms_high_noise’, ‘Global_EXC_40Hz_smoothing50ms’, ‘Global_EXC_40Hz_smoothing50ms_high_noise’, ‘Global_EXC_40Hz_smoothing50ms_causalkernel’, ‘Global_INH_30Hz_smoothing50ms’, ‘Global_INH_30Hz_smoothing100ms’, ‘Global_EXC_30Hz_smoothing50ms_asymmetric_window_1_frame’, ‘Global_EXC_30Hz_smoothing50ms_asymmetric_window_2_frames’, ‘Global_EXC_30Hz_smoothing50ms_asymmetric_window_4_frames’, ‘Global_EXC_30Hz_smoothing50ms_asymmetric_window_6_frames’, ‘Global_EXC_30Hz_smoothing50ms_asymmetric_window_8_frames’, ‘GCaMP6f_mouse_30Hz_smoothing200ms’, ‘Spinal_cord_excitatory_30Hz_smoothing50ms’, ‘Spinal_cord_inhibitory_30Hz_smoothing50ms’, ‘Spinal_cord_excitatory_3Hz_smoothing400ms_high_noise’, ‘Spinal_cord_inhibitory_3Hz_smoothing400ms_high_noise’, ‘Spinal_cord_excitatory_2.5Hz_smoothing400ms’, ‘Spinal_cord_inhibitory_2.5Hz_smoothing400ms’, ‘GC8_EXC_5Hz_smoothing400ms_high_noise’, ‘GC8_EXC_5Hz_smoothing800ms_high_noise’, ‘GC8_EXC_7.5Hz_smoothing100ms_high_noise’, ‘GC8_EXC_7.5Hz_smoothing200ms_high_noise’, ‘GC8_EXC_10Hz_smoothing150ms_high_noise’, ‘GC8_EXC_10Hz_smoothing75ms_high_noise’, ‘GC8_EXC_15Hz_smoothing100ms_high_noise’, ‘GC8_EXC_15Hz_smoothing50ms_high_noise’, ‘GC8_EXC_30Hz_smoothing25ms_high_noise’, ‘GC8_EXC_30Hz_smoothing50ms_high_noise’, ‘GC8_EXC_40Hz_smoothing15ms_high_noise’, ‘GC8_EXC_40Hz_smoothing30ms_high_noise’]]

Link of specified model

property model_dir: Path

Directory of specified model

property config_file

Config filepath of specified model

get_config()[source]

ModelConfig of specified model

Return type:

CascadeModelConfig

run_spike_prediction()[source]

Spike prediction

Returns:

Spiking probability as predicted by the model. Array[float, [N, F]|F]

Return type:

ndarray