GEMScienceTools / gmpe-smtk

Python and OpenQuake-based Toolkit for Analysis of Strong Motions and Interpretation of GMPEs
GNU Affero General Public License v3.0
43 stars 33 forks source link

Cb test #133

Open CB-quakemodel opened 1 year ago

CB-quakemodel commented 1 year ago

This commit includes new functions for plotting of loglikelihood, sample loglikelihood based gmpe weighting and EDR ranking w.r.t. spectral period, and produces tables corresponding to these outputs. These functions are added within residual_plotter, and are as follows: PlotLoglikelihoodWithSpectralPeriod, PlotModelWeightsWithSpectralPeriod, PlotEDRWithSpectralPeriod, LoglikelihoodTable, WeightsTable and EDRTable. To provide the inputs for the loglikelihood and weights plot and table functions, modifications were made to the get_log_likelihood_values definition within gmpe_residuals. These modifications simply store the LLH and model weight computed per spectral period. To compute EDR per imt three new definitions were added also within gmpe_residuals. These three modules are get_edr_values_wrt_spectral_period, _get_edr_gmpe_information_wrt_spectral_period and _get_edr_wrt_spectral_period. These three definitions store EDR, sqrt(kappa) and MDE norm per imt, rather than taking the aggregate as before. A function is also provided for plotting mean and sigma of each gmpe residual distribution w.r.t. spectral period (PlotResidualPDFWithSpectralPeriod) and to generate values as a table (PDFTable. A (passed) unit test (gmpe_ranking_metrics_wrt_imt_test.py) is also provided for the loglikelihood, weighting and EDR functions. This commit also adds functions for the parsing of ESM22 (web service) flatfiles, and of ESM23 (URL searchable web service) flatfiles within the SMTK. These functions read in the respective flatfile formats and use Pandas dataframes to rearrange the flatfiles into the existing ESM 2018 flatfile format. A (passed) unit test is also provided for each parser. This commit fixes a scaling issue within the model_configuration_plot function in trellis. Focal depth is now in decimal degrees to match the latitude and longitude on the other axis. The axis scaling was also fixed to equal, so that the true rupture model aspect ratio is also maintained when the distance from source to site increases or decreases. Finally, a deprecation issue with Context Maker module was fixed in conditional_simulation.py which was causing a test to fail.