1
0
forked from IPKM/nmreval

add sprinkles of number signs to text saves; closes #195

This commit is contained in:
Dominik Demuth 2023-12-30 18:34:44 +01:00
parent 57afee372f
commit a1ab8ad889

View File

@ -697,7 +697,8 @@ class Points:
np.savetxt(path, self.toarray(err=err), header=header, fmt='%.10e')
else:
with path.open('w') as f:
f.write(header)
f.write('# ' + '\n# '.join(header.split('\n')))
f.write('\n')
for i, l in enumerate(self.toarray(err=err)):
if self.mask[i]:
f.write('\t'.join(map(lambda _x: f'{_x:.10e}', l.tolist())) + '\n')
@ -705,9 +706,11 @@ class Points:
f.write('# ' + '\t'.join(map(lambda _x: f'{_x:.10e}', l.tolist())) + '\n')
def get_state(self) -> dict:
ret_dic = {'x': self._x.tolist(),
ret_dic = {
'x': self._x.tolist(),
'y': self._y.tolist(),
'mask': (np.where(~self.mask)[0]).tolist()}
'mask': (np.where(~self.mask)[0]).tolist()
}
if np.all(self._y_err == 0):
ret_dic['y_err'] = 0.0