Main
This module has the code that sets up the application and launches the Bokeh server.
init_cli
Use argparse to define the command line arguments:
-
--action: a verb that defines how the app will run:generate: used to test the code that makes the input file for OptiPass; make the file, print it, and exitrun: used to test the code that runs OptiPass; make the input file, then create and run the shell commands that run OptiPass.exepreview: same asrunbut just prints the shell commands instead of executing themparse: used to test the code that parses the output from OptiPass; requires the--outputoption to specify the path to files created by OptiPassall: used to run an integration test: generates the input for OptiPass, runs OptiPass, parses the results, displays the plotsgui: same asallbut puts the results in the GUI
-
--project: path to a CSV file with barrier descriptions (default:static/workbook.csv) -
--regions: one or more region names (used to test data file generation and parsing)
Command Line
The application needs files in the bin and static folders of the project.
To run the application, open a terminal window and cd to the top level folder.
The application is in the src folder.
Type this command to make sure the application is installed and configured:
$ python3 src/main.py --help
Start the Server
To start the application simply run the program without any command line arguments:
$ python3 src/main.py
Integration Tests
The command line arguments allow the developer to run various integration tests.
This example tests the code that creates the input files for OptiPass by making a file for gates in the Coos region and targets CO and CH.
$ python3 src/main.py --action generate --region Coos --targets CO CH --output test1
Test the code that makes the output panes (data tables and ROI plots) by parsing
the results of a previous run, in this case a set of files that start with the
string tmpwok9i8rl.
$ python3 src/main.py --action parse --region Coquille --out tmpwok9i8rl
Source
Use argparse to create the command line API.
| Returns: |
|
|---|
src/main.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
make_app
Instantiate the top level widget.
| Returns: |
|
|---|
src/main.py
70 71 72 73 74 75 76 77 78 79 80 | |
start_app
Launch the Bokeh server.
src/main.py
82 83 84 85 86 87 88 89 90 91 92 93 94 | |
validate_options
Make sure values specified on the command line are valid for that option. Prints an error message and exits if an unknown value is specified.
Example: check the names specified for the "region" option by making sure the values on the command line ("args.region") are in the list of valid names ("region_names").
validate_options('region', args.regions, region_names)
| Parameters: |
|
|---|
src/main.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |