Skip to content

Add aristeidou_2024.py gsim. Add FIV3, Sa_avg2, and Sa_avg3 IMs#10291

Merged
micheles merged 16 commits into
gem:masterfrom
Savvinos-Aristeidou:master
Jan 31, 2025
Merged

Add aristeidou_2024.py gsim. Add FIV3, Sa_avg2, and Sa_avg3 IMs#10291
micheles merged 16 commits into
gem:masterfrom
Savvinos-Aristeidou:master

Conversation

@Savvinos-Aristeidou

Copy link
Copy Markdown
Contributor

Implementing the Aristeidou et al. (2024) GMM, which was developed using artificial neural networks, and estimates a range of intensity measure and horizontal component definitions.
Adding the FIV3, Sa_avg2, and Sa_avg3 intensity measure in the imt.py file.
The tests for this gsim were added as well.

fetching the latest updates from the main oq-engine repository
Fixing bugs with Sa_avg2, Sa_avg3, and FIV3 im_name variable. Fixing the addition of component_definition in the im_name. Few other minor bug fixes.
these files are outdated and left in this branch from before the openquake pull request
adding the Aristeidou et al. 2024 GGMM to the updated version of openquake
vectorise the aristeidou_2024.py gsim with respect to the intensity measure array to optimise runtime
this error was occurring when the user had as input a single scenario of context parameters
@mmpagani

mmpagani commented Jan 28, 2025

Copy link
Copy Markdown
Member

Dear @Savvinos-Aristeidou many thanks for your pull request. Overall, we are fine with your code. The only exception is the file gmm_ann.json, which seems quite verbose. From what we've understood, it contains values of the supported IMTs for various combinations of the explanatory variables. If this is correct, models of this type are implemented in the OQ engine using the GMPETable object (https://github.com/gem/oq-engine/blob/master/openquake/hazardlib/gsim/gmpe_table.py#L141). Maybe it's late to change your code, but we wanted to raise this warning because maintaining it will be less straightforward for us, given its particularity.

@micheles

Copy link
Copy Markdown
Contributor

Since the read_json function is called at top-level the ~30,000 long .json file is read at import time and this is slowing down the startup time of the engine for all users, including the one not using the new GMPE.
The right way to implement a file-dependent GMPE is documented here: https://docs.openquake.org/oq-engine/master/manual/user-guide/inputs/ground-motion-models-inputs.html#file-dependent-gmpes
As Marco said, we prefer to use .hdf5 files rather than .json files.

@Savvinos-Aristeidou

Savvinos-Aristeidou commented Jan 30, 2025

Copy link
Copy Markdown
Contributor Author

@mmpagani : Thanks for the review! The gmm_ann.json file was indeed very verbose, because each coefficient was taking a line, amounting to ~30,000 lines. For the most part it was containing the biases and weights matrices, which are coefficients used with the ANN 'functional form' to compute the estimations for the IMTs. It was not containing IMTs for various combinations of the explanatory variables, that's why we didn't use the GMPETable object.

@micheles : Thanks for the review! Now we read the file in the __init__ method inside the GMPE object. Also, the .json file was changed to .hdf5.

Theoretically we could have the weights and biases values in a COEFFS table inside the gsim file, like derras_2014.py. However, we thought that the number of coefficients is very high since we had 150 nodes in our hidden layer, whereas derras_2014.py has 5 nodes, and that would clutter the gsim file. If loading the external file would still cause problems, we can try to have all the coefficients in a COEFFS table.

Thanks for the instructions and corrections.

@micheles micheles added this to the Engine 3.23.0 milestone Jan 31, 2025
Comment thread openquake/hazardlib/gsim/aristeidou_2024.py
@mmpagani

Copy link
Copy Markdown
Member

From my perspective, the PR is good to go. Many thanks, @Savvinos-Aristeidou, for your contribution!

@micheles micheles merged commit 2826b75 into gem:master Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants