Skip to content

Commit 23bd46c

Browse files
authored
Merge pull request #50 from CardiacModelling/ak_user_test
added user-readabe error messages for for wrong arguments
2 parents f5e5052 + 203b3fa commit 23bd46c

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/tests/test_data
22
*.pyc
33
*.DS_Store
4-
*__pycache__*
4+
*__pycache__*
5+
*.egg-info

pcpostprocess/scripts/run_herg_qc.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ def main():
8787

8888
else:
8989
wells = args.wells
90+
# this warning addresses the error that occurs if a user inputs wrong data into args.wells
91+
wrongWellNames = [well for well in wells if well not in all_wells]
92+
if len(wrongWellNames) > 0:
93+
if len(wrongWellNames) == len(wells):
94+
logging.error("Specified well names are not in the list of available wells.")
95+
return
96+
else:
97+
logging.warning(f"Specified well names {wrongWellNames} are not in the list of available wells."
98+
f"Removing them from the list of wells to be processed.")
99+
wells = [well for well in wells if well not in wrongWellNames]
100+
# other functions read args.wells later on, so we need to update it
101+
args.wells = wells
90102

91103
# Import and exec config file
92104
global export_config
@@ -160,6 +172,11 @@ def main():
160172
times_list.append([times[1], times[3]])
161173
readnames.append(protocol)
162174

175+
# this error is raised if the user has not specified the dictionary of protocols in the export_config.py file
176+
if not readnames:
177+
logging.error("No compatible protocols found in export config file.")
178+
return
179+
163180
with multiprocessing.Pool(min(args.no_cpus, len(readnames)),
164181
**pool_kws) as pool:
165182

0 commit comments

Comments
 (0)