Templates¶
Making templates
-
yass.templates.
run
(*args, **kwargs)[source]¶ Compute templates
Parameters: - spike_train: numpy.ndarray, str or pathlib.Path
Spike train from cluster step or path to npy file
- tmp_loc: np.array(n_templates)
At which channel the clustering is done.
- output_directory: str, optional
Output directory (relative to CONFIG.data.root_folder) used to load the recordings to generate templates, defaults to tmp/
- recordings_filename: str, optional
Recordings filename (relative to CONFIG.data.root_folder/ output_directory) used to generate the templates, defaults to standarized.bin
- if_file_exists: str, optional
One of ‘overwrite’, ‘abort’, ‘skip’. Control de behavior for the templates.npy. file If ‘overwrite’ it replaces the files if exists, if ‘abort’ it raises a ValueError exception if exists, if ‘skip’ it skips the operation if the file exists (and returns the stored file)
- save_results: bool, optional
Whether to templates to disk (in CONFIG.data.root_folder/relative_to/templates.npy), defaults to False
Returns: - templates: npy.ndarray
templates
- spike_train: np.array(n_data, 3)
The 3 columns represent spike time, unit id, weight (from soft assignment)
- groups: list(n_units)
After template merge, it shows which ones are merged together
- idx_good_templates: np.array
index of which templates are kept after clean up
Examples
import numpy as np import logging import yass from yass import preprocess from yass import detect from yass import cluster from yass import templates np.random.seed(0) # configure logging module to get useful information logging.basicConfig(level=logging.INFO) # set yass configuration parameters yass.set_config('config_sample.yaml', 'templates-example') standarized_path, standarized_params, whiten_filter = preprocess.run() (spike_index_clear, spike_index_all) = detect.run(standarized_path, standarized_params, whiten_filter) spike_train_clear, tmp_loc, vbParam = cluster.run(spike_index_clear) (templates_, spike_train, groups, idx_good_templates) = templates.run( spike_train_clear, tmp_loc)