set precision when saving data; fixes T253
This commit is contained in:
parent
34ebaf34bd
commit
0e62f01103
@ -648,19 +648,19 @@ class Points:
|
||||
|
||||
header = []
|
||||
for k, v in self.meta.items():
|
||||
header.append('%s: %s' % (k, str(v)))
|
||||
header.append(f'{k}: {v}')
|
||||
header = '\n'.join(header)
|
||||
|
||||
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:
|
||||
with path.open('w') as f:
|
||||
f.write(header)
|
||||
for i, l in enumerate(self.toarray(err=err)):
|
||||
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:
|
||||
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:
|
||||
ret_dic = {'x': self._x.tolist(),
|
||||
|
Loading…
Reference in New Issue
Block a user