Source code for viiapackage.reporting.helper_functions.get_results_info

### ===================================================================================================================
###   FUNTION: Collect information of the results for the engineering report
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject


### ===================================================================================================================
###   2. Helper function
### ===================================================================================================================

[docs]def get_results_info(project: ViiaProject, governing_analysis: str = None, image_folders: dict = None) -> dict: """ This function will generate dictionary keys for results information that can later be used as jinja tags for templating. Input - project (obj): VIIA project object containing collections of fem objects and project variables. - governing_analysis (str): Governing analysis for NLTH/NLPO results. For NLTH, choosing from 'S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9', 'S10' or 'S11'. For NLPO choosing from 'X_pos_uni', 'X_pos_modal', 'X_neg_uni', 'X_neg_modal', 'Y_pos_uni', 'Y_pos_modal', 'Y_neg_uni' or 'Y_neg_modal'. - image_folders (dict): Dictionary where the folder paths are stored for manual/model/result pictures. Output - Dictionary of jinja tags assigned to corresponding info. """ # Initialise result dict data = {'governing_analysis': {}, 'other_analyses': {}} # Get all analyses names in the latest folder containing governing analysis if project.analysis_type == 'NLPO': path = project.workfolder_location / 'A11 - NLPO flex base' if not path.exists(): project.write_log(f"WARNING: Analysis folder cannot be found. Make sure it exists at {path}") data['other_analyses'] = {} else: data['governing_analysis'] = { 'name': governing_analysis, 'latest_folder': image_folders['image_folders']['seismic_result_folder']} if image_folders['image_folders']['seismic_result_folder'] and \ image_folders['image_folders']['seismic_result_folder'].exists(): path_directions = image_folders['image_folders']['seismic_result_folder'].parent for x in path_directions.iterdir(): if x.name != governing_analysis: data['other_analyses'][x.name] = { 'name': x.name, 'latest_folder': x} if project.analysis_type == 'NLTH': if project.version == 1: path = project.workfolder_location / 'A12 - NLTH flex base' else: path = project.workfolder_location / 'A15 - NLTH flex base strengthening' if not path.exists(): project.write_log(f"WARNING: Analysis folder cannot be found. Make sure it exists at {path}") data['other_analyses'] = {} else: governing_analysis_folder_name = governing_analysis.replace('Signal ', '') data['governing_analysis'] = { 'name': governing_analysis_folder_name, 'latest_folder': image_folders['image_folders']['seismic_result_folder']} if image_folders['image_folders']['seismic_result_folder'] and \ image_folders['image_folders']['seismic_result_folder'].exists(): path_signals = image_folders['image_folders']['seismic_result_folder'].parent for x in path_signals.iterdir(): if x.name != governing_analysis_folder_name: data['other_analyses'][x.name] = { 'name': x.name, 'latest_folder': x} return {'results': data}
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================