diff options
Diffstat (limited to 'scripts/plotcsv.py')
-rwxr-xr-x | scripts/plotcsv.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/plotcsv.py b/scripts/plotcsv.py index fd6d084..1d26354 100755 --- a/scripts/plotcsv.py +++ b/scripts/plotcsv.py @@ -41,7 +41,10 @@ def plot(x, y, x_max, y_max, x_name, y_name, title, cubic, linear, xnew=None, f= def read_and_plot_csv(csv_file, cubic, linear, x_max=X_MAX, y_max=Y_MAX): print("Reading data...") - reader = csv.reader(open(csv_file, 'r'), delimiter=',') + cf = open(csv_file, 'r') + dialect = csv.Sniffer().sniff(cf.read(1024)) + cf.seek(0) + reader = csv.reader(cf, dialect) x_name,y_name = reader.next() # header line X = np.array([[float(_x), float(_y)] for _x,_y in reader ]) |