2121 * "snr" : threshold based on template signal-to-noise ratio. Use the "threshold" argument
2222 to specify the SNR threshold (in units of noise levels) and the "amplitude_mode" argument
2323 to specify the mode to compute the amplitude of the templates.
24- * "amplitude" : threshold based on the amplitude values on every channels. Use the "threshold" argument
25- to specify the ptp threshold (in units of amplitude) and the "amplitude_mode" argument
24+ * "amplitude" : threshold based on the amplitude values on every channels. Use the "amplitude_mode" argument
2625 to specify the mode to compute the amplitude of the templates.
2726 * "energy" : threshold based on the expected energy that should be present on the channels,
2827 given their noise levels. Use the "threshold" argument to specify the energy threshold
3837 radius_um : float
3938 Radius in um for "radius" method.
4039 threshold : float
41- Threshold for "snr", "energy" (in units of noise levels) and "ptp" methods (in units of amplitude).
40+ Threshold for "snr" and "energy" (in units of noise levels) (in units of amplitude).
4241 For the "snr" method, the template amplitude mode is controlled by the "amplitude_mode" argument.
4342 amplitude_mode : "extremum" | "at_index" | "peak_to_peak"
4443 Mode to compute the amplitude of the templates for the "snr", "amplitude", and "best_channels" methods.
@@ -607,9 +606,7 @@ def create_dense(cls, sorting_analyzer):
607606def compute_sparsity (
608607 templates_or_sorting_analyzer : "Templates | SortingAnalyzer" ,
609608 noise_levels : np .ndarray | None = None ,
610- method : (
611- "radius" | "best_channels" | "closest_channels" | "snr" | "amplitude" | "energy" | "by_property" | "ptp"
612- ) = "radius" ,
609+ method : "radius" | "best_channels" | "closest_channels" | "snr" | "amplitude" | "energy" | "by_property" = "radius" ,
613610 peak_sign : "neg" | "pos" | "both" = "neg" ,
614611 num_channels : int | None = 5 ,
615612 radius_um : float | None = 100.0 ,
@@ -644,7 +641,13 @@ def compute_sparsity(
644641 # to keep backward compatibility
645642 templates_or_sorting_analyzer = templates_or_sorting_analyzer .sorting_analyzer
646643
647- if method in ("best_channels" , "closest_channels" , "radius" , "snr" , "amplitude" , "ptp" ):
644+ if method in (
645+ "best_channels" ,
646+ "closest_channels" ,
647+ "radius" ,
648+ "snr" ,
649+ "amplitude" ,
650+ ):
648651 assert isinstance (
649652 templates_or_sorting_analyzer , (Templates , SortingAnalyzer )
650653 ), f"compute_sparsity(method='{ method } ') need Templates or SortingAnalyzer"
@@ -687,14 +690,6 @@ def compute_sparsity(
687690 sparsity = ChannelSparsity .from_property (
688691 templates_or_sorting_analyzer .sorting , templates_or_sorting_analyzer .recording , by_property
689692 )
690- elif method == "ptp" :
691- # TODO: remove after deprecation
692- assert threshold is not None , "For the 'ptp' method, 'threshold' needs to be given"
693- sparsity = ChannelSparsity .from_ptp (
694- templates_or_sorting_analyzer ,
695- threshold ,
696- noise_levels = noise_levels ,
697- )
698693 else :
699694 raise ValueError (f"compute_sparsity() method={ method } does not exists" )
700695
@@ -710,7 +705,7 @@ def estimate_sparsity(
710705 num_spikes_for_sparsity : int = 100 ,
711706 ms_before : float = 1.0 ,
712707 ms_after : float = 2.5 ,
713- method : "radius" | "best_channels" | "closest_channels" | "amplitude" | "snr" | "by_property" | "ptp" = "radius" ,
708+ method : "radius" | "best_channels" | "closest_channels" | "amplitude" | "snr" | "by_property" = "radius" ,
714709 peak_sign : "neg" | "pos" | "both" = "neg" ,
715710 radius_um : float = 100.0 ,
716711 num_channels : int = 5 ,
@@ -759,9 +754,9 @@ def estimate_sparsity(
759754 # Can't be done at module because this is a cyclic import, too bad
760755 from .template import Templates
761756
762- assert method in ("radius" , "best_channels" , "closest_channels" , "snr" , "amplitude" , "by_property" , "ptp" ), (
757+ assert method in ("radius" , "best_channels" , "closest_channels" , "snr" , "amplitude" , "by_property" ), (
763758 f"method={ method } is not available for `estimate_sparsity()`. "
764- "Available methods are 'radius', 'best_channels', 'snr', 'amplitude', 'by_property', 'ptp' (deprecated) "
759+ "Available methods are 'radius', 'best_channels', 'snr', 'amplitude', 'by_property'"
765760 )
766761
767762 if recording .get_probes () == 1 :
@@ -838,14 +833,6 @@ def estimate_sparsity(
838833 sparsity = ChannelSparsity .from_amplitude (
839834 templates , threshold , amplitude_mode = amplitude_mode , peak_sign = peak_sign
840835 )
841- elif method == "ptp" :
842- # TODO: remove after deprecation
843- assert threshold is not None , "For the 'ptp' method, 'threshold' needs to be given"
844- assert noise_levels is not None , (
845- "For the 'snr' method, 'noise_levels' needs to be given. You can use the "
846- "`get_noise_levels()` function to compute them."
847- )
848- sparsity = ChannelSparsity .from_ptp (templates , threshold , noise_levels = noise_levels )
849836 else :
850837 raise ValueError (f"compute_sparsity() method={ method } does not exists" )
851838 else :
0 commit comments