Skip to content

Commit 50360f6

Browse files
committed
Made filter_capacitive_spikes accept 1-d arrays again.
1 parent b3a93cb commit 50360f6

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pcpostprocess/hergQC.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ def qc6(self, recording1, win, label=None):
511511

512512
def filter_capacitive_spikes(self, current, times, voltage_step_times):
513513
"""
514-
Set values to 0 where they lie less than ``removal_time`` after a change in voltage.
514+
Set currents to 0 where they lie less than ``removal_time`` after a change in voltage.
515515
516-
@param current: The observed current, as a 1 or multi-dimensional array.
517-
If a multi-dimensional array is used, repeats must be
516+
@param current: The observed current, as a 1 or 2-dimensional array.
517+
If a 2-dimensional array is used, repeats must be
518518
on the first axis, and time series values on the 2nd.
519519
@param times: the times at which the current was observed
520520
@param voltage_step_times: the times at which there are discontinuities in Vcmd
@@ -529,6 +529,11 @@ def filter_capacitive_spikes(self, current, times, voltage_step_times):
529529
if i_end == 0:
530530
break
531531

532-
current[:, i_start:i_end] = 0
532+
if len(current.shape) == 2:
533+
current[:, i_start:i_end] = 0
534+
elif len(current.shape) == 1:
535+
current[i_start:i_end] = 0
536+
else:
537+
raise ValueError('Current array must be 1 or 2-dimensional')
533538

534539
return current

0 commit comments

Comments
 (0)