Back on Pierre mess when rebasing to master.
@@ -23,7 +23,7 @@ spike_dtype = [('sample_ind', 'int64'), ('channel_ind', 'int64'), ('cluster_ind'
('amplitude', 'float64'), ('segment_ind', 'int64')]
-def find_spikes_from_templates(recording, method='simple', method_kwargs={}, extra_ouputs=False,
+def find_spikes_from_templates(recording, method='naive', method_kwargs={}, extra_ouputs=False,
**job_kwargs):
"""Find spike from a recording from given templates.
@@ -139,48 +139,45 @@ class BaseTemplateMatchingEngine:
@classmethod
def initialize_and_check_kwargs(cls, recording, kwargs):
- # need to be overwrite in subclass
+ """This function runs before loops"""
+ # need to be implemented in subclass
raise NotImplementedError
- # this function before loops
@classmethod
def serialize_method_kwargs(cls, kwargs):
- # need to be overwrite in subclass
+ """This function serializes kwargs to distribute them to workers"""
+ # need to be implemented in subclass
raise NotImplementedError
- # this serializa params to distribute it to workers
@classmethod
def unserialize_in_worker(cls, recording, kwargs):
- # need to be overwrite in subclass
+ """This function unserializes kwargs in workers"""
+ # need to be implemented in subclass
raise NotImplementedError
- # this in worker at init to unserialize some wkargs if necessary
@classmethod
def get_margin(cls, recording, kwargs):
- # need to be overwrite in subclass
+ # need to be implemented in subclass
raise NotImplementedError
- # this must return number of sample for margin
@classmethod
def main_function(cls, traces, method_kwargs):
- # need to be overwrite in subclass
+ """This function returns the number of samples for the chunk margins"""
+ # need to be implemented in subclass
raise NotImplementedError
- # this is the main function to detect and label spikes
- # this return spikes in traces chunk
-
-##########
-# naive mathing
-##########
+##################
+# naive matching #
+##################
class NaiveMatching(BaseTemplateMatchingEngine):
"""
- This is a naive template matching that do not resolve collision
- and do not take in account sparsity.
- It just minimize the dist to templates for detected peaks.
+ This is a naive template matching that does not resolve collision
+ and does not take in account sparsity.
+ It just minimizes the distance to templates for detected peaks.
It is implemented for benchmarking against this low quality template matching.
And also as an example how to deal with methods_kwargs, margin, intit, func, ...
@@ -287,12 +284,17 @@ class NaiveMatching(BaseTemplateMatchingEngine):
return spikes
-##########
-# tridesclous peeler
-##########
+######################
+# tridesclous peeler #
+######################
class TridesclousPeeler(BaseTemplateMatchingEngine):
+ """
+ Template-matching ported from Tridesclous sorter.
+
+ @Sam add short description
+ """
default_params = {
'waveform_extractor': None,
'peak_sign': 'neg',
@@ -564,9 +566,9 @@ if HAVE_NUMBA:
#~ return scalar_product, distances
-##########
-# Circus peeler
-##########
+#################
+# Circus peeler #
+#################
class CircusPeeler(BaseTemplateMatchingEngine):
