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 os
import sys
import warnings
import zipfile
from collections import defaultdict
@@ -227,7 +228,10 @@ def solve43(
continue
else:
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
@@ -238,7 +242,7 @@ def solve43(
store_next = False
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(
@@ -261,7 +265,7 @@ def integrate(
solve43(spec0, linear, nonlinear, length, atol, rtol, safety, targets=targets)
):
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)
for k, v in new_stat.items():
stats[k].append(v)