CardiacModelling / pcpostprocess

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Add output trace flag #9

Closed joeyshuttleworth closed 2 months ago

joeyshuttleworth commented 2 months ago

Description

Fixes #10. Currently, a lot of large .csv files are produced when the run_herg_qc.py script is run. Add a command line argument, which (by default) allows run_herg_qc.py to be run without generating .csv files for each raw and processed trace.

Also tidy up some plots and produce additional output in scripts/summarise_herg_export.py and fix some subtraction plot bugs.

Types of changes

Testing

Documentation checklist

joeyshuttleworth commented 2 months ago
  1. There is a \text bug in the summarise_herg_export.py

    1. There is also some problem with Tk (see tb.txt attached) that happens when you python3 scripts/run_herg_qc.py ../25112022_MW1_FF/ --output_dir ../25112022_MW_FF_processed tb.txt

    2. I am not sure if it was broken in this commit, but when you chose a particular protocol there is a pandas concatenate issue (see tb1.txt). tb1.txt Tested with: python3 scripts/run_herg_qc.py ../25112022_MW1_FF/ --output_dir ../25112022_MW_FF_processed --protocols rvot --wells B20 2>./tb1.txt

    3. Even when a particular protocol is chosen run_heg_qc1 sill runs staircamp1 protocols. This make things very slow, we might want to reconsider that.

    4. I have not tested the main "--output_traces" feature yet, but this particular portion of code (lines 535-553 in the run_herg_qc.py) looks fine to me.

I will write fix 1. and write 3. and 4. as a separate issues

kwabenantim commented 2 months ago

Run Command

python3 scripts/run_herg_qc.py ../25112022_MW1_FF/ --output_dir ../25112022_MW_FF_processed

Error

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ras/Projects/Joe/pcpostprocess/scripts/run_herg_qc.py", line 779, in extract_protocol
    do_subtraction_plot(fig, times, sweeps, before_current, after_current,
  File "/home/ras/Projects/Joe/pcpostprocess/pcpostprocess/subtraction_plots.py", line 65, in do_subtraction_plot
    gleak, Eleak = sub_df.loc[sweep][['gleak_before', 'E_leak_before']].values.astype(np.float64)
    ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/ras/Projects/Joe/pcpostprocess/scripts/run_herg_qc.py", line 1263, in <module>
    main()
  File "/home/ras/Projects/Joe/pcpostprocess/scripts/run_herg_qc.py", line 277, in main
    dfs = list(pool.starmap(extract_protocol, args_list))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 774, in get
    raise self._value
ValueError: too many values to unpack (expected 2)
RomanSyunyaev commented 2 months ago

Last commit seems to fix "too many values to unpack (expected 2)" issue.

Tested with: python3 scripts/run_herg_qc.py ../25112022_MW1_FF/ --output_dir ../25112022_MW_FF_processed Seems to run properly now.