Commit 24e81d3e authored by Médéric Boquien's avatar Médéric Boquien

Simplify the computation of the speed by using string formats rather than rounding.

parent 0d544a08
...@@ -178,10 +178,9 @@ def sed(idx): ...@@ -178,10 +178,9 @@ def sed(idx):
n_computed = gbl_n_computed.value n_computed = gbl_n_computed.value
if n_computed % 250 == 0 or n_computed == gbl_params.size: if n_computed % 250 == 0 or n_computed == gbl_params.size:
t_elapsed = time.time() - gbl_t_begin t_elapsed = time.time() - gbl_t_begin
print("{}/{} models computed in {} seconds ({} models/s)". print("{}/{} models computed in {:.1f} seconds ({:.1f} models/s)".
format(n_computed, gbl_params.size, format(n_computed, gbl_params.size, t_elapsed,
np.around(t_elapsed, decimals=1), n_computed/t_elapsed),
np.around(n_computed/t_elapsed, decimals=1)),
end="\n" if n_computed == gbl_params.size else "\r") end="\n" if n_computed == gbl_params.size else "\r")
...@@ -326,7 +325,6 @@ def analysis(idx, obs): ...@@ -326,7 +325,6 @@ def analysis(idx, obs):
gbl_n_computed.value += 1 gbl_n_computed.value += 1
n_computed = gbl_n_computed.value n_computed = gbl_n_computed.value
t_elapsed = time.time() - gbl_t_begin t_elapsed = time.time() - gbl_t_begin
print("{}/{} objects analysed in {} seconds ({} objects/s)". print("{}/{} objects analysed in {:.1f} seconds ({:.2f} objects/s)".
format(n_computed, gbl_n_obs, np.around(t_elapsed, decimals=1), format(n_computed, gbl_n_obs, t_elapsed, n_computed/t_elapsed),
np.around(n_computed/t_elapsed, decimals=2)),
end="\n" if n_computed == gbl_n_obs else "\r") end="\n" if n_computed == gbl_n_obs else "\r")
...@@ -104,8 +104,7 @@ def fluxes(idx): ...@@ -104,8 +104,7 @@ def fluxes(idx):
n_computed = gbl_n_computed.value n_computed = gbl_n_computed.value
if n_computed % 250 == 0 or n_computed == gbl_params.size: if n_computed % 250 == 0 or n_computed == gbl_params.size:
t_elapsed = time.time() - gbl_t_begin t_elapsed = time.time() - gbl_t_begin
print("{}/{} models computed in {} seconds ({} models/s)". print("{}/{} models computed in {:.1f} seconds ({:.1f} models/s)".
format(n_computed, gbl_params.size, format(n_computed, gbl_params.size, t_elapsed,
np.around(t_elapsed, decimals=1), n_computed/t_elapsed),
np.around(n_computed/t_elapsed, decimals=1)),
end="\n" if n_computed == gbl_params.size else "\r") end="\n" if n_computed == gbl_params.size else "\r")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment