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

Specified two-column csv file #78

Merged
merged 10 commits into from
Apr 16, 2024
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,23 @@ The module `pyfunnel.py` can also be run with the following command line interfa
```
usage: pyfunnel.py [-h] --reference REFERENCE --test TEST [--output OUTPUT] [--atolx ATOLX] [--atoly ATOLY] [--ltolx LTOLX] [--ltoly LTOLY] [--rtolx RTOLX] [--rtoly RTOLY]

Run funnel binary from terminal.
Run funnel binary from terminal on two two-column CSV files.

Output `errors.csv`, `lowerBound.csv`, `upperBound.csv`, `reference.csv`, `test.csv` into the output directory (`./results` by default).

optional arguments:
-h, --help show this help message and exit
--output OUTPUT Path of directory to store output data
--atolx ATOLX Absolute tolerance along x axis
--atoly ATOLY Absolute tolerance along y axis
--ltolx LTOLX Relative tolerance along x axis (relatively to the local value)
--ltoly LTOLY Relative tolerance along y axis (relatively to the local value)
--rtolx RTOLX Relative tolerance along x axis (relatively to the range)
--rtoly RTOLY Relative tolerance along y axis (relatively to the range)
-h, --help show this help message and exit
--output OUTPUT Path of directory to store output data
--atolx ATOLX Absolute tolerance along x axis
--atoly ATOLY Absolute tolerance along y axis
--ltolx LTOLX Relative tolerance along x axis (relatively to the local value)
--ltoly LTOLY Relative tolerance along y axis (relatively to the local value)
--rtolx RTOLX Relative tolerance along x axis (relatively to the range)
--rtoly RTOLY Relative tolerance along y axis (relatively to the range)

required named arguments:
--reference REFERENCE
Path of CSV file with reference data
--test TEST Path of CSV file with test data
--reference REFERENCE Path of two-column CSV file with reference data
--test TEST Path of two-column CSV file with test data

Full documentation at https://github.com/lbl-srg/funnel
```
Expand Down
Binary file modified pyfunnel/lib/darwin64/libfunnel.dylib
Binary file not shown.
Binary file modified pyfunnel/lib/linux64/libfunnel.so
Binary file not shown.
8 changes: 5 additions & 3 deletions pyfunnel/pyfunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=(
'Run funnel binary from terminal.\n\n'
'Run funnel binary from terminal on two two-column CSV files.\n\n'
'Output `errors.csv`, `lowerBound.csv`, `upperBound.csv`, `reference.csv`, `test.csv` '
'into the output directory (`./results` by default).'),
epilog='Full documentation at https://github.com/lbl-srg/funnel'
Expand All @@ -31,12 +31,12 @@

required_named.add_argument(
"--reference",
help="Path of CSV file with reference data",
help="Path of two-column CSV file with reference data",
required=True
)
required_named.add_argument(
"--test",
help="Path of CSV file with test data",
help="Path of two-column CSV file with test data",
required=True
)
parser.add_argument(
Expand Down Expand Up @@ -90,6 +90,8 @@
with open(vars(args)[s]) as csvfile:
spamreader = csv.reader(csvfile)
for row in spamreader:
if len(row) != 2:
raise IOError("The {} CSV file must have exactly two columns.".format(s))
try:
data[s]['x'].append(float(row[0]))
data[s]['y'].append(float(row[1]))
Expand Down