ignore errors due to wrong encoding in agr files (#22)

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #22
This commit is contained in:
Dominik Demuth 2023-03-16 18:49:44 +00:00
parent 28c15ff565
commit 8690cb222e
2 changed files with 5 additions and 2 deletions

View File

@ -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:

View File

@ -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':