Change default settings ========================== Although default settings in DANT are designed to work well for most datasets, you may want to change some of them to get better tracking results. Some researchers may also want to avoid the usage of PETH features in clustering. You can specify all these things in the ``settings.json`` file. Here is a list of all the parameters in the ``settings.json`` file and when to change them: .. contents:: :local: ``path_to_data`` ----------------- **DANT:** The path to the ``spikeInfo.mat`` file. **pyDANT:** The path to the input data folder. This folder should contain files such as ``waveform_all.npy``, ``channel_locations.npy``, ``session_index.npy``, the ``spike_times`` folder, and optionally ``peth.npy``. For multi-shank pyDANT runs, this folder must also contain ``channel_shanks.npy``. ``output_folder`` ------------------- **DANT & pyDANT:** The path to the output folder where results will be saved. If the folder does not exist, it will be created automatically. ``path_to_python`` ------------------- **DANT:** The path to the Python executable that has the ``hdbscan`` package installed. DANT uses this Python environment to run HDBSCAN from MATLAB, so this parameter is required. On macOS or Linux, the path may look like ``/Users/username/anaconda3/envs/hdbscan/bin/python``. On Windows, the path may look like ``path_to_anaconda\\anaconda3\\envs\\hdbscan\\python.exe``. **pyDANT:** This parameter is not used and should be omitted. pyDANT runs directly in the active Python environment, so you do not need to specify a separate Python executable path. ``save_intermediate_results`` ------------------------------- Default: ``false`` **DANT & pyDANT:** Whether to save the intermediate results. If set to ``true``, intermediate ``.mat``, ``.npy``, or ``.npz`` results will be saved in the output folder. This can be useful for debugging or further analysis. ``save_intermediate_figures`` ------------------------------- Default: ``false`` **DANT & pyDANT:** Whether to save the intermediate figures generated during processing. If set to ``true``, the figures will be saved in the output folder. This can be useful for inspecting the motion correction process. ``n_jobs`` ------------------------------- Default: ``-1`` **DANT:** The number of parallel jobs to run. Set to ``-1`` to use all available CPU cores. Set to ``0`` to disable parallel processing. Adjust this parameter based on your system's capabilities and workload. **pyDANT:** The number of parallel jobs to run. Set to ``-1`` to use all available CPU cores. Set to ``1`` to disable parallel processing. .. _centering_waveforms_setting_label: ``centering_waveforms`` -------------------------- Default: ``false`` **DANT & pyDANT:** Whether to center the waveforms before processing. DANT and pyDANT both assume that the waveforms are already aligned. If set to ``true``, the waveforms will be centered to the trough of the waveform according to the peak channel. Waveforms generated by Kilosort may not be centered, and uncentered waveforms can impair waveform similarity. We recommend centering the waveforms before running DANT or pyDANT to avoid "cropping" them. See :doc:`Center waveforms ` for more details. spikeLocation ------------------- ``spikeLocation.location_algorithm`` ++++++++++++++++++++++++++++++++++++ Default: ``monopolar_triangulation`` **DANT & pyDANT:** The algorithm used to estimate the location of each unit. You can choose from ``monopolar_triangulation`` or ``center_of_mass``. ``monopolar_triangulation`` is recommended for most datasets. ``spikeLocation.n_nearest_channels`` +++++++++++++++++++++++++++++++++++++ Default: ``20`` **DANT & pyDANT:** The number of channels nearest to the peak channel (the channel with maximum amplitude) used for spike location estimation. The default value works well with the classical Neuropixels 1.0 and Neuropixels 2.0 channel maps. Although Neuropixels 2.0 has a denser channel distribution along the shank, it does not make much difference to the result. waveformCorrection ------------------- .. _waveform_correction_n_nearest_channels_label: ``waveformCorrection.n_nearest_channels`` ++++++++++++++++++++++++++++++++++++++++++ Default: ``38`` **DANT & pyDANT:** The number of channels used for computing pairwise waveform similarity. The default value works well with the classical Neuropixels 1.0 and Neuropixels 2.0 channel maps. If you want to change this value, ``4*k+2`` is recommended (``k`` is an integer) to ensure the symmetry of the channel set. See :ref:`Waveform similarity ` for more details. .. _non_rigid_correction_setting_label: ``waveformCorrection.linear_correction`` +++++++++++++++++++++++++++++++++++++++++ Default: ``false`` **DANT & pyDANT:** Whether to use linear correction for motion estimation. Rigid motion correction is used by default and is sufficient for most datasets. Non-rigid motion correction can be useful in longer recordings with large probe motion, but it can sometimes lead to overfitting and unstable results. Please refer to the :ref:`Non-rigid correction ` section for more details. ``waveform_similarity`` .. _n_templates_label: ``waveformCorrection.n_templates`` +++++++++++++++++++++++++++++++++++ Default: ``2`` **DANT & pyDANT:** The number of templates (reference probes) used for waveform correction. It should be 1 or 2. If set to 1, the template is set at the mean of motion; if set to 2, two templates are set at the top and bottom of the probe. The default value of 2 is recommended for robust tracking, especially for datasets with large probe motion or many units located at the edges of the probe. Because waveform correction and waveform similarity calculation are performed for both templates, this setting is more accurate but slower than using a single template. See :ref:`Waveform correction ` for more details about this parameter. .. _path_to_motion_label: ``waveformCorrection.path_to_motion`` +++++++++++++++++++++++++++++++++++++ Default: ``""`` **DANT & pyDANT:** The path to a pre-computed motion ``.npy`` file (typically a vector with one value per session, for example one estimated by DREDge). If empty, motion will be estimated from the data. This parameter can be useful if you have already estimated motion using another method and want to apply it directly. See :ref:`Waveform correction ` for more details. .. _autocorr_setting_label: autocorr ------------------- ``autocorr.window`` +++++++++++++++++++ Default: ``300`` **DANT & pyDANT:** The window size (in ms) for the autocorrelogram with a bin width of 1 ms. ``autocorr.binwidth`` +++++++++++++++++++++ Default: ``1`` **DANT & pyDANT:** The bin width (in ms) for the autocorrelogram. ``autocorr.gaussian_sigma`` +++++++++++++++++++++++++++ Default: ``5`` **DANT & pyDANT:** The standard deviation (in ms) of the Gaussian kernel used for smoothing the autocorrelogram. .. _ISI_setting_label: ISI ------------------- ``ISI.window`` ++++++++++++++ Default: ``100`` **DANT & pyDANT:** The window size (in ms) for the inter-spike interval (ISI) histogram. ``ISI.binwidth`` ++++++++++++++++ Default: ``1`` **DANT & pyDANT:** The bin width (in ms) for the ISI histogram. ``ISI.gaussian_sigma`` ++++++++++++++++++++++ Default: ``1`` **DANT & pyDANT:** The standard deviation (in ms) of the Gaussian kernel used for smoothing the ISI histogram. motionEstimation ------------------- ``motionEstimation.max_distance`` +++++++++++++++++++++++++++++++++ Default: ``100`` **DANT:** The maximum distance (in μm) between unit pairs in the Y direction for motion estimation. Unit pairs with distances larger than this value will not be included in motion estimation. This parameter helps exclude distant units that could influence the estimate. See :ref:`Motion estimation ` section for more details. **pyDANT:** This parameter is not specified separately. During the clustering steps used for motion correction, pyDANT uses ``clustering.max_distance`` to select nearby unit pairs. .. _motion_correction_features_label: ``motionEstimation.features`` +++++++++++++++++++++++++++++ Default: .. code-block:: json [ ["AutoCorr", "PETH"], ["Waveform", "AutoCorr", "PETH"] ] **DANT & pyDANT:** The features used for motion estimation in each iteration. The features should be chosen from ``"Waveform"``, ``"AutoCorr"``, ``"ISI"``, or ``"PETH"``. In some datasets with large probe motion, the waveform feature may not be reliable, and you can use ``"AutoCorr"`` and ``"PETH"`` in the first iteration. If ``PETH`` is not available, do not use ``"AutoCorr"`` alone for the first iteration; use ``["Waveform", "AutoCorr"]`` instead. ``motionEstimation.max_iter`` +++++++++++++++++++++++++++++++++++ Default: ``15`` **DANT & pyDANT:** The maximum number of motion estimation iterations. This is a hard upper bound, not a requirement to run exactly this many iterations. If ``repeat_last_feature_set`` is ``false``, the pipeline runs at most the number of feature sets listed in ``motionEstimation.features``. ``motionEstimation.repeat_last_feature_set`` ++++++++++++++++++++++++++++++++++++++++++++++++++++ Default: ``true`` **DANT & pyDANT:** Whether to keep reusing the last listed motion-estimation feature set after the explicit feature schedule is exhausted. If this is ``true``, the pipeline can continue until ``stop_early`` triggers or ``max_iter`` is reached. The default settings set this field to ``true``; older settings files without this field keep legacy behavior and behave as if it were ``false``. ``motionEstimation.stop_early`` +++++++++++++++++++++++++++++++ Default: ``true`` **DANT & pyDANT:** Determines whether to terminate the motion estimation loop early when the number of matched unit pairs fails to increase, preventing redundant iterations and overfitting. clustering ------------------- ``clustering.max_distance`` +++++++++++++++++++++++++++ Default: ``100`` **DANT & pyDANT:** The maximum distance (in μm) between unit pairs in the Y direction for weight optimization. To include the unmatched unit pairs that are most likely to be "confused" with the matched pairs, only nearby unmatched pairs are used in LDA. Note that changing this parameter will influence the optimized weights and clustering results. Typically, increasing this value will place a larger weight on the waveform feature. Because the other features are independent of this parameter, increasing this value includes more distant unmatched pairs and therefore emphasizes the waveform feature more. ``clustering.features`` +++++++++++++++++++++++ Default: ``["Waveform", "AutoCorr", "PETH"]`` **DANT & pyDANT:** The features used for clustering. The features should be chosen from ``"Waveform"``, ``"AutoCorr"``, ``"ISI"``, or ``"PETH"``. For example, you can set this field to ``["Waveform"]``, ``["AutoCorr"]``, ``["ISI"]``, or ``["PETH"]`` if you want to use only one feature. .. _n_iter_setting_label: ``clustering.n_iter`` +++++++++++++++++++++ Default: ``10`` **DANT & pyDANT:** The number of iterations for the iterative clustering algorithm. The algorithm usually converges well within six iterations. Because HDBSCAN runs very fast, the default value of 10 helps ensure convergence without slowing the process too much. .. _weight_tol_setting_label: ``clustering.weight_tol`` +++++++++++++++++++++++++ Default: ``1e-8`` **DANT & pyDANT:** Sets the convergence threshold for feature weight updates. Iterative clustering stops early if the :math:`L_1` norm of the weight change falls below this value. autoCuration ------------------- .. _auto_split_label: ``autoCuration.auto_split`` +++++++++++++++++++++++++++ Default: ``true`` **DANT & pyDANT:** Whether to split the clusters automatically. Please refer to the :ref:`Auto curation ` section for more details.