summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-05-23 15:13:47 +0200
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-05-23 15:13:47 +0200
commit0c09f3486fa4db0e2f4f5ee415b846107cceace6 (patch)
treed371de1583a2e16ab6fcdd17b66c0380da18dd72 /lib
parent30ae9c71614d0edb68a2d7616ab044bded2cd43d (diff)
Support CSV exports in UNIX dialect (without CRLF) via --export-csv-dialect
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/cli.py b/lib/cli.py
index 310314b..297944b 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -358,13 +358,13 @@ def export_dot(model, dot_prefix):
logger.info(f"Dot export of model saved to {filename}")
-def export_csv_unparam(model, csv_prefix):
+def export_csv_unparam(model, csv_prefix, dialect="excel"):
import csv
for name in sorted(model.names):
filename = f"{csv_prefix}{name}.csv"
with open(filename, "w") as f:
- writer = csv.writer(f)
+ writer = csv.writer(f, dialect=dialect)
writer.writerow(
["measurement"] + model.parameters + sorted(model.attributes(name))
)
@@ -479,6 +479,14 @@ def add_standard_arguments(parser):
help="Export raw (parameter-independent) observations in CSV format to {PREFIX}{name}-{attribute}.csv",
)
parser.add_argument(
+ "--export-csv-dialect",
+ metavar="DIALECT",
+ type=str,
+ choices=["excel", "excel-tab", "unix"],
+ default="excel",
+ help="CSV dialect to use for --export-csv-unparam",
+ )
+ parser.add_argument(
"--export-pgf-unparam",
metavar="PREFIX",
type=str,