Skip to content

Commit fe38fca

Browse files
authored
Merge pull request #128 from CardiacModelling/style-fixes
Style fixes. And fix to script test
2 parents 0a0c1da + 8b415a5 commit fe38fca

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

pcpostprocess/scripts/run_herg_qc.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
#
55
import argparse
66
import importlib.util
7-
import json
87
import logging
98
import multiprocessing
109
import os
1110
import re
1211
import string
1312
import sys
1413

15-
import matplotlib
1614
import matplotlib.pyplot as plt
1715
import numpy as np
1816
import pandas as pd
@@ -414,7 +412,7 @@ def run(data_path, output_path, save_id, staircase_protocols,
414412

415413
# Store the results by adding an extra column to qc_df
416414
qc_df['qc3.bookend'] = [qc3_bookend_dict[well] for well in qc_df.well]
417-
del(qc3_bookend_dict)
415+
del qc3_bookend_dict
418416

419417
#
420418
# 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,
459457
# QC Erev spread: check spread in reversal potential isn't too large
460458
E_revs = sub_df['E_rev'].values.flatten().astype(np.float64)
461459
E_rev_spread = E_revs.max() - E_revs.min()
462-
del(E_revs)
460+
del E_revs
463461
passed_QC_Erev_spread = E_rev_spread <= reversal_spread_threshold
464462
logging.info(f'passed_QC_Erev_spread {passed_QC_Erev_spread}')
465463
erev_spreads[well] = E_rev_spread
@@ -614,8 +612,8 @@ def agg_func(x):
614612

615613

616614
def run_secondary_qc(readname, savename, time_strs, selected_wells, savedir,
617-
data_path, figure_size, reversal_potential, save_id,
618-
write_traces):
615+
data_path, figure_size, reversal_potential, save_id,
616+
write_traces):
619617
"""
620618
Performs QC on a protocol (staircase or other), and exports the traces.
621619
@@ -705,7 +703,7 @@ def run_secondary_qc(readname, savename, time_strs, selected_wells, savedir,
705703
np.vstack((times, voltages)).T, columns=['time', 'voltage'])
706704
voltage_df.to_csv(os.path.join(
707705
trace_dir, f'{save_id}-{savename}-voltages.csv'))
708-
#write_csv(times, trace_dir, f'{save_id}-{savename}-times.csv')
706+
# write_csv(times, trace_dir, f'{save_id}-{savename}-times.csv')
709707

710708
qc_before = before_trace.get_onboard_QC_values()
711709
qc_after = after_trace.get_onboard_QC_values()

pcpostprocess/tests/test_scripts.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ def test_run_herg_qc_and_summarise_herg_export(self):
4343
qc_map = {'staircaseramp (2)_2kHz': 'staircaseramp'}
4444
write_map = {'staircaseramp2': 'staircaseramp2'}
4545
run_herg_qc(
46-
data, d1, qc_map, ('A03', 'A20', 'D16'),
47-
write_traces=True, write_map=write_map,
48-
save_id='13112023_MW2', reversal_potential=erev)
46+
data,
47+
d1,
48+
'13112023_MW2',
49+
qc_map,
50+
write_map,
51+
('A03', 'A20', 'D16'),
52+
write_traces=True,
53+
reversal_potential=erev,
54+
)
4955

5056
with open(os.path.join(d1, 'passed_wells.txt'), 'r') as f:
5157
self.assertEqual(f.read().strip(), 'A03')

0 commit comments

Comments
 (0)