1313import numpy as np
1414
1515from spikeinterface .core import BaseSorting
16- from spikeinterface .core .job_tools import fix_job_kwargs
16+ from spikeinterface .core .job_tools import fix_job_kwargs , _shared_job_kwargs_doc
1717from spikeinterface .core .sortinganalyzer import (
1818 AnalyzerExtension ,
1919 SortingAnalyzer ,
@@ -272,7 +272,7 @@ def _make_bins(sorting, window_ms, bin_ms) -> tuple[np.ndarray, int, int]:
272272 bin_size = int (round (fs * bin_ms * 1e-3 ))
273273 window_size -= window_size % bin_size
274274 num_bins = 2 * int (window_size / bin_size )
275- assert num_bins >= 1
275+ assert num_bins >= 1 , "Number of bins must be >= 1"
276276
277277 bins = np .arange (- window_size , window_size + bin_size , bin_size ) * 1e3 / fs
278278
@@ -330,7 +330,7 @@ def _compute_correlograms_on_sorting(sorting, window_ms, bin_ms, method="auto"):
330330 bins : np.array
331331 The bins edges in ms
332332 """
333- assert method in ("auto" , "numba" , "numpy" )
333+ assert method in ("auto" , "numba" , "numpy" ), "method must be 'auto', 'numba' or 'numpy'"
334334
335335 if method == "auto" :
336336 method = "numba" if HAVE_NUMBA else "numpy"
@@ -771,8 +771,7 @@ def _compute_acgs_3d(
771771 The number of quantiles to use for firing rate bins.
772772 smoothing_factor : float, default: 250
773773 The width of the smoothing kernel in milliseconds.
774- n_jobs : int, default: -1.
775- Number of parallel jobs to spawn to compute the 3D-ACGS on different units.
774+ {}
776775
777776 Returns
778777 -------
@@ -841,7 +840,7 @@ def _compute_acgs_3d(
841840 acgs_3d [unit_index , :, :] = acg_3d
842841 firing_quantiles [unit_index , :] = firing_quantile
843842 else :
844- # Process units in serial
843+ # Process units serially
845844 for unit_index , (
846845 sorting ,
847846 unit_id ,
@@ -868,6 +867,8 @@ def _compute_acgs_3d(
868867register_result_extension (ComputeACG3D )
869868compute_acgs_3d_sorting_analyzer = ComputeACG3D .function_factory ()
870869
870+ _compute_acgs_3d .__doc__ = _compute_acgs_3d .__doc__ .format (_shared_job_kwargs_doc )
871+
871872
872873def _compute_3d_acg_one_unit (
873874 sorting : BaseSorting ,
@@ -884,8 +885,8 @@ def _compute_3d_acg_one_unit(
884885 bin_size = np .clip (bin_size , 1000 * 1.0 / fs , 1e8 ) # in milliseconds
885886 win_size = np .clip (win_size , 1e-2 , 1e8 ) # in milliseconds
886887 winsize_bins = 2 * int (0.5 * win_size * 1.0 / bin_size ) + 1 # Both in millisecond
887- assert winsize_bins >= 1
888- assert winsize_bins % 2 == 1
888+ assert winsize_bins >= 1 , "Number of bins must be >= 1"
889+ assert winsize_bins % 2 == 1 , "Number of bins must be odd"
889890 bin_times_ms = np .linspace (- win_size / 2 , win_size / 2 , num = winsize_bins )
890891
891892 if firing_rate_quantiles is not None :
@@ -989,6 +990,7 @@ def compute_acgs_3d(
989990 bin_ms : float = 1.0 ,
990991 num_firing_rate_quantiles : int = 10 ,
991992 smoothing_factor : int = 250 ,
993+ ** job_kwargs ,
992994):
993995 """
994996 Compute 3D Autocorrelograms. See ComputeACG3D() for a detailed documentation.
@@ -1003,6 +1005,7 @@ def compute_acgs_3d(
10031005 bin_ms = bin_ms ,
10041006 num_firing_rate_quantiles = num_firing_rate_quantiles ,
10051007 smoothing_factor = smoothing_factor ,
1008+ ** job_kwargs ,
10061009 )
10071010 else :
10081011 return _compute_acgs_3d (
@@ -1011,6 +1014,7 @@ def compute_acgs_3d(
10111014 bin_ms = bin_ms ,
10121015 num_firing_rate_quantiles = num_firing_rate_quantiles ,
10131016 smoothing_factor = smoothing_factor ,
1017+ ** job_kwargs ,
10141018 )
10151019
10161020
0 commit comments