The BaseSetup class

class pyoma2.setup.base.BaseSetup[source]

Bases: object

Base class for operational modal analysis (OMA) setups.

This class provides foundational methods and attributes used by both SingleSetup and MultiSetup classes. It serves as a superclass for specific setup types, offering common functionalities for handling data, running algorithms, and extracting modal properties.

algorithms

Dictionary storing algorithms added to the setup, keyed by their names.

Type:

dict[str, BaseAlgorithm]

data

Time series data array, typically representing the system’s output.

Type:

np.ndarray, optional

fs

Sampling frequency of the data.

Type:

float, optional

Warning

The BaseSetup class is not intended for direct instantiation by users. It acts as a common interface for handling different types of setup configurations. Specific functionalities are provided through its subclasses.

add_algorithms(*algorithms: BaseAlgorithm) None[source]

Adds algorithms to the setup and configures them with data and sampling frequency.

Parameters:

algorithms (variable number of BaseAlgorithm) – One or more algorithm instances to be added to the setup.

Notes

The algorithms must be instantiated before adding them to the setup, and their names must be unique.

get(name: str, default: Optional[BaseAlgorithm] = None) Optional[BaseAlgorithm][source]

Retrieves an algorithm from the setup by its name, returning a default value if not found.

Parameters:
  • name (str) – The name of the algorithm to retrieve.

  • default (BaseAlgorithm, optional) – The default value to return if the specified algorithm is not found.

Returns:

The algorithm instance with the specified name or the default value if not found.

Return type:

BaseAlgorithm or None

mpe(name: str, *args, **kwargs) None[source]

Extracts modal parameters from selected poles/peaks of a specified algorithm.

Parameters:
  • name (str) – Name of the algorithm from which to extract modal parameters.

  • args (tuple) – Positional arguments to be passed to the algorithm’s mpe method.

  • kwargs (dict) – Keyword arguments to be passed to the algorithm’s mpe method.

Raises:

KeyError – If the specified algorithm name does not exist in the setup.

mpe_from_plot(name: str, *args, **kwargs) None[source]

Extracts modal parameters directly from plot selections of a specified algorithm.

Parameters:
  • name (str) – Name of the algorithm from which to extract modal parameters.

  • args (tuple) – Positional arguments to be passed to the algorithm’s mpe method.

  • kwargs (dict) – Keyword arguments to be passed to the algorithm’s mpe method.

Raises:

KeyError – If the specified algorithm name does not exist in the setup.

rollback() None[source]

Rollback the data to the initial state.

This method must be implemented by subclasses to provide a rollback mechanism for the data. Raises a NotImplementedError in the base class.

run_all() None[source]

Runs all the algorithms added to the setup.

Iterates through each algorithm stored in the setup and executes it. The results are saved within each algorithm instance.

Notes

This method assumes that all algorithms are properly initialized and can be executed without additional parameters.

run_by_name(name: str) None[source]

Runs a specific algorithm by its name.

Parameters:

name (str) – The name of the algorithm to be executed.

Raises:

KeyError – If the specified algorithm name does not exist in the setup.

Notes

The result of the algorithm execution is saved within the algorithm instance.