Skip to main content

No project description provided

Project description

Parallel aBUS

PyPI - Version PyPI - Python Version

DOI


Table of Contents

Introduction

This code is a Python implementation of the parallelized adaptive Bayesian Updating with Structural reliabilty methods. The methods were described in:

Simon, P., Schneider, R., Baeßler, M., Morgenthal, G., 2024. Parallelized adaptive Bayesian Updating with Structural reliability methods for inference of large engineering models (submitted for publication).

It is based upon the original Python implementation of the original adaptive Bayesian Updating with Structural reliability methods with Subset Simulation (aBUS-SuS) by the Engineering Risk Analysis (ERA) Group of Technische Universität München.

Installation

The package is installable from the Python Package Index (PyPI) using pip:

pip install parallel-abus

Usage

Usage is exemplified in the corresponding GitHub project of this package.

Examples using this package are documented in the ./tests/ folder. The number of processes can be specified as a command line parameter, for example:

python ./tests/test_main_example_3_2DOF.py 5

runs inference with parallel aBUS on 5 processes.

A more comprehensive example is presented in ./example/bayesian_inference.py. Here, an engineering model of a reinforced concrete beam including an OpenSees finite element model is updated. Details on this example are found in this contribution:

Simon, P., Schneider, R., Baeßler, M., Morgenthal, G., 2024. A Bayesian probabilistic framework for building models for structural health monitoring of structures subject to environmental variability. (submitted for publication).

This example requires amongst others the python package for OpenSees.

An easy way to get this example running is to install its dependencies via Poetry:

poetry install

Logging

The parallel_abus library uses Python's standard logging module. By default, the library will not output any log messages unless you configure logging in your application.

Basic Usage

import logging
import parallel_abus

# Enable INFO level logging to see algorithm progress
logging.basicConfig(level=logging.INFO)

# Or use the library's configuration helper
parallel_abus.configure_logging(level=logging.INFO)

Controlling Library Logging

# Enable only WARNING and ERROR messages
parallel_abus.configure_logging(level=logging.WARNING)

# Disable all library logging
parallel_abus.disable_logging()

# Custom handler example
handler = logging.FileHandler('parallel_abus.log')
parallel_abus.configure_logging(level=logging.DEBUG, handler=handler)

Module-Specific Logging Levels

You can set different logging levels for different modules within the library. There are two approaches depending on your needs:

Using Helper Functions (Recommended for Simple Cases)

Use configure_module_logging() when you want the same handler(s) with different levels:

import logging
import parallel_abus

# Set DEBUG level for aBUS_SuS modules, WARNING level for aCS modules
parallel_abus.configure_module_logging({
    'aBUS_SuS': logging.DEBUG,
    'aCS': logging.WARNING
})

# You can also use full logger names for fine-grained control
parallel_abus.configure_module_logging({
    'parallel_abus.aBUS_SuS.aBUS_SuS': logging.DEBUG,
    'parallel_abus.aBUS_SuS.aCS_aBUS': logging.WARNING,
    'parallel_abus.aBUS_SuS.aCS_aBUS_parallel': logging.ERROR
})

Direct Logger Configuration (For Complex Cases)

Use direct configuration when you need different handlers per module:

import logging

# Example: aBUS messages to console + file, aCS messages only to file
file_handler = logging.FileHandler('inference.log')
console_handler = logging.StreamHandler()

formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter)
console_handler.setFormatter(formatter)

# Configure aBUS modules (INFO level) - console + file output
abus_logger = logging.getLogger('parallel_abus.aBUS_SuS.aBUS_SuS')
abus_logger.handlers.clear()
abus_logger.addHandler(console_handler)  # Show progress on console
abus_logger.addHandler(file_handler)     # Also save to file
abus_logger.setLevel(logging.INFO)
abus_logger.propagate = False

# Configure aCS modules (DEBUG level) - file output only
acs_logger = logging.getLogger('parallel_abus.aBUS_SuS.aCS_aBUS')
acs_logger.handlers.clear()
acs_logger.addHandler(file_handler)      # Only save to file
acs_logger.setLevel(logging.DEBUG)
acs_logger.propagate = False

Choosing the Right Approach

  • Use helper functions (configure_module_logging) when:

    • All modules use the same handler(s)
    • You only need different logging levels
    • You want convenient bulk configuration
  • Use direct configuration when:

    • Different modules need different handlers
    • You need granular control over handler behavior
    • You have complex logging requirements

Log Levels

  • DEBUG: Detailed algorithm state, parameter values, and intermediate results
  • INFO: Key algorithm progress messages (default for examples)
  • WARNING: Potential issues or numerical instabilities
  • ERROR: Error conditions and exceptions

License

parallel-abus is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parallel_abus-0.1.6.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parallel_abus-0.1.6-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file parallel_abus-0.1.6.tar.gz.

File metadata

  • Download URL: parallel_abus-0.1.6.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.8 Windows/11

File hashes

Hashes for parallel_abus-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1aa2f565c679c58c726ac39d60cf6f93f2e474baa5ebeb7f2c9f72d56b94ed93
MD5 b919fe430ed40887020b0e0b8aa08f6c
BLAKE2b-256 9e088382c656e765efd6af36c353176bab38a857142b1b9f86ab7c1a599a9fd7

See more details on using hashes here.

File details

Details for the file parallel_abus-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: parallel_abus-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.8 Windows/11

File hashes

Hashes for parallel_abus-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1db4345b533e2265f7a2b33a579d0bbcd4e31585bd608fd43106b82f46022ae1
MD5 98f88cb8e96545ca29e334818659203f
BLAKE2b-256 d879abcb97272139775b8d326acbf52fb08b0daaf3709a46e30eecb6a35074db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page