Skip to content

Commit

Permalink
Merge pull request #50 from CardiacModelling/ak_user_test
Browse files Browse the repository at this point in the history
added user-readabe error messages for for wrong arguments
  • Loading branch information
hilaryh authored Dec 12, 2024
2 parents f5e5052 + 203b3fa commit 23bd46c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/tests/test_data
*.pyc
*.DS_Store
*__pycache__*
*__pycache__*
*.egg-info
17 changes: 17 additions & 0 deletions pcpostprocess/scripts/run_herg_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def main():

else:
wells = args.wells
# this warning addresses the error that occurs if a user inputs wrong data into args.wells
wrongWellNames = [well for well in wells if well not in all_wells]
if len(wrongWellNames) > 0:
if len(wrongWellNames) == len(wells):
logging.error("Specified well names are not in the list of available wells.")
return
else:
logging.warning(f"Specified well names {wrongWellNames} are not in the list of available wells."
f"Removing them from the list of wells to be processed.")
wells = [well for well in wells if well not in wrongWellNames]
# other functions read args.wells later on, so we need to update it
args.wells = wells

# Import and exec config file
global export_config
Expand Down Expand Up @@ -160,6 +172,11 @@ def main():
times_list.append([times[1], times[3]])
readnames.append(protocol)

# this error is raised if the user has not specified the dictionary of protocols in the export_config.py file
if not readnames:
logging.error("No compatible protocols found in export config file.")
return

with multiprocessing.Pool(min(args.no_cpus, len(readnames)),
**pool_kws) as pool:

Expand Down

0 comments on commit 23bd46c

Please sign in to comment.