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:

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.

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

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 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

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 Waveform similarity for more details.

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 Non-rigid correction section for more details.

waveform_similarity

waveformCorrection.n_templates

Default: 1

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. If set to 2, waveform correction and waveform similarity calculation will be performed twice, which is more accurate but slower. It is recommended to use 2 for datasets with large probe motion and many units located at the edges of the probe. See Waveform correction for more details about this parameter.

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 Waveform correction for more details.

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

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 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.

motionEstimation.features

Default:

[
    ["Waveform", "AutoCorr", "PETH"],
    ["Waveform", "AutoCorr", "PETH"]
]

DANT & pyDANT: The features used for motion estimation in each iteration. With the default values, motion estimation will be performed multiple times using the listed feature sets. The features should be chosen from "Waveform", "AutoCorr", "ISI", or "PETH". In some datasets with large probe motion (> 100 μm), the waveform feature may not be reliable, and you can use "AutoCorr" and "PETH" in the first iteration.

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.

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.

clustering.weight_tol

Default: 1e-8

DANT & pyDANT: Sets the convergence threshold for feature weight updates. Iterative clustering stops early if the \(L_1\) norm of the weight change falls below this value.

autoCuration

autoCuration.auto_split

Default: true

DANT & pyDANT: Whether to split the clusters automatically. Please refer to the Auto curation section for more details.