Skip to content

Commit

Permalink
updated readme and added error message for multi-column csv files
Browse files Browse the repository at this point in the history
  • Loading branch information
JayHuLBL committed Mar 27, 2024
1 parent db95e41 commit 77f6255
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,18 @@ Run funnel binary from terminal.
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
6 changes: 4 additions & 2 deletions pyfunnel/pyfunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -89,6 +89,8 @@
data[s] = dict(x=[], y=[])
with open(vars(args)[s]) as csvfile:
spamreader = csv.reader(csvfile)
if (len(next(spamreader) > 2)):
raise RuntimeError("The {} CSV file cannot have more than two columns.".format(s))
for row in spamreader:
try:
data[s]['x'].append(float(row[0]))
Expand Down

0 comments on commit 77f6255

Please sign in to comment.