Skip to content

Commit

Permalink
sa limits in moidel info
Browse files Browse the repository at this point in the history
  • Loading branch information
rizac committed Nov 24, 2024
1 parent 0dcbcbd commit 2cc3f44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion egsim/smtk/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,15 @@ def gsim_info(model: Union[str, GMPE]) -> dict:
- imts: list[str] the intensity measures defined for the model
- props: list[str] the ground motion properties required to compute the
model predictions
- sa_limits: spectral acceleration period limits where the model is defined
or None if the model is not defined for SA
"""
model = gsim(model)
return {
'doc': (model.__doc__ or "").strip(),
'imts': list(intensity_measures_defined_for(model) or []),
'props': list(ground_motion_properties_required_by(model) or [])
'props': list(ground_motion_properties_required_by(model) or []),
'sa_limits': get_sa_limits(model)
}


Expand Down
11 changes: 5 additions & 6 deletions static/js/vue/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,12 @@ EGSIM.component('gsim-select', {
var json = response.json().then(obj => {
var arr = Object.keys(obj).map(k =>
`<h5 class='text-nowrap text-primary'>${k}</h5>
<ul class='ps-4 mb-2'>
<li><b>Supported intensity measures:</b> ${obj[k]['imts'].join(', ')}</li>
<li><b>Required Ground motion properties:</b> ${obj[k]['props'].join(', ')}</li>
</ul>
<p class='ps-4'>${obj[k]['doc'].trim().replaceAll(/\.\s*\n\s*/g, ".<br>")}</p>
<b>Supported intensity measures:</b> ${obj[k]['imts'].join(', ')}</b><br>
${!obj[k]['sa_limits'] ? '' : '<b>SA limits (s):</b> ' + obj[k]['sa_limits'].join(', ') + '<br>' }
<b>Required Ground motion properties:</b> ${obj[k]['props'].join(', ')}
<div class='mt-2'>${obj[k]['doc'].trim().replaceAll(/\.\s*\n\s*/g, ".<br>")}</div>
`);
this.modelInfoText = arr.join('');
this.modelInfoText = '<div class="d-flex flex-column gap-4"><div>' + arr.join('</div><div>') + '</div></div>';
});
}).catch((error) => {
this.modelInfoText = 'No info available';
Expand Down

0 comments on commit 2cc3f44

Please sign in to comment.