forked from M-Labs/artiq
1
0
Fork 0

tools: add trim argument to format funcs

This commit is contained in:
Simon Renblad 2023-07-21 16:20:52 +08:00 committed by Sébastien Bourdeauducq
parent a384df17a4
commit 361088ae72
1 changed files with 2 additions and 0 deletions

View File

@ -72,6 +72,7 @@ def short_format(v, metadata={}):
v_t = np.divide(v, scale) v_t = np.divide(v, scale)
v_str = np.format_float_positional(v_t, v_str = np.format_float_positional(v_t,
precision=precision, precision=precision,
trim='-',
unique=True) unique=True)
v_str += " " + unit if unit else "" v_str += " " + unit if unit else ""
return v_str return v_str
@ -84,6 +85,7 @@ def short_format(v, metadata={}):
v_str = np.array2string(v_t, v_str = np.array2string(v_t,
max_line_width=1000, max_line_width=1000,
precision=precision, precision=precision,
trim='-',
suppress_small=True, suppress_small=True,
separator=', ', separator=', ',
threshold=4, threshold=4,