LorenFrankLab / spyglass

Neuroscience data analysis framework for reproducible research built by Loren Frank Lab at UCSF
https://lorenfranklab.github.io/spyglass/
MIT License
90 stars 41 forks source link

keyword problem for clusterless thresholder and spike sorting #452

Closed MichaelCoulter closed 1 year ago

MichaelCoulter commented 1 year ago

it seems like the spikesorting table now needs a keyword in SpikeSortingParameters called "whiten", but when the clusterless thresholder checks for this keyword it does not expect it and so gives an error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [26], line 54
     52 position_info_param_name = "default_decoding"
     53 # want to skip tet 100 and 101,
---> 54 populate_spike_threshold(recording_keys[2:3], 
     55                          mark_param_name=mark_param_name, 
     56                          position_info_param_name=position_info_param_name )

Cell In [26], line 14, in populate_spike_threshold(spikesorting_selection_keys, mark_param_name, position_info_param_name)
      1 def populate_spike_threshold(
      2         spikesorting_selection_keys: list,
      3         mark_param_name='default',
   (...)
      8     # either do spike sorting or marks - not both
      9     ## Populate spike sorting
     10     SpikeSortingSelection().insert(
     11         spikesorting_selection_keys,
     12         skip_duplicates=True,
     13     )
---> 14     SpikeSorting.populate(spikesorting_selection_keys)
     16     ## Skip any curation
     17     curation_keys = [Curation.insert_curation(
     18         key) for key in spikesorting_selection_keys]

File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/autopopulate.py:230, in AutoPopulate.populate(self, suppress_errors, return_exception_objects, reserve_jobs, order, limit, max_calls, display_progress, processes, make_kwargs, *restrictions)
    226 if processes == 1:
    227     for key in (
    228         tqdm(keys, desc=self.__class__.__name__) if display_progress else keys
    229     ):
--> 230         error = self._populate1(key, jobs, **populate_kwargs)
    231         if error is not None:
    232             error_list.append(error)

File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/autopopulate.py:281, in AutoPopulate._populate1(self, key, jobs, suppress_errors, return_exception_objects, make_kwargs)
    279 self.__class__._allow_insert = True
    280 try:
--> 281     make(dict(key), **(make_kwargs or {}))
    282 except (KeyboardInterrupt, SystemExit, Exception) as error:
    283     try:

File ~/spyglass/src/spyglass/spikesorting/spikesorting_sorting.py:201, in SpikeSorting.make(self, key)
    197 if sorter == "clusterless_thresholder":
    198     # Detect peaks for clusterless decoding
    199     # need to remove tempdir
    200     sorter_params.pop("tempdir", None)
--> 201     detected_spikes = detect_peaks(recording, **sorter_params)
    202     sorting = si.NumpySorting.from_times_labels(
    203         times_list=detected_spikes["sample_ind"],
    204         labels_list=np.zeros(len(detected_spikes), dtype=np.int),
    205         sampling_frequency=recording.get_sampling_frequency(),
    206     )
    207 else:

File ~/spikeinterface/src/spikeinterface/sortingcomponents/peak_detection.py:80, in detect_peaks(recording, method, pipeline_nodes, gather_mode, folder, names, **kwargs)
     77 mp_context = method_class.preferred_mp_context
     79 # prepare args
---> 80 method_args = method_class.check_params(recording, **method_kwargs)
     82 extra_margin = 0
     83 if pipeline_nodes is None:

TypeError: check_params() got an unexpected keyword argument 'whiten'
edeno commented 1 year ago

Fixed by PR #454