How gemsciencetools/oq-vmtk works
Main Components
• Core Library (under “openquake/vmtk”): This is the heart of the toolkit. It includes modules such as:
• calibration.py: Likely manages the calibration of the models.
• im_calculator.py: Computes intensity measures.
• modeller.py: Constructs the single- or multi-degree-of-freedom system models.
• plotter.py: Provides visualization routines.
• postprocessor.py: Processes results from analyses.
• slf_generator.py: Creates storey loss function estimates.
• utilities.py and units.py: Support functions and unit conversions.
• Demo Scripts (under “demos” and “.virtual_documents/demos”):
• Input dataset directories (CSV files, pkl files) that simulate real-world inventories, ground motion records, and accelerations.
• Testing Suite:
• Located under “openquake/vmtk/tests” (and test data), ensuring each module’s functionality and validating the core processing routines.
• Documentation and CI/CD:
• The “docsrc” directory holds source files for documentation generation.
• GitHub workflows (in “.github/workflows”) for continuous integration across different operating system platforms.
• Configuration & Dependency Management:
• Multiple requirements files and the pyproject.toml are used to manage dependencies, hinting at different Python environments and platform-specific dependencies (Windows vs. Linux).
Relationships and Data Flow
• Input Layer:
• The demos/in directory contains CSV inputs, such as inventories (for structural properties) and records (seismic data – acceleration, DTS files). These are fed into the system.
• Core Processing:
• The data flows from the input files into the main library modules. For example, the modeller uses input parameters (storey count, force-deformation relationships) to establish system models.
• The IM Calculator and Calibration modules then process these models to compute key engineering measures.
• The Postprocessor and SLF Generator further analyze the output to derive fragility and vulnerability functions.
• Visualization:
• The Plotter module takes data from various analysis stages to generate graphs such as cloud analysis results, system response profiles, and fragility curves.
• Output Layer:
• Results are stored in the demos/out folder and can also be visualized via interactive notebooks.
• Testing and Documentation:
• Continuous tests (CI workflows) ensure that as the code base evolves, each module interacts correctly.
• Documentation is generated from the “docsrc” files, providing a user-friendly guide to using each component.
Architectural Patterns and Design Principles
• Modular Architecture:
• The system is split into distinct modules (calibration, modelling, analysis, plotting) that can be developed and tested independently.
• Separation of Concerns:
• Input/processing/output responsibilities are clearly separated, helping both in maintenance and in simplifying the demonstration workflows.
• Extensibility:
• By isolating core functionality in the “openquake/vmtk” package, new modules or enhancements (e.g., additional analysis methods) can be integrated without affecting existing features.
• Integration with External Dependencies:
• The toolkit leverages external libraries (such as OpenSeesPy) and is designed to run in a properly managed virtual environment to avoid dependency issues.