forked from IPKM/nmreval
ignore errors due to wrong encoding in agr files (#22)
Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de> Reviewed-on: IPKM/nmreval#22
This commit is contained in:
parent
28c15ff565
commit
8690cb222e
@ -1,3 +1,5 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
from nmreval.lib.lines import LineStyle
|
from nmreval.lib.lines import LineStyle
|
||||||
from nmreval.lib.symbols import SymbolStyle
|
from nmreval.lib.symbols import SymbolStyle
|
||||||
from nmreval.data.points import Points
|
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.get_property(*key, 'legend').replace('"', '')
|
||||||
# label = self._reader.graphs[key[0]].sets[key[1]]['legend'].replace('"', '')
|
# label = self._reader.graphs[key[0]].sets[key[1]]['legend'].replace('"', '')
|
||||||
sd = s.data
|
sd = s.data
|
||||||
|
sd = np.atleast_2d(sd)
|
||||||
if s.type == 'xydy':
|
if s.type == 'xydy':
|
||||||
data.append(Points(x=sd[:, 0], y=sd[:, 1], y_err=sd[:, 2], name=label))
|
data.append(Points(x=sd[:, 0], y=sd[:, 1], y_err=sd[:, 2], name=label))
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import codecs
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
@ -104,9 +105,8 @@ class GraceEditor:
|
|||||||
|
|
||||||
# we start always with the header
|
# we start always with the header
|
||||||
current_pos = '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):
|
for line_nr, line in enumerate(f):
|
||||||
|
|
||||||
# lots of states to check
|
# lots of states to check
|
||||||
# agr file order: header, drawing object, region, graph, set
|
# agr file order: header, drawing object, region, graph, set
|
||||||
if current_pos == 'header':
|
if current_pos == 'header':
|
||||||
|
Loading…
Reference in New Issue
Block a user