From 47e1b56c10788c46fbc36d3ddc0f89755be1f9ae Mon Sep 17 00:00:00 2001 From: Krzysztof Rusek Date: Tue, 17 Oct 2023 02:08:25 +0200 Subject: [PATCH] Update commandline interface (#6) --- README.md | 4 ++-- src/gsd/__main__.py | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 942b92b..9b09186 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ $ hatch run test You can quickly estimate GSD parameters from a command line interface ```shell -python3 -m gsd 0 12 13 4 0 +python3 -m gsd -c 1 2 3 4 5 ``` - GSDParams(psi=Array(2.6272388, dtype=float32), rho=Array(0.9041536, dtype=float32)) \ No newline at end of file + psi=3.6667 rho=0.6000 \ No newline at end of file diff --git a/src/gsd/__main__.py b/src/gsd/__main__.py index e2c3ffe..8f24784 100644 --- a/src/gsd/__main__.py +++ b/src/gsd/__main__.py @@ -4,12 +4,8 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description='GSD estimator') - - parser.add_argument("response", nargs=5, type=int, - metavar=("num1", "num2", "num3", "num4", "num5"), - help="List of 5 counts") - + parser.add_argument("-c", nargs=5, type=int,help="List of 5 counts", required=True) args = parser.parse_args() - hat,_ = fit_mle(data=jnp.asarray(args.response, dtype=jnp.float32)) - print(hat) + hat,_ = fit_mle(data=jnp.asarray(args.o, dtype=jnp.float32)) + print(f'psi={hat.psi:.4f} rho={hat.rho:.4f}')