@@ -148,8 +148,8 @@ def run_qc(self, voltage_steps, times, before, after, qc_vals_before,
148148 if not n_sweeps :
149149 n_sweeps = len (before )
150150
151- before = self ._filter_capacitive_spikes (np .array (before ), times , voltage_steps )
152- after = self ._filter_capacitive_spikes (np .array (after ), times , voltage_steps )
151+ before = self .filter_capacitive_spikes (np .array (before ), times , voltage_steps )
152+ after = self .filter_capacitive_spikes (np .array (after ), times , voltage_steps )
153153
154154 QC = QCDict ()
155155
@@ -395,10 +395,10 @@ def qc4(self, rseals, cms, rseriess):
395395
396396 return [(qc41 , d_rseal ), (qc42 , d_cm ), (qc43 , d_rseries )]
397397
398- def qc5 (self , recording1 , recording2 , win = None , label = None ):
398+ def qc5 (self , recording1 , recording2 , win , label = None ):
399399 """
400- Checks whether the peak current in ``recording1`` has been blocked in
401- ``recording2``.
400+ Checks whether the peak current in ``recording1`` during a given window
401+ has been blocked in ``recording2``.
402402
403403 First, find an ``i`` such that ``recording1[i]`` is the largest
404404 (positive) current (if a window is given, only this window is
@@ -408,23 +408,18 @@ def qc5(self, recording1, recording2, win=None, label=None):
408408
409409 @param recording1 A staircase before blocker application
410410 @param recording2 A staircase with a strong blocker, e.g. E-4031
411- @param win An optional window (lower and upper indices) within which to search for peak current
411+ @param win A tuple ``(i, j)`` such that ``recording[i:j]`` is the window to search in
412412 @param label An optional label for a plot
413413 @returns a tuple ``(passed, 0.75 * recording1[i] - (recording1[i] - recording2[i]))``.
414414 """
415- if win is not None :
416- i , f = win
417- else :
418- i , f = 0 , None
419-
420415 if self ._plot_dir is not None and label is not None :
421- if win is not None :
422- plt .axvspan (win [0 ], win [1 ], color = 'grey' , alpha = .1 )
416+ plt .axvspan (win [0 ], win [1 ], color = 'grey' , alpha = .1 )
423417 plt .plot (recording1 , label = 'recording1' )
424418 plt .plot (recording2 , label = 'recording2' )
425419 plt .savefig (os .path .join (self ._plot_dir , f'qc5_{ label } ' ))
426420 plt .clf ()
427421
422+ i , f = win
428423 wherepeak = np .argmax (recording1 [i :f ])
429424 max_diff = recording1 [i :f ][wherepeak ] - recording2 [i :f ][wherepeak ]
430425 max_diffc = self .max_diffc * recording1 [i :f ][wherepeak ]
@@ -514,7 +509,7 @@ def qc6(self, recording1, win, label=None):
514509 # TODO Return val / valc here?
515510 return (result , valc - val )
516511
517- def _filter_capacitive_spikes (self , current , times , voltage_step_times ):
512+ def filter_capacitive_spikes (self , current , times , voltage_step_times ):
518513 """
519514 Set values to 0 where they lie less than ``removal_time`` after a change in voltage.
520515
0 commit comments