### Install Documentation Dependencies Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Install the necessary dependencies for building the project's documentation. ```shell uv sync --group docs ``` -------------------------------- ### Install PDM on Windows Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs PDM on Windows by downloading and executing the installation script. ```powershell (Invoke-WebRequest -Uri https://pdm-project.org/install-pdm.py -UseBasicParsing).Content | python - ``` -------------------------------- ### Save and Load Analysis Setup Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example2.ipynb Persist the current analysis setup to a file using `save_to_file` and load it back later with `load_from_file`. This is useful for resuming analyses or sharing setups. Ensure the necessary imports are present. ```python import os import sys import pathlib # Add the directory we executed the script from to path: sys.path.insert(0, os.path.realpath('__file__')) from pyoma2.functions.gen import save_to_file, load_from_file # Save setup save_to_file(Pali_ss, pathlib.Path(r"./test.pkl")) # Load setup pali2: SingleSetup = load_from_file(pathlib.Path(r"./test.pkl")) # plot from loded instance _, _ = pali2.plot_mode_geo2_mpl( algo_res=fsdd.result, mode_nr=1, view="3D", scaleF=2) ``` -------------------------------- ### Load and Prepare Single Setups Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example3 - Multisetup PoSER.md Load sample data for each setup, create SingleSetup instances, and apply detrending and decimation. Ensure data is loaded correctly and preprocessed for analysis. ```python # import data files set1 = np.load(get_sample_data(filename="set1.npy", folder="3SL"), allow_pickle=True) set2 = np.load(get_sample_data(filename="set2.npy", folder="3SL"), allow_pickle=True) set3 = np.load(get_sample_data(filename="set3.npy", folder="3SL"), allow_pickle=True) # create single setup ss1 = SingleSetup(set1, fs=100) ss2 = SingleSetup(set2, fs=100) ss3 = SingleSetup(set3, fs=100) # Detrend and decimate ss1.decimate_data(q=2) ss2.decimate_data(q=2) ss3.decimate_data(q=2) ``` -------------------------------- ### Add Algorithms to Setup Instance Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Add multiple algorithms (FSDD, SSIcov, IOcov) to a setup instance. Use the 'algorithms' attribute to verify which algorithms have been added. ```python # Add algorithms to the class simp_5dof.add_algorithms(fsdd, ssicov, iocov) # to check which algorithms have been added, we can call the algorithms attribute simp_5dof.algorithms ``` -------------------------------- ### Save and Load Analysis Setup (Python) Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example2 - Real dataset.md Demonstrates saving the current analysis setup to a pickled file and then loading it back into a new instance. Includes necessary imports and file path handling. ```python import os import sys import pathlib # Add the directory we executed the script from to path: sys.path.insert(0, os.path.realpath('__file__')) from pyoma2.functions.gen import save_to_file, load_from_file # Save setup save_to_file(Pali_ss, pathlib.Path(r"./test.pkl")) # Load setup pali2: SingleSetup = load_from_file(pathlib.Path(r"./test.pkl")) # plot from loded instance _, _ = pali2.plot_mode_geo2_mpl( algo_res=fsdd.result, mode_nr=1, view="3D", scaleF=2) ``` -------------------------------- ### Install pyOMA-2 with pip Source: https://github.com/dagghe/pyoma2/blob/main/docs/Installation.md Use this command to install the library via pip. ```console pip install pyOMA-2 ``` -------------------------------- ### Add and View Algorithms in Setup Instance Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Adds instantiated algorithms to the SingleSetup instance and shows how to access the list of added algorithms. ```python # Add algorithms to the class simp_5dof.add_algorithms(fsdd, ssicov) # to check which algorithms have been added, we can call the algorithms attribute simp_5dof.algorithms ``` -------------------------------- ### Import and Initialize PyOMA2 with Example Data Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Imports necessary pyOMA2 modules and generates example data. Initializes the SingleSetup class with the data and sampling frequency. ```python import os import sys import numpy as np # Add the directory we execute the script from to path: sys.path.insert(0, os.path.realpath('__file__')) # import the necessary functions and classes from pyoma2.functions.gen import example_data from pyoma2.setup.single import SingleSetup from pyoma2.algorithms.data.run_params import EFDDRunParams, SSIRunParams from pyoma2.algorithms.fdd import FSDD from pyoma2.algorithms.ssi import SSI from pyoma2.functions.plot import plot_mac_matrix, plot_mode_complexity from pyoma2.functions.gen import save_to_file, load_from_file # generate example data and results data, ground_truth = example_data() # Create an instance of the setup class simp_5dof = SingleSetup(data, fs=100) ``` -------------------------------- ### Import Necessary Modules Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Imports essential libraries for data manipulation, SSI algorithms, and setup classes. Ensure these modules are installed. ```python import numpy as np from pyoma2.algorithms import SSI from pyoma2.setup import MultiSetup_PoSER, SingleSetup from pyoma2.support.utils.sample_data import get_sample_data ``` -------------------------------- ### Load Sample Data and Initialize Setup Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example5 - Clustering.md Imports necessary libraries and loads sample data. Initializes the SingleSetup class with the data and sampling frequency, then decimates the data. ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt from pyoma2.algorithms.ssi import SSI from pyoma2.algorithms.data.run_params import SSIRunParams, Clustering, Step1, Step2, Step3 from pyoma2.setup.single import SingleSetup from pyoma2.support.geometry import GeometryMixin from pyoma2.support.utils.sample_data import get_sample_data # import data files data = np.load(get_sample_data(filename="set1.npy", folder="3SL"), allow_pickle=True) # Create setup instance clust_test = SingleSetup(data, fs=100) # decimate signal clust_test.decimate_data(q=2) ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs pre-commit and pre-push hooks for the project using PDM. ```shell pdm run pre-commit install --hook-type pre-commit --hook-type pre-push ``` -------------------------------- ### Install QA Dependencies with uv Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Install all project dependencies, including those for quality assurance, using the uv package manager. ```shell uv sync --group qa ``` -------------------------------- ### Load Sample Data and Initialize Setup Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example5.ipynb Imports necessary libraries and loads sample data for analysis. Initializes the SingleSetup class with the loaded data and sampling frequency. ```python import numpy as np from pyoma2.algorithms.ssi import SSI from pyoma2.algorithms.data.run_params import SSIRunParams, Clustering, Step1, Step2, Step3 from pyoma2.setup.single import SingleSetup from pyoma2.support.utils.sample_data import get_sample_data # import data files data = np.load(get_sample_data(filename="set3.npy", folder="3SL"), allow_pickle=True) # Create setup instance clust_test = SingleSetup(data, fs=100) ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Install pre-commit and pre-push hooks to automate checks before committing and pushing code. ```shell uv run pre-commit install --hook-type pre-commit --hook-type pre-push ``` -------------------------------- ### Install pyOMA-2 with conda/mamba Source: https://github.com/dagghe/pyoma2/blob/main/docs/Installation.md Use this command to install the library via conda or mamba. ```console conda install pyOMA-2 ``` -------------------------------- ### Load Example Data and Ground Truth Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example1 - Getting started.md Imports necessary libraries and loads example acceleration time histories and ground truth modal parameters. Ensure the script's directory is in the Python path. ```python import os import sys import numpy as np # Add the directory we execute the script from to path: sys.path.insert(0, os.path.realpath('__file__')) # import the function to generate the example dataset from pyoma2.functions.gen import example_data # generate example data and results data, ground_truth = example_data() # Print the exact results np.set_printoptions(precision=3) print(f"the natural frequencies are: {ground_truth[0]} \n") print(f"the damping is: {ground_truth[2]} \n") print("the (column-wise) mode shape matrix: \n" f"{ground_truth[1]} \n") ``` -------------------------------- ### Install VTK and Dependencies for Python 3.8 on macOS Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Manually installs the VTK package due to compatibility issues, then installs project dependencies using PDM for Python 3.8 on macOS. ```shell pip install https://files.pythonhosted.org/packages/b3/15/40f8264f1b5379f12caf0e5153006a61c1f808937877c996e907610e8f23/vtk-9.3.1-cp38-cp38-macosx_10_10_x86_64.whl pdm install --lockfile=pdm-py38macos.lock ``` -------------------------------- ### Initialize and Run SSI Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Initializes SSI algorithms for each setup with specified parameters (method, br, ordmax, step). Runs the algorithms and generates stabilization plots for each setup. Ensure the frequency limits for plotting are appropriate for your data. ```python # Initialise the algorithms for setup 1 ssicov1 = SSI(name="SSIcov_s1", method="cov", br=45, ordmax=80, step=2) # Add algorithms to the class ss1.add_algorithms(ssicov1) ss1.run_all() # Initialise the algorithms for setup 2 ssicov2 = SSI(name="SSIcov_s2", method="cov", br=30, ordmax=80, step=2) ss2.add_algorithms(ssicov2) ss2.run_all() # Initialise the algorithms for setup 3 ssicov3 = SSI(name="SSIcov_s3", method="cov", br=30, ordmax=80, step=2) ss3.add_algorithms(ssicov3) ss3.run_all() # Plot stabilisation chart _, _ = ssicov1.plot_stab(freqlim=(1,20)) _, _ = ssicov2.plot_stab(freqlim=(1,20)) _, _ = ssicov3.plot_stab(freqlim=(1,20)) ``` -------------------------------- ### Run All Added Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Executes all algorithms that have been added to the setup instance using the `run_all()` method. Alternatively, algorithms can be run by their names. ```python # run all simp_5dof.run_all() # or run by name ``` -------------------------------- ### Install PDM on Linux/MAC Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs PDM, a Python dependency manager, using a curl command. ```shell curl -sSL https://pdm-project.org/install-pdm.py | python3 - ``` -------------------------------- ### Install Dependencies for Python 3.9+ on Windows Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs project dependencies using PDM with a specific lock file for Python 3.9 and above on Windows. ```shell pdm install --lockfile=pdm-py39+win.lock ``` -------------------------------- ### Instantiate and Merge MultiSetup_PoSER Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Creates a MultiSetup_PoSER object by passing reference indices and a list of single setup objects. The merge_results() method is then called to combine the results from individual setups. ```python # reference indices ref_ind = [[0, 1, 2], [0, 1, 2], [0, 1, 2]] # Creating Multi setup msp = MultiSetup_PoSER(ref_ind=ref_ind, single_setups=[ss1, ss2, ss3], names=["SSIcov"]) # Merging results from single setups result = msp.merge_results() # dictionary of merged results res_ssicov = dict(result["SSIcov"]) result["SSIcov"].Fn ``` -------------------------------- ### Initialize and Configure Modal Identification Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example2 - Real dataset.md Initializes FSDD, SSIcov, and pLSCF algorithms with specified parameters and optionally overwrites run parameters. Algorithms are then added to the setup. ```python # Initialise the algorithms fsdd = FSDD(name="FSDD", nxseg=1024, method_SD="cor") ssicov = SSIcov(name="SSIcov", br=30, ordmax=30, calc_unc=True) plscf = pLSCF(name="polymax",ordmax=30) # Overwrite/update run parameters for an algorithm fsdd.run_params = FSDD.RunParamCls(nxseg=2048, method_SD="per", pov=0.5) # Add algorithms to the single setup class Pali_ss.add_algorithms(ssicov, fsdd, plscf) ``` -------------------------------- ### Run Modal Identification on Each Setup Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example3 - Multisetup PoSER.md Initialize and run the SSIcov algorithm for each single setup. This step identifies modal properties for each dataset independently. Plotting the stabilization chart helps in selecting appropriate modal orders. ```python # Initialise the algorithms for setup 1 ssicov1 = SSIcov(name="SSIcov_s1", method="cov", br=50, ordmax=80) # Add algorithms to the class ss1.add_algorithms(ssicov1) ss1.run_all() # Initialise the algorithms for setup 2 ssicov2 = SSIcov(name="SSIcov_s2", method="cov", br=50, ordmax=80) ss2.add_algorithms(ssicov2) ss2.run_all() # Initialise the algorithms for setup 3 ssicov3 = SSIcov(name="SSIcov_s3", method="cov", br=50, ordmax=80) ss3.add_algorithms(ssicov3) ss3.run_all() # Plot stabilisation chart _, _ = ssicov1.plot_stab(freqlim=(1,20)) _, _ = ssicov2.plot_stab(freqlim=(1,20)) _, _ = ssicov3.plot_stab(freqlim=(1,20)) # Extract results ss1.mpe( "SSIcov_s1", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=50) ss2.mpe( "SSIcov_s2", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=40) ss3.mpe( "SSIcov_s3", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=40) ``` -------------------------------- ### Generate Example Data and Ground Truth Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example1.ipynb Imports the `example_data` function to generate acceleration time histories, input excitation, and true modal parameters for a 5-story shear-type building. Use this to obtain sample data for analysis. ```python import os import sys import numpy as np # Add the directory we execute the script from to path: sys.path.insert(0, os.path.realpath('__file__')) # import the function to generate the example dataset from pyoma2.functions.gen import example_data # generate example data and results data, U, ground_truth = example_data() # Print the exact results np.set_printoptions(precision=3) print(f"the natural frequencies are: {ground_truth[0]} ") print(f"the damping is: {ground_truth[1]} ") print("the (column-wise) mode shape matrix: " f"{ground_truth[2]} ") ``` -------------------------------- ### Install Dependencies for Python 3.8 on Windows Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs project dependencies using PDM with a specific lock file for Python 3.8 on Windows. ```shell pdm install --lockfile=pdm-py38win.lock ``` -------------------------------- ### Install Dependencies for Python 3.9+ on Linux Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs project dependencies using PDM with a specific lock file for Python 3.9 and above on Linux. ```shell pdm install --lockfile=pdm-py39+unix.lock ``` -------------------------------- ### Import Necessary Modules and Load Data Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example2.ipynb Imports essential libraries and loads the sample dataset for single setup analysis. Ensure the dataset file is accessible. ```python import numpy as np from pyoma2.algorithms import FSDD, SSI, pLSCF from pyoma2.setup import SingleSetup from pyoma2.support.utils.sample_data import get_sample_data # load example dataset for single setup data = np.load(get_sample_data(filename="Palisaden_dataset.npy", folder="palisaden"), allow_pickle=True) ``` -------------------------------- ### Merge Results using MultiSetup_PoSER Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example3 - Multisetup PoSER.md Instantiate the MultiSetup_PoSER class with processed single setups and reference indices. Use merge_results() to combine modal properties from all setups. ```python # reference indices ref_ind = [[0, 1, 2], [0, 1, 2], [0, 1, 2]] # Creating Multi setup msp = MultiSetup_PoSER(ref_ind=ref_ind, single_setups=[ss1, ss2, ss3], names=["SSIcov"]) # Merging results from single setups result = msp.merge_results() # dictionary of merged results res_ssicov = dict(result[SSIcov.__name__]) result["SSIcov"].Fn >>> array([ 2.63245926, 2.69030811, 3.4256547 , 8.29328508, 8.42526299, 10.60096486, 13.99307818, 14.09286017, 17.46931459]) ``` -------------------------------- ### Install Dependencies for Python 3.9+ on macOS Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs project dependencies using PDM with a specific lock file for Python 3.9 and above on macOS. ```shell pdm install --lockfile=pdm-py39+macos.lock ``` -------------------------------- ### Install Dependencies for Python 3.8 on Linux Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Installs project dependencies using PDM with a specific lock file for Python 3.8 on Linux. ```shell pdm install --lockfile=pdm-py38unix.lock ``` -------------------------------- ### Add Clustering Algorithms and Run Analysis Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example5.ipynb Adds the defined clustering algorithms to the SSI instance and then adds the SSI instance to the setup. Finally, it runs the SSI analysis and initiates the clustering process. ```python # Add clustering algorithms to AutoSSI class instance autossi.add_clustering(clus1,clus2,clus3,clus4,clus5,clus6,clus7) # add AutoSSI instance to SingleSetup instance clust_test.add_algorithms(autossi) # Run algorithm clust_test.run_by_name("autossi") # clust_test.run_all() # Run clustering either one by one or altogether ``` -------------------------------- ### Extract Modal Parameters from Multiple Setups Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Extracts modal parameters using the mpe method for multiple SSI setups. Ensure that the ss1, ss2, and ss3 objects are properly initialized before calling this method. ```python ss1.mpe( "SSIcov_s1", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=50) ss2.mpe( "SSIcov_s2", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=50) ss3.mpe( "SSIcov_s3", sel_freq=[2.63, 2.69, 3.43, 8.29, 8.42, 10.62, 14.00, 14.09, 17.57], order_in=50) ``` -------------------------------- ### Import PyOMA2 and Generate Example Data Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Imports necessary PyOMA2 modules and generates sample data for analysis. Ensure the script's directory is added to the Python path. ```python import os import sys # Add the directory we execute the script from to path: sys.path.insert(0, os.path.realpath('__file__')) # import the necessary functions and classes from pyoma2.functions.gen import example_data from pyoma2.setup.single import SingleSetup from pyoma2.algorithms.data.run_params import EFDDRunParams, SSIRunParams from pyoma2.algorithms.fdd import FSDD from pyoma2.algorithms.ssi import SSI from pyoma2.functions.plot import plot_mac_matrix, plot_mode_complexity from pyoma2.functions.gen import save_to_file, load_from_file # generate example data and results data, U, ground_truth = example_data() # Create an instance of the setup class simp_5dof = SingleSetup(data, fs=100) ``` -------------------------------- ### Run Specific Analyses Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example2.ipynb Execute specific system identification analyses by name. Ensure the necessary setup object (Pali_ss) is initialized. ```python Pali_ss.run_by_name("SSIcov") Pali_ss.run_by_name("FSDD") Pali_ss.run_by_name("polymax") ``` -------------------------------- ### Import Necessary Modules Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example4.ipynb Imports essential libraries for data manipulation, SSI, FDD, and multisetup procedures. Ensure these modules are installed. ```python import numpy as np from pyoma2.algorithms import SSI_MS, FDD_MS from pyoma2.setup import MultiSetup_PreGER from pyoma2.support.utils.sample_data import get_sample_data ``` -------------------------------- ### Decimate Data in PyOMA2 Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Applies data decimation to the setup instance. Use the 'q' argument to specify the decimation factor. ```python # Decimate the data simp_5dof.decimate_data(q=2) ``` -------------------------------- ### Run pyOMA2 Jupyter Notebook in Docker Source: https://github.com/dagghe/pyoma2/blob/main/README.md Start the pyOMA2 Docker container and launch the Jupyter Notebook server. Access it via http://localhost:8888. ```shell docker compose up jupyter ``` -------------------------------- ### Import Necessary Modules Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example4 - Multisetup PreGER.md Imports essential libraries for data manipulation, plotting, and pyOMA2 functionalities. Ensure these are installed before running. ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt from pyoma2.algorithms import SSIdat_MS from pyoma2.setup import MultiSetup_PreGER from pyoma2.support.utils.sample_data import get_sample_data ``` -------------------------------- ### Enable X11 forwarding for GUI on macOS Source: https://github.com/dagghe/pyoma2/blob/main/README.md Configure X11 forwarding for GUI applications on macOS. Requires XQuartz to be installed. This allows interactive plots and 3D visualizations from the Docker container. ```shell # Install XQuartz first: brew install --cask xquartz xhost +localhost docker compose up pyoma2 ``` -------------------------------- ### Run pyOMA2 Python shell in Docker Source: https://github.com/dagghe/pyoma2/blob/main/README.md Start the pyOMA2 Docker container and launch an interactive Python shell. This allows direct interaction with the pyOMA2 environment. ```shell docker compose up pyoma2 ``` -------------------------------- ### Initialize and Add Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example1 - Getting started.md Initializes the FDD and SSIdat algorithms with their respective parameters and adds them to the SingleSetup instance. ```python from pyoma2.algorithms.fdd import FDD from pyoma2.algorithms.ssi import SSIdat # Initialise the algorithms fdd = FDD(name="FDD", nxseg=1024, method_SD="cor") ssidat = SSIdat(name="SSIdat", br=30, ordmax=30) # Add algorithms to the class simp_5dof.add_algorithms(fdd, ssidat) ``` -------------------------------- ### Initialize and Add Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example1.ipynb Instantiates the Frequency Domain Decomposition (FDD) and Stochastic Subspace Identification (SSI) algorithms with specific parameters and adds them to the `SingleSetup` instance. This prepares the analysis pipeline. ```python from pyoma2.algorithms.fdd import FDD from pyoma2.algorithms.ssi import SSI # Initialise the algorithms fdd = FDD(name="FDD", nxseg=2**11, method_SD="per") ssidat = SSI(name="SSIdat", method="dat", br=30, ordmax=50, step=2) # Add algorithms to the class simp_5dof.add_algorithms(fdd, ssidat) # run simp_5dof.run_all() ``` -------------------------------- ### Initialize and Run Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example4 - Multisetup PreGER.md Initializes the SSIdat_MS algorithm and adds it to the MultiSetup_PreGER instance. Runs all configured algorithms and plots the stability diagram. ```python # Initialise the algorithms ssidat = SSIdat_MS(name="SSIdat", br=80, ordmax=80) # Add algorithms to the class msp.add_algorithms(ssidat) msp.run_all() # Plot _, _ = ssidat.plot_stab(freqlim=(2,18)) ``` -------------------------------- ### Instantiate and Run Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example4.ipynb Initializes multi-setup versions of SSIcov and FDD algorithms, adds them to the MultiSetup_PreGER instance, and runs the analysis. Plots stability and CMIF are generated after execution. ```python # Initialise the algorithms ssicov = SSI_MS(name="SSIcov", method="cov", br=80, ordmax=100, step=2) fdd = FDD_MS(name="FDD", nxseg=2**11) # Add algorithms to the class msp.add_algorithms(ssicov) msp.add_algorithms(fdd) msp.run_all() # Plot _, _ = ssicov.plot_stab(freqlim=(2,18), hide_poles=False) _, _ = fdd.plot_CMIF(freqlim=(2,18)) ``` -------------------------------- ### Load Data and Create SingleSetup Instances Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Loads sample data files and initializes a SingleSetup object for each dataset. The sampling frequency (fs) is set to 100 Hz. Uncomment the decimate_data lines to apply decimation. ```python # import data files set1 = np.load(get_sample_data(filename="set1.npy", folder="3SL"), allow_pickle=True) set2 = np.load(get_sample_data(filename="set2.npy", folder="3SL"), allow_pickle=True) set3 = np.load(get_sample_data(filename="set3.npy", folder="3SL"), allow_pickle=True) # create single setup ss1 = SingleSetup(set1, fs=100) ss2 = SingleSetup(set2, fs=100) ss3 = SingleSetup(set3, fs=100) # Detrend and decimate #ss1.decimate_data(q=2) #ss2.decimate_data(q=2) #ss3.decimate_data(q=2) ``` -------------------------------- ### Initialize and Configure Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example2.ipynb Initializes instances of FSDD, SSI, and pLSCF algorithms with specific parameters. Allows for overwriting default run parameters for algorithms. ```python # Initialise the algorithms fsdd = FSDD(name="FSDD", nxseg=1024, method_SD="cor") ssicov = SSI(name="SSIcov", method="cov", br=30, ordmax=50, calc_unc=True, step=2) plscf = pLSCF(name="polymax", ordmax=30) # Overwrite/update run parameters for an algorithm fsdd.run_params = FSDD.RunParamCls(nxseg=2048, method_SD="per", pov=0.5) # Add algorithms to the single setup class Pali_ss.add_algorithms(ssicov, fsdd, plscf) ``` -------------------------------- ### Instantiate SingleSetup Class Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example1 - Getting started.md Initializes the SingleSetup class with the loaded data and sampling frequency. ```python from pyoma2.setup.single import SingleSetup simp_5dof = SingleSetup(data, fs=600) ``` -------------------------------- ### Instantiate SingleSetup Class Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example1.ipynb Initializes the `SingleSetup` class with the generated data and sampling frequency. This class serves as the main interface for setting up and running analyses. ```python from pyoma2.setup.single import SingleSetup simp_5dof = SingleSetup(data, fs=100) ``` -------------------------------- ### Build Documentation Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Build the HTML documentation for the project using Sphinx. Navigate to the docs directory first. ```shell cd docs make html ``` -------------------------------- ### Delete Pickled File (Python) Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example2 - Real dataset.md Removes the temporary pickled file used for saving and loading the analysis setup. ```python # delete file os.remove(pathlib.Path(r"./test.pkl")) ``` -------------------------------- ### Load Data and Initialize MultiSetup_PreGER Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example4 - Multisetup PreGER.md Loads sample datasets and defines reference sensor indices. Initializes the MultiSetup_PreGER class with sampling frequency, reference indices, and datasets. Includes data decimation and channel information plotting. ```python # import data files set1 = np.load(get_sample_data(filename="set1.npy", folder="3SL"), allow_pickle=True) set2 = np.load(get_sample_data(filename="set2.npy", folder="3SL"), allow_pickle=True) set3 = np.load(get_sample_data(filename="set3.npy", folder="3SL"), allow_pickle=True) # list of datasets and reference indices data = [set1, set2, set3] ref_ind = [[0, 1, 2], [0, 1, 2], [0, 1, 2]] # Create multisetup msp = MultiSetup_PreGER(fs=100, ref_ind=ref_ind, datasets=data) # decimate data msp.decimate_data(q=2) # Plot TH, PSD and KDE of the (selected) channels of the (selected) datasets _, _ = msp.plot_ch_info(data_idx=[1], ch_idx=[2]) ``` -------------------------------- ### Run All Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example1 - Getting started.md Executes all added algorithms on the prepared data. ```python # run simp_5dof.run_all() ``` -------------------------------- ### Instantiate SingleSetup Class Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example2 - Real dataset.md Creates an instance of the SingleSetup class with the loaded data and sampling frequency. This object is central to subsequent analyses. ```python # create single setup Pali_ss = SingleSetup(data, fs=100) ``` -------------------------------- ### Initialize FSDD and SSI Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Initializes instances of the `FSDD` and `SSI` algorithms, passing the previously defined run parameters. Equivalent instances can be created by directly passing arguments. ```python # Initialise the algorithms fsdd = FSDD(name="FSDD", run_params=fsdd_runpar) # Equivalent to fsdd1 = FSDD(name="FSDD1") ssicov = SSI(name="SSIcov", method="cov", run_params=ssi_runpar) # Equivalent to ssicov1 = SSI(name="SSIcov1", method="cov", br=20, ordmax=50, calc_unc=True, step=2) ``` -------------------------------- ### Run Tests Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Execute all project tests using the provided make command. ```shell make test ``` -------------------------------- ### Access Merged Modal Frequencies Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example3 - Multisetup PoSER.md Retrieve and display the merged natural frequencies from the analysis results. This array contains the refined frequency estimates after combining data from multiple setups. ```python algoRes.Fn >>> array([ 2.63203919, 2.69132343, 3.4254799 , 8.29357079, 8.42973383, 10.60678491, 14.00410737, 14.08557463, 17.42890419]) ``` -------------------------------- ### Import Necessary Modules and Load Data Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example2 - Real dataset.md Imports essential libraries and loads the sample dataset for analysis. Ensure the dataset file is accessible. ```python import numpy as np from pyoma2.algorithms import FSDD, SSIcov, pLSCF from pyoma2.setup import SingleSetup from pyoma2.support.utils.sample_data import get_sample_data # load example dataset for single setup data = np.load(get_sample_data(filename="Palisaden_dataset.npy", folder="palisaden"), allow_pickle=True) ``` -------------------------------- ### Instantiate OMA Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Instantiates FSDD and SSI algorithms, optionally passing run parameters. Equivalent instances can be created by directly providing arguments. ```python # Initialise the algorithms fsdd = FSDD(name="FSDD", run_params=fsdd_runpar) # Equivalent to fsdd1 = FSDD(name="FSDD1") ssicov = SSIcov(name="SSIcov", run_params=ssi_runpar) # Equivalent to ssicov1 = SSIcov(name="SSIcov1", method="cov", br=20, ordmax=50, calc_unc=True, step=2) ``` -------------------------------- ### Update Numpy Version Constraints Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Example of how to update NumPy version constraints in pyproject.toml when the minimum supported Python version is changed. This ensures compatibility with newer Python releases. ```shell "numpy<1.25; python_version < '3.9'", "numpy>=1.25; python_version >= '3.9'" ``` ```shell "numpy<2.0; python_version < '3.10'", "numpy>=2.0; python_version >= '3.10'" ``` -------------------------------- ### Import Necessary Modules Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example3 - Multisetup PoSER.md Import all required libraries and classes for the PoSER method and modal analysis. ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt from pyoma2.algorithms import SSIcov from pyoma2.setup import MultiSetup_PoSER, SingleSetup from pyoma2.support.utils.sample_data import get_sample_data ``` -------------------------------- ### Define Clustering Steps and Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example5 - Clustering.md Configures the three steps (Step1, Step2, Step3) for custom clustering algorithms and defines several Clustering instances using both step-by-step configuration and quick predefined options. ```python # define STEPS # STEP1 step1 = Step1() # default values for step 1 step1_1 = Step1(sc=False, pre_cluster=True, pre_clus_typ="kmeans") step1_2 = Step1(sc=True, pre_cluster=True, pre_clus_typ="GMM") print("Step1 default arguments: ", Step1().model_dump(),"\n") # STEP2 step2 = Step2(algo="hierarc", linkage="average") step2_1 = Step2(algo="hdbscan") step2_2 = Step2(algo="hierarc", linkage="single", dc=None, n_clusters="auto") step2_3 = Step2(algo="affinity") print("Step2 default arguments: ", Step2().model_dump(),"\n") # STEP3 step3 = Step3( post_proc=["merge_similar", "damp_IQR", "fn_IQR", "1xorder", "min_size_gmm", "MTT"] ) step3_1 = Step3( post_proc=["merge_similar", "damp_IQR", "fn_IQR", "1xorder", "min_size", "MTT"] ) step3_2 = Step3( post_proc=["merge_similar", "damp_IQR", "fn_IQR", "1xorder", "min_size_pctg", "MTT"] ) print("Step3 default arguments: ", Step3().model_dump(),"\n") # Define Clustering algorithms clus1 = Clustering(name="test-hierarc_avg", steps=[step1, step2, step3]) clus2 = Clustering(name="test-hdbscan", steps=[step1_1, step2_1, step3_1]) clus3 = Clustering(name="test-affinity", steps=[step1_2, step2_3, step3_2]) clus4 = Clustering(name="test-hierarc_sing", steps=[step1, step2_2, step3_1]) clus5 = Clustering(name="Dederichs", quick="Dederichs") clus6 = Clustering(name="Reynders", quick="Reynders") clus7 = Clustering(name="Neu", quick="Neu") clus8 = Clustering(name="Kvaale", quick="Kvaale") ``` -------------------------------- ### Get Modal Parameters Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example1 - Getting started.md Retrieves modal parameters using either an interactive plot or the manual mpe() method. The mpe() method requires specifying selected frequencies or an order determination method. ```python # get the modal parameters with the interactive plot # simp_ex.mpe_from_plot("SSIdat", freqlim=(0,10)) # or manually simp_5dof.mpe("SSIdat", sel_freq=[0.89, 2.598, 4.095, 5.261, 6.], order_in="find_min") ``` -------------------------------- ### Load and Prepare Datasets for MultiSetup_PreGER Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example4.ipynb Loads simulated datasets and defines reference sensor indices. Initializes the MultiSetup_PreGER class for multisetup analysis. Data can be pre-processed using methods like decimate_data or filter_data. ```python # import data files set1 = np.load(get_sample_data(filename="set1.npy", folder="3SL"), allow_pickle=True) set2 = np.load(get_sample_data(filename="set2.npy", folder="3SL"), allow_pickle=True) set3 = np.load(get_sample_data(filename="set3.npy", folder="3SL"), allow_pickle=True) # list of datasets and reference indices data = [set1, set2, set3] ref_ind = [[0, 1, 2], [0, 1, 2], [0, 1, 2]] # Create multisetup msp = MultiSetup_PreGER(fs=100, ref_ind=ref_ind, datasets=data) # decimate data #msp.decimate_data(q=2) # Plot TH, PSD and KDE of the (selected) channels of the (selected) datasets _, _ = msp.plot_ch_info(data_idx=[1], ch_idx=[2]) ``` -------------------------------- ### Regenerate Lock File for Linux and Python 3.9+ Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Regenerates the PDM lock file for Linux with Python 3.9+, including pyvista and openpyxl. Note: The example specifies Python 3.8 but the description mentions 3.9+. ```shell pdm lock --python="==3.8.*" --platform=linux --with pyvista --with openpyxl --lockfile=pdm-py39+unix.lock ``` -------------------------------- ### Add Algorithms and Run Clustering Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example5 - Clustering.md Adds the defined clustering algorithms to the AutoSSI instance, then adds the AutoSSI instance to the SingleSetup instance. Finally, it runs the SSI analysis and all defined clustering analyses. ```python # Add clustering algorithms to AutoSSI class instance autossi.add_clustering(clus1, clus2, clus3, clus4, clus5, clus6, clus7, clus8) # add AutoSSI instance to SingleSetup instance clust_test.add_algorithms(autossi) # Run algorithm clust_test.run_by_name("autossi") # clust_test.run_all() # Run clustering either one by one or altogether # autossi.run_clustering("test-hierarc_avg", "test-hdbscan", "test-affinity", "test-hierarc_sing") clust_test["autossi"].run_all_clustering() ``` -------------------------------- ### Regenerate Lock File for Windows and Python 3.9+ Source: https://github.com/dagghe/pyoma2/blob/main/docs/Contributing.md Regenerates the PDM lock file for Windows with Python 3.9+, including pyvista and openpyxl. Note: The example specifies Python 3.8 but the description mentions 3.9+. ```shell pdm lock --python="==3.8.*" --platform=windows --with pyvista --with openpyxl --lockfile=pdm-py39+win.lock ``` -------------------------------- ### Run Project (Linux/MAC) Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Execute the main script of the pyoma2 project on Linux or macOS systems. ```shell uv run src/pyoma2/main.py ``` -------------------------------- ### Initialize SSI Run Parameters with Custom Arguments Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Initializes SSI run parameters, customizing arguments like method, bandwidth ratio (br), maximum order (ordmax), uncertainty calculation (calc_unc), and step size. The parameters can be viewed as a dictionary. ```python # Do the same for SSI, changing some of the default arguments ssi_runpar = SSIRunParams(method="cov", br=20, ordmax=50, calc_unc=True, step=2) dict(ssi_runpar) ``` -------------------------------- ### Run All or Specific Algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Execute all added algorithms using 'run_all()' or run specific algorithms by name using 'run_by_name()'. This process logs the execution of each algorithm. ```python # run all simp_5dof.run_all() # or run by name # simp_5dof.run_by_name("SSIcov", "FSDD") ``` -------------------------------- ### Run Project (Windows) Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Execute the main script of the pyoma2 project on Windows systems. ```powershell uv run .\src\pyoma2\main.py ``` -------------------------------- ### Run Tests with Coverage Source: https://github.com/dagghe/pyoma2/blob/main/CONTRIBUTING.md Run all project tests and generate a code coverage report. ```shell make test-coverage ``` -------------------------------- ### Initialize SSI for OMAX (IOcov) Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Initializes an `SSI` instance for OMAX analysis when input forces are measured. The `IOcov` method is used, and the input force array `U` is passed. ```python iocov = SSI(name="IOcov", method="IOcov", br=20, ordmax=50, calc_unc=True, step=2, U=U) ``` -------------------------------- ### Initialize EFDD Run Parameters Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Initializes the EFDD run parameters with default values. The parameters can be inspected as a dictionary. ```python # Import FSDD run parameters (default values) and print out as dictionary fsdd_runpar = EFDDRunParams() dict(fsdd_runpar) ``` -------------------------------- ### Inspect and Update Algorithm Run Parameters Source: https://github.com/dagghe/pyoma2/blob/main/docs/Extra1 - Tips and tricks.md Demonstrates how to inspect the current run parameters of an algorithm instance and how to update them by assigning a new RunParamCls instance. ```python # Inspect the parameters passed print("SSI run parameters: ", ssicov.run_params) # Overwrite/update run parameters for an algorithm fsdd.run_params = FSDD.RunParamCls(nxseg=2048, method_SD="per", pov=0.5) print("") print("FSDD run parameters: ", fsdd.run_params) ``` -------------------------------- ### Initialize SSI Run Parameters Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Initializes the `SSIRunParams` object with custom arguments for the SSI algorithm. This allows for fine-tuning parameters like `br`, `ordmax`, `calc_unc`, and `step`. ```python # Do the same for SSI, changing some of the default arguments ssi_runpar = SSIRunParams(br=20, ordmax=50, calc_unc=True, step=2) dict(ssi_runpar) ``` -------------------------------- ### Build pyOMA2 Docker image Source: https://github.com/dagghe/pyoma2/blob/main/README.md Build the Docker image for pyOMA2 using Docker Compose. This command prepares the containerized environment with all dependencies pre-installed. ```shell docker compose build ``` -------------------------------- ### Run FSDD, SSIcov, and IOcov algorithms Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Extra1.ipynb Execute the FSDD, SSIcov, and IOcov algorithms with specified frequencies, parameters, and orders. These are used for modal parameter extraction. ```python simp_5dof.mpe("FSDD", sel_freq=[0.89, 2.598, 4.095, 5.261, 6.], sppk=3, npmax=20, MAClim=0.97) simp_5dof.mpe("SSIcov", sel_freq=[0.89, 2.598, 4.095, 5.261, 6.], order_in=30) simp_5dof.mpe("IOcov", sel_freq=[0.89, 2.598, 4.095, 5.261, 6.], order_in=30) ``` -------------------------------- ### Define Geometries for MultiSetup Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example3.ipynb Loads geometry data from Excel files using get_sample_data and defines them for the MultiSetup_PoSER object using def_geo1_by_file and def_geo2_by_file methods. Ensure the '3SL' folder contains the specified Excel files. ```python # Geometry 1 _geo1 = get_sample_data(filename="Geo1.xlsx", folder="3SL") # Geometry 2 _geo2 = get_sample_data(filename="Geo2.xlsx", folder="3SL") # Define geometry1 msp.def_geo1_by_file(_geo1) # Define geometry 2 msp.def_geo2_by_file(_geo2) ``` -------------------------------- ### Run All Clustering Configurations Source: https://github.com/dagghe/pyoma2/blob/main/Examples/Example5.ipynb Execute all defined clustering configurations for a given system identification result. This is useful for a comprehensive analysis. ```python clust_test["autossi"].run_all_clustering() ``` -------------------------------- ### Define AutoSSI Run Parameters Source: https://github.com/dagghe/pyoma2/blob/main/docs/Example5 - Clustering.md Sets up the run parameters for the AutoSSI class, including maximum order, step size, block rows, method, and whether to calculate uncertainties. ```python # define AutoSSI run parameters run_param = AutoSSIRunParams(ordmax=100, step=2, br=30, method="cov", calc_unc=False) # Create autoSSI instance autossi = AutoSSI(name="autossi", run_params=run_param) ``` -------------------------------- ### Enable X11 forwarding for GUI on Linux Source: https://github.com/dagghe/pyoma2/blob/main/README.md Configure X11 forwarding to allow GUI applications from the Docker container to display on your Linux host. This is necessary for interactive plots and 3D visualizations. ```shell xhost +local:docker docker compose up pyoma2 ```