Feature Request: Command line interface
arkottke opened this issue · 3 comments
It would be nice to be able to run the program from the command line for a list of files. This is the way that I have implemented by own HVSR calculation software. The following is an example of my command line interface:
usage: H/V Calculator [-h] [--version] [-a] [-c CONFIG] [-m {both,welch,sesame,raw_only}]
[-p {auto,manual}]
[inputs [inputs ...]]
Calculator for V/H ratios from mini-seed
positional arguments:
inputs Input file(s) to read
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-a, --all Compute all usable
-c CONFIG, --config CONFIG
Specify configuration
-m {both,welch,sesame,raw_only}, --method {both,welch,sesame,raw_only}
Method for computing H/V ratio
-p {auto,manual}, --peakselect {auto,manual}
Method for selecting the peak
A few things:
- I would also add an argument for the output directory, and then a sub-directory would be based on the input file name.
- In each output directory, standard plots and output files are created.
- A configuration file can be specified so that an analysis is repeated. The configuration is also saved to the output to document that calculation.
I think such an interface would help in bulk processing of recordings. Additionally, interactively selecting frequency ranges could be done using matplotlib GUI support.
I think this is a good idea and something that should be fairly straightforward to implement. Thanks for suggesting it!
My thinking on this is to:
- Create a new module called
cli.py
. - Create several functions in
cli.py
which perform similar functions to the example notebooks (e.g.,simple_hvsrpy_interface.ipynb
). - Use click or some other Python package to decorate these functions and handle the CLI details.
- Allow the CLI to be accessed as an entry_point to the
hvsrpy
package.
Update: A preliminary implementation of a command line interface has been added to the dev branch with commit 8505ff. My intent is make a release candidate for v1.0.0 which includes the CLI, among other changes, in the next week or two. In the meantime the CLI is functional, although not guaranteed to be 100% debugged. Feedback now (or after the RC comes out) is appreciated.