forked from IPKM/nmreval
set precision when saving data; fixes T253
This commit is contained in:
parent
34ebaf34bd
commit
0e62f01103
@ -648,19 +648,19 @@ class Points:
|
|||||||
|
|
||||||
header = []
|
header = []
|
||||||
for k, v in self.meta.items():
|
for k, v in self.meta.items():
|
||||||
header.append('%s: %s' % (k, str(v)))
|
header.append(f'{k}: {v}')
|
||||||
header = '\n'.join(header)
|
header = '\n'.join(header)
|
||||||
|
|
||||||
if np.all(self.mask):
|
if np.all(self.mask):
|
||||||
np.savetxt(path, self.toarray(err=err), header=header, fmt='%.10f')
|
np.savetxt(path, self.toarray(err=err), header=header, fmt='%.10e')
|
||||||
else:
|
else:
|
||||||
with path.open('w') as f:
|
with path.open('w') as f:
|
||||||
f.write(header)
|
f.write(header)
|
||||||
for i, l in enumerate(self.toarray(err=err)):
|
for i, l in enumerate(self.toarray(err=err)):
|
||||||
if self.mask[i]:
|
if self.mask[i]:
|
||||||
f.write('\t'.join(map(str, l.tolist())) + '\n')
|
f.write('\t'.join(map(lambda _x: f'{_x:.10e}', l.tolist())) + '\n')
|
||||||
else:
|
else:
|
||||||
f.write('#' + '\t'.join(map(str, l.tolist())) + '\n')
|
f.write('#' + '\t'.join(map(lambda _x: f'{_x:.10e}', l.tolist())) + '\n')
|
||||||
|
|
||||||
def get_state(self) -> dict:
|
def get_state(self) -> dict:
|
||||||
ret_dic = {'x': self._x.tolist(),
|
ret_dic = {'x': self._x.tolist(),
|
||||||
|
Loading…
Reference in New Issue
Block a user