diff --git a/pcpostprocess/scripts/run_herg_qc.py b/pcpostprocess/scripts/run_herg_qc.py index a154593..7e1a64b 100644 --- a/pcpostprocess/scripts/run_herg_qc.py +++ b/pcpostprocess/scripts/run_herg_qc.py @@ -4,7 +4,6 @@ # import argparse import importlib.util -import json import logging import multiprocessing import os @@ -12,7 +11,6 @@ import string import sys -import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -414,7 +412,7 @@ def run(data_path, output_path, save_id, staircase_protocols, # Store the results by adding an extra column to qc_df qc_df['qc3.bookend'] = [qc3_bookend_dict[well] for well in qc_df.well] - del(qc3_bookend_dict) + del qc3_bookend_dict # # Write a file chrono.txt containing the order that protocols were run in @@ -459,7 +457,7 @@ def run(data_path, output_path, save_id, staircase_protocols, # QC Erev spread: check spread in reversal potential isn't too large E_revs = sub_df['E_rev'].values.flatten().astype(np.float64) E_rev_spread = E_revs.max() - E_revs.min() - del(E_revs) + del E_revs passed_QC_Erev_spread = E_rev_spread <= reversal_spread_threshold logging.info(f'passed_QC_Erev_spread {passed_QC_Erev_spread}') erev_spreads[well] = E_rev_spread @@ -614,8 +612,8 @@ def agg_func(x): def run_secondary_qc(readname, savename, time_strs, selected_wells, savedir, - data_path, figure_size, reversal_potential, save_id, - write_traces): + data_path, figure_size, reversal_potential, save_id, + write_traces): """ Performs QC on a protocol (staircase or other), and exports the traces. @@ -705,7 +703,7 @@ def run_secondary_qc(readname, savename, time_strs, selected_wells, savedir, np.vstack((times, voltages)).T, columns=['time', 'voltage']) voltage_df.to_csv(os.path.join( trace_dir, f'{save_id}-{savename}-voltages.csv')) - #write_csv(times, trace_dir, f'{save_id}-{savename}-times.csv') + # write_csv(times, trace_dir, f'{save_id}-{savename}-times.csv') qc_before = before_trace.get_onboard_QC_values() qc_after = after_trace.get_onboard_QC_values() diff --git a/pcpostprocess/tests/test_scripts.py b/pcpostprocess/tests/test_scripts.py index 9683952..46012c7 100755 --- a/pcpostprocess/tests/test_scripts.py +++ b/pcpostprocess/tests/test_scripts.py @@ -43,9 +43,15 @@ def test_run_herg_qc_and_summarise_herg_export(self): qc_map = {'staircaseramp (2)_2kHz': 'staircaseramp'} write_map = {'staircaseramp2': 'staircaseramp2'} run_herg_qc( - data, d1, qc_map, ('A03', 'A20', 'D16'), - write_traces=True, write_map=write_map, - save_id='13112023_MW2', reversal_potential=erev) + data, + d1, + '13112023_MW2', + qc_map, + write_map, + ('A03', 'A20', 'D16'), + write_traces=True, + reversal_potential=erev, + ) with open(os.path.join(d1, 'passed_wells.txt'), 'r') as f: self.assertEqual(f.read().strip(), 'A03')