Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide examples and update command line interface #203

Merged
merged 11 commits into from
Aug 27, 2024
Merged

Conversation

K20shores
Copy link
Collaborator

@K20shores K20shores commented Aug 27, 2024

  • All examples are easily used from the command line
  • Color can be added to the output
  • Verbose logging can be enabled and more added
  • CSV output is put directly into the terminal, but can also be printed
  • Logging format updated to be slightly easier to readf
:: music_box -h                                        
usage: music_box [-h] [-c CONFIG] [-e {CB5,Chapman,FlowTube,Analytical}] [-o OUTPUT] [-v] [--color-output] [--plot PLOT]

MusicBox simulation runner.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Path to the configuration file. If --example is provided, this argument is ignored.
  -e {CB5,Chapman,FlowTube,Analytical}, --example {CB5,Chapman,FlowTube,Analytical}
                        Name of the example to use. Overrides --config.
                        Available examples:
                        CB5: Carbon bond 5
                        Chapman: The Chapman cycle with conditions over Boulder, Colorado
                        FlowTube: A fictitious flow tube experiment
                        Analytical: An example of an analytical solution to a simple chemical system
  -o OUTPUT, --output OUTPUT
                        Path to save the output file, including the file name. If not provided, result will be printed to the console.
  -v, --verbose         Increase logging verbosity. Use -v for info, -vv for debug.
  --color-output        Enable color output for logs.
  --plot PLOT           Plot a comma-separated list of species if gnuplot is available (e.g., CONC.A,CONC.B).

Can be used like this

music_box -e Chapman
music_box -e Chapman -o output.csv
music_box -e Chapman -o output/solution.csv
music_box -e Chapman -o output.csv -v
music_box -e Chapman -o output.csv -vv --color-output

Looks like this

Screenshot 2024-08-26 at 11 50 36 PM

and simple plots can be made if gnuplot is installed

music_box -e Chapman -o output.csv --plot CONC.O1D                              

                                                                                                                        
                                                                                                                        
           -18                                            Time vs Species                                               
       2x10    +----------------------------------------------------------------------------------------------------+   
           -18 |          +   **     +           +*         +        * +          +     **    +          +  *       |   
     1.8x10    |-+            **                 **                  **                 **         CONC.O1D********-|   
           -18 |             ***                 ***                * *                 **                 * *      |   
     1.6x10-18 |-+           * *                 * *                * *                ** *                * *    +-|   
     1.4x10    |-+           *  *               ** *                * *                *  *                * *    +-|   
           -18 |             *  *               *  *                * **               *  *               ** *      |   
     1.2x10    |-+           *  *               *  *                *  *               *  *               *  **   +-|   
           -18 |             *  *               *  *               *   *               *  *               *   *     |   
Value  1x10    |-+           *  *               *   *              *   *               *  *               *   *   +-|   
           -19 |            *   *               *   *              *   *               *  **              *   *     |   
       8x10    |-+          *   **              *   *              *   *              **   *              *   *   +-|   
           -19 |            *    *             **   *              *   **             *    *              *   *     |   
       6x10-19 |-+          *    *             *    *              *    *             *    *             **   *   +-|   
       4x10    |-+          *    *             *    *             **    *             *    *             *    **  +-|   
           -19 |            *    *             *    **            *     *             *    *             *     *    |   
       2x10    |-+         **    *             *     *            *     *            **    **            *     *  +-|   
               |          +*     **  +        ** +   *      +     *    +**        +  *      * +          *     *    |   
             0 +----------------------------------------------------------------------------------------------------+   
               0        50000      100000      150000     200000     250000     300000      350000     400000     450000

@K20shores K20shores merged commit 1fa5f6b into main Aug 27, 2024
4 checks passed
@K20shores K20shores deleted the provide_examples branch August 27, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants