print progress to stderr by default

This commit is contained in:
Benoît Sierro
2023-07-26 15:00:32 +02:00
parent e0e262c6f2
commit 7edadb45d9

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import json import json
import os import os
import sys
import warnings import warnings
import zipfile import zipfile
from collections import defaultdict from collections import defaultdict
@@ -227,7 +228,10 @@ def solve43(
continue continue
else: else:
rejected.append((h, error)) rejected.append((h, error))
print(f"{z = :.3f} rejected step {step_ind} with {h = :.2g}, {error = :.2g}") print(
f"{z = :.3f} rejected step {step_ind} with {h = :.2g}, {error = :.2g}",
file=sys.stderr,
)
h = h * next_h_factor h = h * next_h_factor
@@ -238,7 +242,7 @@ def solve43(
store_next = False store_next = False
if msg.ready(): if msg.ready():
print(f"step {step_ind}, {z = :.3f}, {error = :g}, {h = :.3g}") print(f"step {step_ind}, {z = :.3f}, {error = :g}, {h = :.3g}", file=sys.stderr)
def integrate( def integrate(
@@ -261,7 +265,7 @@ def integrate(
solve43(spec0, linear, nonlinear, length, atol, rtol, safety, targets=targets) solve43(spec0, linear, nonlinear, length, atol, rtol, safety, targets=targets)
): ):
if msg.ready(): if msg.ready():
print(f"step {i}, z = {new_stat['z']*100:.2f}cm") print(f"step {i}, z = {new_stat['z']*100:.2f}cm", file=sys.stderr)
all_spectra.append(spec) all_spectra.append(spec)
for k, v in new_stat.items(): for k, v in new_stat.items():
stats[k].append(v) stats[k].append(v)