4.9. IM Comparison
- imselection.compare_ims(im_results_dict, analysis_type='MCA', metric='all', reference_im_key=None, damage_threshold_index=0)[source]
Compare N ≥ 2 intensity measures by efficiency, proficiency, practicality, and RSM.
- Parameters:
im_results_dict (dict) – Mapping
{im_name: cloud_dict}(for MCA) or{im_name: ida_dict}(for IDA).analysis_type ({'MCA', 'IDA'}) – Which NDAP was used to generate the results.
metric ({'all', 'efficiency', 'proficiency', 'practicality', 'rsm'}) – Which metrics to compute.
'all'computes all four.reference_im_key (str or None) – IM name to use as IM₁ in RSM pairwise comparisons. If
None, the first key in im_results_dict is used.damage_threshold_index (int) – Damage-state index for proficiency computation. Default
0.
- Returns:
dict with keys
*
'ranking'—pd.DataFramewith columns im_name, – efficiency, proficiency, practicality, rsm_vs_reference, rank_efficiency, rank_proficiency, rank_practicality, rank_rsm*
'rsm_matrix'—dict[str, dict[str, float]]where –rsm_matrix[im_i][im_j]= RSM(IM_j vs IM_i)*
'metric'— the metric argument used*
'analysis_type'— the analysis_type argument used*
'reference_im_key'— the IM used as IM₁ for RSM
- Raises:
ValueError – If fewer than 2 IMs are supplied or analysis_type is invalid.
Example
from openquake.vmtk.imselection import imselection
ims = imselection()
# cloud_pga, cloud_sa, cloud_avgsa: outputs of postprocessor.process_mca_results()
results = {
"PGA": cloud_pga,
"Sa(T1)": cloud_sa,
"AvgSa": cloud_avgsa,
}
ranking = ims.compare_ims(results, analysis_type="MCA", metric="all")
print(ranking["ranking"])