openquake.hazardlib.correlation_models package#
Base interfaces#
Base interfaces shared by ground-motion correlation models.
- class openquake.hazardlib.correlation_models.base.CholeskyFactor(lower_triangle: ndarray)[source]#
Bases:
objectDense Cholesky factorization used by the default implementation.
- lower_triangle: ndarray#
- class openquake.hazardlib.correlation_models.base.CorrelationContext(mag: float | None = None, rake: float | None = None, trt: str | None = None, region: str | None = None)[source]#
Bases:
objectOptional predictors used by context-dependent correlation models.
- mag: float | None = None#
- rake: float | None = None#
- region: str | None = None#
- trt: str | None = None#
- class openquake.hazardlib.correlation_models.base.CorrelationFactor(*args, **kwargs)[source]#
Bases:
ProtocolA factorization capable of applying correlation to samples.
- class openquake.hazardlib.correlation_models.base.CorrelationModel[source]#
Bases:
objectCommon metadata and validation for all correlation models.
- CALIBRATED_FOR_INTENSITY_MEASURE_TYPES = None#
- DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = None#
- DEFINED_FOR_INTENSITY_MEASURE_TYPES = None#
- DEFINED_FOR_REGION = None#
- DEFINED_FOR_RESIDUAL_COMPONENT = None#
- DEFINED_FOR_SA_DAMPING = None#
- DEFINED_FOR_SA_PERIOD_RANGE = None#
- INTENSITY_MEASURE_TYPE_APPROXIMATIONS = {}#
- SUPPORTS_CIRCULANT_EMBEDDING = False#
- class openquake.hazardlib.correlation_models.base.CrossIMTCorrelationModel[source]#
Bases:
SpatialCrossIMTCorrelationModelCross-IMT correlation at a single site.
These models describe dependence among IMTs but not spatial dependence. When used for within-event residuals, the same IMT correlation is applied independently at each site.
- correlation_matrix(imts, component=None, context=None, dtype=<class 'float'>)[source]#
Return an
M x Mcross-IMT correlation matrix.
- covariance(sites, imts, component=None, context=None)[source]#
Embed cross-IMT matrices for each site in IMT-major ordering.
- factor(sites, imts, component=None, context=None, ensure_psd=True)[source]#
Factor the small IMT matrix once for all independent sites.
The returned
SiteIndependentFactorreuses oneM x MCholesky factor acrossNsites. This is the sampling equivalent of factoring the full site-and-IMT covariance, without its quadratic memory cost.
- class openquake.hazardlib.correlation_models.base.ResidualComponent(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
str,EnumResidual components for which a model can be calibrated.
- BETWEEN_EVENT = 'between'#
- TOTAL = 'total'#
- WITHIN_EVENT = 'within'#
- class openquake.hazardlib.correlation_models.base.SiteIndependentFactor(lower_triangle: ndarray, num_sites: int)[source]#
Bases:
objectCross-IMT factor applied independently at every site.
lower_triangleis the Cholesky factor of theM x MIMT correlation matrix andnum_sitesisN. In IMT-major ordering, this object applies the equivalent oflower_triangleKroneckerI_Nwithout constructing that(M*N) x (M*N)matrix.- lower_triangle: ndarray#
- num_sites: int#
- class openquake.hazardlib.correlation_models.base.SpatialCorrelationModel[source]#
Bases:
SpatialCrossIMTCorrelationModelSame-IMT spatial correlation over a collection of sites.
- apply_correlation(sites, imt, residuals, stddev_intra=0)[source]#
Apply spatial correlation to sampled within-event residuals.
- correlation_matrix(sites, imt, component=None, context=None)[source]#
Return a same-IMT spatial correlation matrix or block.
- class openquake.hazardlib.correlation_models.base.SpatialCrossIMTCorrelationModel[source]#
Bases:
CorrelationModelCorrelation over a joint, IMT-major vector of sites and IMTs.
- correlate(sites, imts, samples, component=None, context=None)[source]#
Correlate standard-normal samples across IMTs and sites.
samplesmust have shape(M, N, E). The first two dimensions are flattened in IMT-major order before applying the factorization.
- correlation_block(distances, imts1, imts2=None, component=None, context=None)[source]#
Return correlation between two IMT-major site vectors.
distanceshas shape(N1, N2)and the returned matrix has shape(len(imts1) * N1, len(imts2) * N2). Joint models should implement this method so they can also be used for conditioning.
- covariance(sites, imts, component=None, context=None)[source]#
Return a covariance matrix with shape
(M*N, M*N).
- factor(sites, imts, component=None, context=None, ensure_psd=True)[source]#
Return the default dense factorization of
covariance().The fast path attempts Cholesky decomposition directly. A covariance repair is performed only when decomposition fails and
ensure_psdis true. Models with efficient structured factorizations should override this method.
- class openquake.hazardlib.correlation_models.base.TruncatedCrossIMTCorrelationModel(truncation_level=99.0)[source]#
Bases:
CrossIMTCorrelationModelCross-IMT model able to sample truncated normal residuals.
- matrix_dtype#
alias of
float
Registry#
Registry for ground-motion correlation models.
- class openquake.hazardlib.correlation_models.registry.ModelSpec(name: str, cls: type[openquake.hazardlib.correlation_models.base.CorrelationModel], aliases: tuple[str, ...], model_type: str, description: str)[source]#
Bases:
objectRegistration metadata for a correlation model.
- aliases: tuple[str, ...]#
- property calibrated_imts#
- description: str#
- property imc#
- property intensity_measure_type_approximations#
- model_type: str#
- name: str#
- property region#
- property residual_component#
- property sa_damping#
- property sa_period_range#
- property supported_imts#
- openquake.hazardlib.correlation_models.registry.get_model(name, model_type=None, **parameters)[source]#
Instantiate and validate the model registered under
name.
- openquake.hazardlib.correlation_models.registry.get_model_class(name, model_type=None)[source]#
Return the class registered under
name.
Scalable sampling#
- class openquake.hazardlib.correlation_models.circulant_embedding.RegularGridLayout(grid_shape: tuple, spacing: tuple, site_indices: ndarray, crs: int, projected_origin: tuple, maximum_error: float)[source]#
Projected regular-grid geometry for a geographic site collection.
- classmethod from_sites(sites, max_cell_ratio=4)[source]#
Infer a square UTM lattice, retaining holes as unused cells.
- property occupancy#
Return the fraction of enclosing grid cells containing a site.
- class openquake.hazardlib.correlation_models.circulant_embedding.CirculantEmbeddingFactor(spectral_root: ndarray, grid_shape: tuple, embedded_shape: tuple, num_imts: int, site_indices: ndarray, embedding_multiplier: int, minimum_eigenvalue: float)[source]#
FFT factorization of an IMT-major regular-grid covariance.
Use
build()to construct a positive-semidefinite periodic embedding.apply()accepts a two-dimensional array containing one white-noise vector per column and returns fields in IMT-major order.- classmethod build(model, imts, grid_shape, spacing, component=None, context=None, site_indices=None, max_multiplier=8)[source]#
Build an embedding, enlarging it until its spectrum is PSD.
- property input_size#
Number of independent values required for each realization.
- property output_size#
Number of correlated values returned for each realization.
- property workspace_bytes_per_realization#
Conservative FFT workspace estimate for one realization.
- class openquake.hazardlib.correlation_models.local_kriging.LocalKrigingFactor(layout: RegularGridLayout, num_imts: int, num_stations: int, on_grid_stations: ndarray, on_grid_cells: ndarray, groups: tuple, error_size: int)[source]#
Map regular-grid fields and local errors to station fields.
- classmethod build(model, imts, layout, stations, order=4, component=None, context=None)[source]#
Build fourth-order local conditionals by default.
- property nbytes#
Return bytes retained by the station mapping and factors.
Spatial models#
- class openquake.hazardlib.correlation_models.spatial.jayaram_baker_2009.JayaramBaker2009(vs30_clustering)[source]#
Bases:
SpatialCorrelationModelWithin-event spatial correlation by Jayaram and Baker (2009).
The publication calibrated PGA and 5%-damped SA through 10 seconds. PGV is retained temporarily using OpenQuake’s historical SA(1.0) proxy.
- class openquake.hazardlib.correlation_models.spatial.heresi_miranda_2019.HeresiMiranda2019(uncertainty_multiplier=0)[source]#
Bases:
SpatialCorrelationModelWithin-event spatial correlation by Heresi and Miranda (2019).
- class openquake.hazardlib.correlation_models.spatial.aldea_et_al_2022.AldeaEtAl2022[source]#
Bases:
SpatialCorrelationModelWithin-event model for the Chilean subduction zone.
- class openquake.hazardlib.correlation_models.spatial.schiappapietra_et_al_2022.SchiappapietraEtAl2022NorthernItaly[source]#
Bases:
_SchiappapietraEtAl2022Median model calibrated for Northern Italy.
- class openquake.hazardlib.correlation_models.spatial.schiappapietra_et_al_2022.SchiappapietraEtAl2022CentralItaly[source]#
Bases:
_SchiappapietraEtAl2022Median model calibrated for Central Italy.
- class openquake.hazardlib.correlation_models.spatial.schiappapietra_et_al_2022.SchiappapietraEtAl2022SouthernItaly[source]#
Bases:
_SchiappapietraEtAl2022Median model calibrated for Southern Italy.
The publication notes that this regional model is less well constrained than the Northern and Central Italy models because only six earthquakes were available for its calibration.
Joint spatial and cross-IMT models#
- class openquake.hazardlib.correlation_models.spatial_cross_imt.loth_baker_2013.LothBaker2013[source]#
Bases:
SpatialCrossIMTCorrelationModelWithin-event spatial cross-IMT model by Loth and Baker (2013).
The model was calibrated for 5%-damped SA from 0.01 to 10 s. PGA is supported through the conventional SA(0.01) correlation proxy.
- class openquake.hazardlib.correlation_models.spatial_cross_imt.markhvida_et_al_2018.MarkhvidaEtAl2018[source]#
Bases:
SpatialCrossIMTCorrelationModelWithin-event spatial cross-IMT model by Markhvida et al. (2018).
The model uses all nineteen principal components, following the authors’ current reference implementation, and was calibrated for 5%-damped SA from 0.01 to 5 seconds. PGA is supported through the conventional SA(0.01) correlation proxy; this is an operational approximation rather than a calibrated part of the model.
- class openquake.hazardlib.correlation_models.spatial_cross_imt.wang_du_2013.WangDu2013PGAIAPGV(vs30_correlation_range=12.5)[source]#
Bases:
_WangDu2013Joint correlation for the publication’s PGA, IA, and PGV set.
- class openquake.hazardlib.correlation_models.spatial_cross_imt.wang_du_2013.WangDu2013SpectralAcceleration(vs30_correlation_range=12.5)[source]#
Bases:
_WangDu2013Joint correlation for 5%-damped SA from 0.01 to 10 seconds.
The publication permits linear interpolation of the tabulated coregionalization matrices. Interpolation can change their marginal variances, so the resulting covariance is normalized to a correlation matrix. This preserves the standard deviations supplied by the GSIM.
- class openquake.hazardlib.correlation_models.spatial_cross_imt.du_ning_2021.DuNing2021[source]#
Bases:
SpatialCrossIMTCorrelationModelPublished seven-PC within-event joint correlation model.
The 0.9 scale factor in equations 22-24 is common to every principal-component covariance and therefore cancels during the normalization in equation 12. PGA and SA(0.01) are separate calibrated IMTs. Their first seven published coefficients, which are the only ones retained by this simplified model, are identical; their complete 23-PC rows in Table 3 are not.
- class openquake.hazardlib.correlation_models.spatial_cross_imt.du_ning_2021.DuNing2021Interpolated[source]#
Bases:
DuNing2021Within-event joint model with explicit off-grid SA interpolation.
The author-supplied Matlab function bilinearly interpolates final correlations in ordinary period. Here the equivalent normalized loading vectors are interpolated first and then renormalized using the zero-distance principal-component covariance. Thus the result equals the Matlab value divided by the square root of its two interpolated marginal variances. It is exact at every published node, symmetric, unit-diagonal, and positive semidefinite for arbitrary periods within 0.01–10 seconds.
Cross-IMT models#
- class openquake.hazardlib.correlation_models.cross_imt.abrahamson_et_al_2014.AbrahamsonEtAl2014BetweenEvent(truncation_level=99.0)[source]#
Bases:
_AbrahamsonEtAl2014Correlation,TruncatedCrossIMTCorrelationModelASK14 between-event cross-IMT correlation.
The table was derived from ASK14 residuals for active shallow crustal earthquakes. The closest application is therefore with the
AbrahamsonEtAl2014GMM, although the engine does not restrict its use with other GMMs.
- class openquake.hazardlib.correlation_models.cross_imt.abrahamson_et_al_2014.AbrahamsonEtAl2014WithinEvent[source]#
Bases:
_AbrahamsonEtAl2014Correlation,CrossIMTCorrelationModelASK14 same-site within-event cross-IMT correlation.
The model correlates IMTs at each site independently. It does not define spatial correlation between different sites and therefore does not replace a joint spatial-cross-IMT model such as Loth and Baker (2013).
- class openquake.hazardlib.correlation_models.cross_imt.baker_bradley_2017.BakerBradley2017[source]#
Bases:
CrossIMTCorrelationModelCorrected total-residual amplitude and duration correlation.
The paper reports active-shallow-crustal NGA-West2 records with magnitude greater than 5 and Joyner-Boore distance below 100 km. SA is supported at the 105 published, 5%-damped periods from 0.01 to 10 s. RSD575 and RSD595 are also directly calibrated. The amplitude IMTs use RotD50, whereas the duration GMM uses the geometric mean; model-wide component metadata is therefore intentionally unset.
- class openquake.hazardlib.correlation_models.cross_imt.baker_cornell_2006.BakerCornell2006[source]#
Bases:
CrossIMTCorrelationModelTotal-residual spectral correlation by Baker and Cornell (2006).
The publication calibrated 5%-damped SA from 0.05 to 5 seconds. PGA and PGV are retained temporarily using the engine’s historical SA(0.05) proxy.
- class openquake.hazardlib.correlation_models.cross_imt.baker_jayaram_2008.BakerJayaram2008[source]#
Bases:
CrossIMTCorrelationModelTotal-residual cross-IMT correlation for GMRotI50.
The publication calibrated 5%-damped SA from 0.01 to 10 seconds. PGA is represented by the model’s shortest calibrated period, SA(0.01).
- class openquake.hazardlib.correlation_models.cross_imt.bradley_2012.Bradley2012(truncation_level=99.0)[source]#
Bases:
TruncatedCrossIMTCorrelationModelTotal-residual correlation between PGV and spectrum-based IMTs.
- class openquake.hazardlib.correlation_models.cross_imt.goda_atkinson_2009.GodaAtkinson2009(truncation_level=99.0)[source]#
Bases:
TruncatedCrossIMTCorrelationModelBetween-event cross-IMT correlation by Goda and Atkinson (2009).
The model was calibrated for 5%-damped SA from 0.1 to 5 seconds. PGA is retained temporarily using the engine’s historical SA(0.05) proxy, which lies outside that calibrated range.
- matrix_dtype#
alias of
float32
- class openquake.hazardlib.correlation_models.cross_imt.no_cross_correlation.NoCrossCorrelation(truncation_level=99.0)[source]#
Bases:
TruncatedCrossIMTCorrelationModelRepresent the absence of cross-IMT correlation.
- class openquake.hazardlib.correlation_models.cross_imt.full_cross_correlation.FullCrossCorrelation(truncation_level=99.0)[source]#
Bases:
TruncatedCrossIMTCorrelationModelRepresent perfect cross-IMT correlation.
Compatibility modules#
openquake.hazardlib.correlation and
openquake.hazardlib.cross_correlation are compatibility modules for the
historical APIs. New code should import canonical classes from
openquake.hazardlib.correlation_models subpackages or resolve configured
models through the registry.