Settings#

Package settings#

spm1d.settings sets package-wide behavior including especially: warnings and progress bars. For example, all spm1d warnings can be enabled/disabled with:

spm1d.settings.enable_warnings( False )
class SPM1DSettings[source]#

Package settings (spm1d.settings).

timer_on#

True if procedure timing is printed (enable_timer).

warnings_on#

True if SPM1DUserWarning and SPM1DDeprecationWarning are shown (enable_warnings).

progress_on#

True if progress bars are shown (enable_progress).

spm12_on#

True if SPM12 rules replace spm1d rules (enable_spm12_compatibility).

enable_progress(b=True)[source]#

Toggle progress bars.

Parameters:

  • b — True (default) to enable, False to disable

Returns:

  • None

Example:
>>> import spm1d
>>> spm1d.settings.enable_progress( False )
enable_spm12_compatibility(b=True)[source]#

Reproduce SPM12 where spm1d departs from it (off by default).

Affects two calculations:

  • 0D two-sample t: residual-field degrees of freedom trRV**2/trRVRV instead of Welch’s degrees of freedom.

  • 1D covariance estimate: each node is scaled to unit residual variance before pooling.

Parameters:

  • b — True (default) to enable, False to disable

Returns:

  • None

Example:
>>> import spm1d
>>> spm1d.settings.enable_spm12_compatibility()
>>> spm1d.settings.enable_spm12_compatibility( False )
enable_timer(b=True)[source]#

Toggle procedure timing printouts.

Parameters:

  • b — True (default) to enable, False to disable

Returns:

  • None

Example:
>>> import spm1d
>>> spm1d.settings.enable_timer()
>>> spm1d.settings.enable_timer( False )
enable_warnings(b=True)[source]#

Toggle SPM1DUserWarning and SPM1DDeprecationWarning (errors are unaffected).

Parameters:

  • b — True (default) to enable, False to disable

Returns:

  • None

Example:
>>> import spm1d
>>> spm1d.settings.enable_warnings( False )
>>> spm1d.settings.enable_warnings()
reset_warnings()[source]#

Reset once-per-process warnings.

Returns:

  • None

Example:
>>> import spm1d
>>> spm1d.settings.reset_warnings()

System configuration for bug reports#

To facilitate bug reporting, spm1d.get_config() collects the versions of spm1d and its main dependencies that you are using.

get_config(packages=None)[source]#

Versions and platform for bug report submission.

Parameters:

  • packages — sequence of additional package names to report (default None)

Returns:

  • Config object.

Example:
>>> import spm1d
>>> print( spm1d.get_config() )
spm1d       0.5.0
rft1d       0.2.8
numpy       2.1.0
scipy       1.14.0
matplotlib  3.9.0
python      3.12.4 (CPython)
platform    macOS-15.1-arm64-arm-64bit
install     installed
class Config[source]#

Snapshot of dependency versions and platform.

names#

Reported package names in order.

packages#

Version string per package name ("not installed" if absent).

python#

Python version and implementation.

platform#

Operating system and machine.

install#

"installed" (site-packages) or "source" (checkout).

asdict()[source]#

Values as a dictionary.

Returns:

  • Dictionary with one entry per package plus python, platform and install

Example:
>>> import spm1d
>>> config = spm1d.get_config()
>>> print( sorted( config.asdict().keys() )[:4] )
['install', 'matplotlib', 'numpy', 'platform']
asstr()[source]#

Printed form with one aligned “name value” pair per line.

Returns:

  • String (same as print( config ))

Example:
>>> import spm1d
>>> config = spm1d.get_config()
>>> print( config.asstr().splitlines()[0].split()[0] )
spm1d