Repository: spikeinterface/spikeinterface
Issue: f strings not joined before passed to warnings in pca_metrics

On line 466 in the pca_metrics file (https://github.com/SpikeInterface/spikeinterface/blob/main/src/spikeinterface/qualitymetrics/pca_metrics.py), the following lines result in an error. It seems like the f strings are getting interpreted as separate arguments (one of which should be an integer) rather than joined and interpreted as a single argument. There are a few other places in this file with a similar issue. Removing commands fixed the issue.

`TypeError: 'str' object cannot be interpreted as an integer`

`    if n_spikes_all_units[this_unit_id] < min_spikes:
        warnings.warn(
            f"Warning: unit {this_unit_id} has fewer spikes than ",
            f"specified by `min_spikes` ({min_spikes}); ",
            f"returning NaN as the quality metric...",
        )
        return np.nan, np.nan`

Changed files:
src/spikeinterface/qualitymetrics/pca_metrics.py

diff --git a/src/spikeinterface/qualitymetrics/pca_metrics.py b/src/spikeinterface/qualitymetrics/pca_metrics.py
index 2a0feb4d..e7254987 100644
--- a/src/spikeinterface/qualitymetrics/pca_metrics.py
+++ b/src/spikeinterface/qualitymetrics/pca_metrics.py
@@ -466,15 +466,14 @@ def nearest_neighbors_isolation(
     # if target unit has fewer than `min_spikes` spikes, print out a warning and return NaN
     if n_spikes_all_units[this_unit_id] < min_spikes:
         warnings.warn(
-            f"Warning: unit {this_unit_id} has fewer spikes than ",
-            f"specified by `min_spikes` ({min_spikes}); ",
-            f"returning NaN as the quality metric...",
+            f"Unit {this_unit_id} has fewer spikes than specified by `min_spikes` "
+            f"({min_spikes}); returning NaN as the quality metric..."
         )
         return np.nan, np.nan
     elif fr_all_units[this_unit_id] < min_fr:
         warnings.warn(
-            f"Warning: unit {this_unit_id} has a firing rate ",
-            f"below the specified `min_fr` ({min_fr}Hz); " f"returning NaN as the quality metric...",
+            f"Unit {this_unit_id} has a firing rate below the specified `min_fr` "
+            f"({min_fr} Hz); returning NaN as the quality metric..."
         )
         return np.nan, np.nan
     else:
@@ -652,15 +651,14 @@ def nearest_neighbors_noise_overlap(
     # if target unit has fewer than `min_spikes` spikes, print out a warning and return NaN
     if n_spikes_all_units[this_unit_id] < min_spikes:
         warnings.warn(
-            f"Warning: unit {this_unit_id} has fewer spikes than ",
-            f"specified by `min_spikes` ({min_spikes}); ",
-            f"returning NaN as the quality metric...",
+            f"Unit {this_unit_id} has fewer spikes than specified by `min_spikes` "
+            f"({min_spikes}); returning NaN as the quality metric..."
         )
         return np.nan
     elif fr_all_units[this_unit_id] < min_fr:
         warnings.warn(
-            f"Warning: unit {this_unit_id} has a firing rate ",
-            f"below the specified `min_fr` ({min_fr}Hz); " f"returning NaN as the quality metric...",
+            f"Unit {this_unit_id} has a firing rate below the specified `min_fr` "
+            f"({min_fr} Hz); returning NaN as the quality metric...",
         )
         return np.nan
     else: