Skip to content

Commit

Permalink
Fix printing
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed Oct 9, 2024
1 parent a366edc commit aa039a8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions emg3d/inversion/pygimli.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ def _post_step(n, inv):
phi = inv.inv.getPhi()
if n == 0:
pygimli.info(
f"{71*'='}\n{39*' '}"
" it χ² F(m) λ ϕᵈ ϕᵐ"
f" ϕ=ϕᵈ+λϕᵐ Δϕ (%)\n{39*' '}{71*'-'}"
f"{75*'='}\n{39*' '}"
" it F(m) χ² λ ϕᵈ ϕᵐ"
f" ϕ=ϕᵈ+λϕᵐ Δϕ (%)\n{39*' '}{75*'-'}"
)
deltaphi = 0
sim.invinfo = {}
Expand All @@ -354,10 +354,13 @@ def _post_step(n, inv):
deltaphi = (1-phi/inv.lastphi)*100
inv.lastphi = phi
pygimli.info(
f"{n:3d}{_round_format(inv.inv.chi2())}"
f"{_multiprocessing.process_map.count:7d}{inv.inv.getLambda():8.3}"
f" {_round_format(inv.inv.getPhiD())}"
f" {_round_format(inv.inv.getPhiM())} {_round_format(phi)}"
f"{n:3d}"
f"{_multiprocessing.process_map.count:7d} "
f"{_round_format(inv.inv.chi2())} "
f"{_round_format(inv.inv.getLambda())} "
f"{_round_format(inv.inv.getPhiD())} "
f"{_round_format(inv.inv.getPhiM())} "
f"{_round_format(phi)}"
f"{deltaphi:9.2f}"
)

Expand Down Expand Up @@ -389,6 +392,6 @@ def _post_step(n, inv):
_multiprocessing.process_map.count = 0


def _round_format(x, ndigit=1, threshold=1e6, lower='10.1f', upper='10.3'):
def _round_format(x, ndigit=1, threshold=1e6, lower='10.1f', upper='10.3e'):
"""Rounding numbers for info display."""
return f"{np.round(x, ndigit):{lower if x < threshold else upper}}"

0 comments on commit aa039a8

Please sign in to comment.