diff --git a/src/gui_qt/io/gracereader.py b/src/gui_qt/io/gracereader.py index f563239..26b15ff 100644 --- a/src/gui_qt/io/gracereader.py +++ b/src/gui_qt/io/gracereader.py @@ -1,3 +1,5 @@ +import numpy as np + from nmreval.lib.lines import LineStyle from nmreval.lib.symbols import SymbolStyle from nmreval.data.points import Points @@ -90,6 +92,7 @@ class QGraceReader(QtWidgets.QDialog, Ui_Dialog): label = self._reader.get_property(*key, 'legend').replace('"', '') # label = self._reader.graphs[key[0]].sets[key[1]]['legend'].replace('"', '') sd = s.data + sd = np.atleast_2d(sd) if s.type == 'xydy': data.append(Points(x=sd[:, 0], y=sd[:, 1], y_err=sd[:, 2], name=label)) else: diff --git a/src/nmreval/io/graceeditor.py b/src/nmreval/io/graceeditor.py index 61c27db..58a114e 100644 --- a/src/nmreval/io/graceeditor.py +++ b/src/nmreval/io/graceeditor.py @@ -1,5 +1,6 @@ from __future__ import annotations +import codecs import pathlib import re import warnings @@ -104,9 +105,8 @@ class GraceEditor: # we start always with the header current_pos = 'header' - with self.file.open('r') as f: + with self.file.open('r', errors='replace') as f: for line_nr, line in enumerate(f): - # lots of states to check # agr file order: header, drawing object, region, graph, set if current_pos == 'header':