Skip to content
Merged
12 changes: 4 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
wget https://cardiac.nottingham.ac.uk/syncropatch_export/test_data.tar.xz -P tests/
tar xvf tests/test_data.tar.xz -C tests/

- name: Install TeX dependencies for run_herg_qc test
timeout-minutes: 5
run: sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super -y

- name: Run unit tests (without coverage testing)
if: ${{ success() && matrix.python-version != env.python-latest }}
run: python -m unittest
Expand All @@ -56,14 +60,6 @@ jobs:
if: ${{ success() && matrix.python-version == env.python-latest }}
run: coverage run -m unittest

- name: Install TeX dependencies for run_herg_qc test
timeout-minutes: 15
run: sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super -y

- name: Run `run_herg_qc` script
timeout-minutes: 15
run: pcpostprocess run_herg_qc tests/test_data/13112023_MW2_FF -w A01 A02 A03

- name: Report coverage to codecov
uses: codecov/codecov-action@v4
if: ${{ success() && matrix.python-version == env.python-latest }}
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Isort is configured in [pyproject.toml](./pyproject.toml) under the section `too
## Documentation

Every method and every class should have a [docstring](https://www.python.org/dev/peps/pep-0257/) that describes in plain terms what it does, and what the expected input and output is.
The only exception are unit test methods starting with `test_` - unit test classes and other methods in unit tests should all have docstrings.

Each docstring should start with a one-line explanation.
If more explanation is needed, this one-liner is followed by a blank line and more information in the following paragraphs.
Expand Down
2 changes: 1 addition & 1 deletion pcpostprocess/scripts/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def main():
run_herg_qc.run_from_command_line()

elif args.subcommand == "summarise_herg_export":
summarise_herg_export.main()
summarise_herg_export.run_from_command_line()


if __name__ == "__main__":
Expand Down
24 changes: 7 additions & 17 deletions pcpostprocess/scripts/run_herg_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import string
import sys

import cycler
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -28,17 +27,11 @@
from pcpostprocess.leak_correct import fit_linear_leak, get_leak_corrected
from pcpostprocess.subtraction_plots import do_subtraction_plot

# TODO: Remove this
color_cycle = ["#5790fc", "#f89c20", "#e42536", "#964a8b", "#9c9ca1", "#7a21dd"]
plt.rcParams['axes.prop_cycle'] = cycler.cycler('color', color_cycle)

# TODO: Not sure we need to explicitly set this!
matplotlib.use('Agg')


def run_from_command_line():
"""
Reads arguments from the command line and runs herg QC.
Reads arguments from the command line and an ``export_config.py`` and then
runs herg QC.
"""

parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -109,11 +102,7 @@ def run(data_path, output_path, qc_map, wells=None,
write_traces=False, write_failed_traces=False, write_map={},
reversal_potential=-90, reversal_spread_threshold=10,
max_processes=1, figure_size=None,
debug=False,

save_id=None,

):
debug=False, save_id=None):
"""
Imports traces and runs QC.

Expand Down Expand Up @@ -148,6 +137,9 @@ def run(data_path, output_path, qc_map, wells=None,
# TODO Remove protocol selection here: this is done via the export file!
# Only protocols listed there are accepted

# TODO: Find some way around setting this?
matplotlib.use('Agg')

# Select wells to use
all_wells = [row + str(i).zfill(2) for row in string.ascii_uppercase[:16]
for i in range(1, 25)]
Expand Down Expand Up @@ -503,8 +495,6 @@ def agg_func(x):
qc_df['protocol'] = ['staircaseramp1_2' if p == 'staircaseramp2' else p
for p in qc_df.protocol]

print(qc_df.protocol.unique())

fails_dict = {}
no_wells = 384

Expand Down Expand Up @@ -1255,7 +1245,7 @@ def fit_func(x, args=None):
]

# TESTING ONLY
np.random.seed(1)
# np.random.seed(1)

#  Repeat optimisation with different starting guesses
x0s = [[np.random.uniform(lower_b, upper_b) for lower_b, upper_b in bounds] for i in range(100)]
Expand Down
Loading