Closed Hobart10 closed 6 months ago
Trace back of the error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File [d:\YK_pyfile\SI\SI_Proc\SI_procFunc_KS4.py:182](file:///D:/YK_pyfile/SI/SI_Proc/SI_procFunc_KS4.py:182), in SI_sort(folder_out, rec_saved)
--> [182](file:///D:/YK_pyfile/SI/SI_Proc/SI_procFunc_KS4.py:182) sorting_analyzer.compute("spike_amplitudes", peak_sign="both")
[183](file:///D:/YK_pyfile/SI/SI_Proc/SI_procFunc_KS4.py:183) sorting_analyzer.compute("template_similarity")
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\sortinganalyzer.py:853](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:853), in SortingAnalyzer.compute(self, input, save, extension_params, **kwargs)
[806](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:806) """
[807](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:807) Compute one extension or several extensiosn.
[808](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:808) Internally calls compute_one_extension() or compute_several_extensions() depending on the input type.
(...)
[850](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:850) )
[851](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:851) """
[852](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:852) if isinstance(input, str):
--> [853](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:853) return self.compute_one_extension(extension_name=input, save=save, **kwargs)
[854](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:854) elif isinstance(input, dict):
[855](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:855) params_, job_kwargs = split_job_kwargs(kwargs)
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\sortinganalyzer.py:931](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:931), in SortingAnalyzer.compute_one_extension(self, extension_name, save, **kwargs)
[929](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:929) extension_instance = extension_class(self)
[930](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:930) extension_instance.set_params(save=save, **params)
--> [931](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:931) extension_instance.run(save=save, **job_kwargs)
[933](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:933) self.extensions[extension_name] = extension_instance
[935](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:935) return extension_instance
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\sortinganalyzer.py:1532](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1532), in AnalyzerExtension.run(self, save, **kwargs)
[1529](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1529) self._save_params()
[1530](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1530) self._save_importing_provenance()
-> [1532](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1532) self._run(**kwargs)
[1534](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1534) if save and not self.sorting_analyzer.is_read_only():
[1535](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1535) self._save_data(**kwargs)
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\postprocessing\spike_amplitudes.py:112](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:112), in ComputeSpikeAmplitudes._run(self, **job_kwargs)
[110](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:110) def _run(self, **job_kwargs):
[111](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:111) job_kwargs = fix_job_kwargs(job_kwargs)
--> [112](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:112) nodes = self.get_pipeline_nodes()
[113](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:113) amps = run_node_pipeline(
[114](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:114) self.sorting_analyzer.recording,
[115](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:115) nodes,
(...)
[118](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:118) gather_mode="memory",
[119](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:119) )
[120](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:120) self.data["amplitudes"] = amps
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\sortinganalyzer.py:1700](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1700), in AnalyzerExtension.get_pipeline_nodes(self)
[1696](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1696) def get_pipeline_nodes(self):
[1697](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1697) assert (
[1698](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1698) self.use_nodepipeline
[1699](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1699) ), "AnalyzerExtension.get_pipeline_nodes() must be called only when use_nodepipeline=True"
-> [1700](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/sortinganalyzer.py:1700) return self._get_pipeline_nodes()
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\postprocessing\spike_amplitudes.py:92](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:92), in ComputeSpikeAmplitudes._get_pipeline_nodes(self)
[89](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:89) peak_sign = self.params["peak_sign"]
[90](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:90) return_scaled = self.sorting_analyzer.return_scaled
---> [92](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:92) extremum_channels_indices = get_template_extremum_channel(
[93](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:93) self.sorting_analyzer, peak_sign=peak_sign, outputs="index"
[94](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:94) )
[95](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:95) peak_shifts = get_template_extremum_channel_peak_shift(self.sorting_analyzer, peak_sign=peak_sign)
[97](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:97) spike_retriever_node = SpikeRetriever(
[98](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:98) recording, sorting, channel_from_template=True, extremum_channel_inds=extremum_channels_indices
[99](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:99) )
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\template_tools.py:150](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:150), in get_template_extremum_channel(templates_or_sorting_analyzer, peak_sign, mode, outputs)
[147](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:147) unit_ids = templates_or_sorting_analyzer.unit_ids
[148](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:148) channel_ids = templates_or_sorting_analyzer.channel_ids
--> [150](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:150) peak_values = get_template_amplitudes(templates_or_sorting_analyzer, peak_sign=peak_sign, mode=mode)
[151](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:151) extremum_channels_id = {}
[152](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:152) extremum_channels_index = {}
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\template_tools.py:90](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:90), in get_template_amplitudes(templates_or_sorting_analyzer, peak_sign, mode, return_scaled)
[86](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:86) before = _get_nbefore(templates_or_sorting_analyzer)
[88](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:88) peak_values = {}
---> [90](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:90) templates_array = get_dense_templates_array(templates_or_sorting_analyzer, return_scaled=return_scaled)
[92](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:92) for unit_ind, unit_id in enumerate(unit_ids):
[93](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:93) template = templates_array[unit_ind, :, :]
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\template_tools.py:30](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:30), in get_dense_templates_array(one_object, return_scaled)
[28](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:28) elif isinstance(one_object, SortingAnalyzer):
[29](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:29) if return_scaled != one_object.return_scaled:
---> [30](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:30) raise ValueError(
[31](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:31) f"get_dense_templates_array: return_scaled={return_scaled} is not possible SortingAnalyzer has the reverse"
[32](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:32) )
[33](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:33) ext = one_object.get_extension("templates")
[34](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:34) if ext is not None:
ValueError: get_dense_templates_array: return_scaled=True is not possible SortingAnalyzer has the reverse
@Hobart10,
You're right. We recently switched to return_scaled as a variable at the sorting_analyzer level. We missed switching over the init here
We will fix it!
Thank you!!
Actually I think I tracked down the real issue. It is that we use the default return_scaled=True here
Because here we don't give the explicit return_scaled.
I will submit a PR in little bit :)
@alejoe91 @samuelgarcia
So we need to be able to use return_scaled in get_template_amplitudes
but the function needs to accept SortingAnalyzer
or Templates
, but Templates
doesn't have a global return_scaled
like SortingAnalyzer
. How do we want to deal with this?
Maybe just ignore the return_scaled if a Templates object is passed?
So in the PR I just sent return_scaled
to True (the previous behavior) if a Templates
object is passed since it is a required argument for the function. Let me know if you want something else.
@Hobart10, if you want to test this for us you can install from the linked PR and see if that fixes your issue. We might be missing another spot so it would be cool to have someone test this so we can make sure all steps are working :)
Hi Zach @zm711, thank you for the fixing!
I tested with the PR and got same error and I think it's because return_scaled
didn't pass to get_dense_templates_array
when calling from get_template_extremum_channel_peak_shift
, and default return_scaled
in get_dense_templates_array
is True.
https://github.com/SpikeInterface/spikeinterface/blob/e440d8a6dab688ad8a2ffab1e82b3ce530626a15/src/spikeinterface/core/template_tools.py#L199
Therefore this error raises: https://github.com/SpikeInterface/spikeinterface/blob/e440d8a6dab688ad8a2ffab1e82b3ce530626a15/src/spikeinterface/core/template_tools.py#L26-L32
Trace back of the error:
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\postprocessing\spike_amplitudes.py:95](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:95), in ComputeSpikeAmplitudes._get_pipeline_nodes(self)
[90](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:90) return_scaled = self.sorting_analyzer.return_scaled
[92](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:92) extremum_channels_indices = get_template_extremum_channel(
[93](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:93) self.sorting_analyzer, peak_sign=peak_sign, outputs="index"
[94](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:94) )
---> [95](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:95) peak_shifts = get_template_extremum_channel_peak_shift(self.sorting_analyzer, peak_sign=peak_sign)
[97](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:97) spike_retriever_node = SpikeRetriever(
[98](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:98) recording, sorting, channel_from_template=True, extremum_channel_inds=extremum_channels_indices
[99](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:99) )
[100](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:100) spike_amplitudes_node = SpikeAmplitudeNode(
[101](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:101) recording,
[102](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:102) parents=[spike_retriever_node],
(...)
[105](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:105) return_scaled=return_scaled,
[106](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/postprocessing/spike_amplitudes.py:106) )
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\template_tools.py:199](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:199), in get_template_extremum_channel_peak_shift(templates_or_sorting_analyzer, peak_sign)
[195](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:195) extremum_channels_ids = get_template_extremum_channel(templates_or_sorting_analyzer, peak_sign=peak_sign)
[197](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:197) shifts = {}
--> [199](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:199) templates_array = get_dense_templates_array(templates_or_sorting_analyzer)
[201](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:201) for unit_ind, unit_id in enumerate(unit_ids):
[202](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:202) template = templates_array[unit_ind, :, :]
File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\core\template_tools.py:30](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:30), in get_dense_templates_array(one_object, return_scaled)
[28](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:28) elif isinstance(one_object, SortingAnalyzer):
[29](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:29) if return_scaled != one_object.return_scaled:
---> [30](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:30) raise ValueError(
[31](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:31) f"get_dense_templates_array: return_scaled={return_scaled} is not possible SortingAnalyzer has the reverse"
[32](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:32) )
[33](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:33) ext = one_object.get_extension("templates")
[34](https://file+.vscode-resource.vscode-cdn.net/d%3A/YK_pyfile/SI/SI_Proc/~/.conda/envs/SI/spikeinterface/src/spikeinterface/core/template_tools.py:34) if ext is not None:
ValueError: get_dense_templates_array: return_scaled=True is not possible SortingAnalyzer has the reverse
Good catch @Hobart10 ! I just patched that and found one other spot in template tools where we needed to grab the return_scaled
. Could you try now with the same PR!
@zm711 Thank you!! Now it works in my test!
@Hobart10 We'll close this one when the PR is merged :)
Hi, thank you for developing and maintaining this wonderful module and community! I had several issues in computing extension
spike_amplitudes
and exporting to phy with the extension. Phy exporting requires sorting analyzer parameterreturn_scaled
to be False, but seems the default parameter forspike_amplitudes
computation is True and there are no option to modify. And if I don't specify the dtype ofwaveforms
extension to 'int16', the scaling error will happen there. Spikeinterface version: lastest; kilosort 4 version: 4.0.4. Any help of how I can export will be highly appreciated!Error info:
ValueError: get_dense_templates_array: return_scaled=True is not possible SortingAnalyzer has the reverse
Code snippet: