solprop.sol#
The session namespace: everything a person types at a prompt, behind one import.
For a terminal or a notebook, not for library code:
import solprop.sol as sol # or: from solprop.sol import *
sol.capillary_params(125e-6, "He", 1.0, energy=275e-6, fwhm=7.5e-15,
wavelength=800e-9)
run = sol.prop_capillary(125e-6, 1.0, "He", 1.0, wavelength=800e-9, ...)
sol.prop_2d(run)
sol.compress_taylor(run)
The one module whose import has side effects: start_session() (called on import,
idempotent) configures logging at INFO and silences
MaterialRangeWarning; end_session() undoes both,
material_warnings() turns the warning back on and set_log_level() changes
the level. The names are flat, a plot taking a plot_ prefix where it shares a name
with a processing function (energy measures, plot_energy draws), and numpy
and matplotlib.pyplot are deliberately not re-exported. The manual page, with the
table of names, is docs/guide/workflows/interactive.md.
- solprop.sol.start_session(level=20)[source]#
Configure logging and silence the material-range warnings.
What importing
solprop.soldoes. Calling it again changes nothing: one handler, one filter.- Parameters:
- levelint or str, optional
Level of the package’s log output.
- solprop.sol.end_session()[source]#
Undo
start_session(): remove the log handler and show the warnings.For a test, or a long-lived process that wants the library’s defaults back. The handler installed by
solprop.log.configure_logging()is removed and the package logger returns to inheriting its level.
- solprop.sol.set_log_level(level)[source]#
Set the level of the package’s log output for this session.
- Parameters:
- levelint or str
A
logginglevel or its name:"DEBUG"for the translation summaries,"WARNING"for a quiet session.
- solprop.sol.material_warnings(enabled)[source]#
Turn the material-range warnings on or off for this session.
Off installs one
"ignore"filter forMaterialRangeWarning; on removes exactly that entry, so whatever was in force before this module was imported is in force again – Python’s default, or a stricter filter of your own, which is never touched or shadowed. (An"ignore"filter of your own for the same category is the same entry, and goes with it.)- Parameters:
- enabledbool
Trueto see the warnings again;Falseto silence them, as importing this module does.
Examples
>>> import warnings >>> from solprop import sol >>> from solprop.exceptions import MaterialRangeWarning >>> with warnings.catch_warnings(): ... sol.material_warnings(False) ... warnings.warn("outside the fit", MaterialRangeWarning)