Functions#
Parametric functions for stochastic ground motion simulation.
Each class exposes its required parameter names via the param_names property for easy introspection and automation. .. tip:: These classes are callable: For exmaple use as stateful y = BetaPeakConcentration()(t, …) or as stateless y = BetaPeakConcentration.compute(t, …).
Examples
>>> import numpy as np
>>> from sgsim.Functions import BetaSingle, Linear, Constant
>>> t = np.linspace(0, 40, 4000)
>>> # Functional (stateless) usage
>>> y_env = BetaSingle.compute(t, peak=0.3, concentration=5.0, energy=100.0, duration=40.0)
>>> y_freq = Linear.compute(t, start=10.0, end=5.0)
>>> y_damp = Constant.compute(t, value=0.3)
>>>
>>> # Object-oriented (stateful) usage
>>> env = BetaSingle()
>>> y_env2 = env(t, peak=0.3, concentration=5.0, energy=100.0, duration=40.0)
>>> print(env.params) # {'peak': 0.3, 'concentration': 5.0, 'energy': 100.0, 'duration': 40.0}
- class sgsim.Functions.BetaPeakConcentration[source]#
Bases:
ParametricFunctionBeta modulating function for earthquake ground motion simulation parameterized by peak and concentration.
Provides a smooth envelope function based on the Beta distribution, suitable for modeling single-phase earthquake strong motion.
- Parameters:
peak (float) – Ratio of the peak location as fraction of duration (0 < peak < 1).
concentration (float) – Concentration parameter controlling sharpness (> 0).
energy (float) – Total energy under the envelope (> 0).
duration (float) – Total duration of the function (> 0).
See also
BetaCentroidSpreadAlternative Beta parameterization using centroid and spread.
BetaSingleBeta function with weak motion baseline.
BetaDualBeta function with two strong phases.
References
Broadband stochastic simulation of earthquake ground motions with multiple strong phases with an application to the 2023 Kahramanmaraş, Turkey (Türkiye), earthquake. https://doi.org/10.1177/87552930251331981
- class sgsim.Functions.BetaCentroidSpread[source]#
Bases:
ParametricFunctionBeta modulating function for earthquake ground motion simulation parameterized by physical moments.
Provides a smooth envelope function based on the Beta distribution, suitable for modeling single-phase earthquake strong motion.
- Parameters:
centroid (float) – Ratio of the energy center of mass (0 < centroid < 1).
spread (float) – Ratio of the standard deviation of the energy envelope to the duration (0 < spread < 1).
energy (float) – Total energy under the envelope (> 0).
duration (float) – Total duration of the function (> 0).
See also
BetaPeakConcentrationBasic Beta function parameterized by peak and concentration.
BetaSingleBeta function with weak motion baseline.
BetaDualBeta function with two strong phases.
References
Broadband stochastic simulation of earthquake ground motions with multiple strong phases with an application to the 2023 Kahramanmaraş, Turkey (Türkiye), earthquake. https://doi.org/10.1177/87552930251331981
- class sgsim.Functions.BetaSingle[source]#
Bases:
ParametricFunctionBeta modulating function with a weak motion baseline parameterized by peak and concentration.
Combines a parabolic weak motion component (5% energy) with a Beta distribution strong motion component (95% energy) for realistic earthquake ground motion envelopes.
- Parameters:
peak (float) – Ratio of the peak location as fraction of duration (0 < peak < 1).
concentration (float) – Concentration parameter controlling sharpness (> 0).
energy (float) – Total energy under the envelope (> 0).
duration (float) – Total duration of the function (> 0).
See also
BetaPeakConcentrationBasic Beta function without weak motion.
BetaCentroidSpreadAlternative Beta parameterization using centroid and spread.
BetaDualBeta function with two strong phases.
References
Broadband stochastic simulation of earthquake ground motions with multiple strong phases with an application to the 2023 Kahramanmaraş, Turkey (Türkiye), earthquake. https://doi.org/10.1177/87552930251331981
- class sgsim.Functions.BetaDual[source]#
Bases:
ParametricFunctionBeta modulating function with two distinct strong phases parameterized by peak and concentration.
Models earthquakes with multiple strong motion packets, combining weak motion baseline (5% energy) with two independent Beta distributions representing separate strong motion phases.
- Parameters:
peak (float) – Peak location of first strong phase as fraction of duration (0 < peak < 1).
concentration (float) – Concentration parameter of first phase (> 0).
peak_2 (float) – Peak location of second strong phase as fraction of duration (0 < peak_2 < 1).
concentration_2 (float) – Concentration parameter of second phase (> 0).
energy_ratio (float) – Energy fraction allocated to first strong phase (0 < energy_ratio < 0.95).
energy (float) – Total energy under the envelope (> 0).
duration (float) – Total duration of the function (> 0).
See also
BetaPeakConcentrationBasic Beta function without weak motion.
BetaCentroidSpreadAlternative Beta parameterization using centroid and spread.
BetaSingleSingle strong phase with weak motion.
References
Broadband stochastic simulation of earthquake ground motions with multiple strong phases with an application to the 2023 Kahramanmaraş, Turkey (Türkiye), earthquake. https://doi.org/10.1177/87552930251331981
- class sgsim.Functions.Gamma[source]#
Bases:
ParametricFunctionGamma distribution modulating function.
Classical envelope function for earthquake ground motion based on Gamma distribution with exponential decay.
- Parameters:
scale (float) – Amplitude scaling factor (> 0).
shape (float) – Shape parameter controlling rise time (> 0).
decay (float) – Decay rate parameter (> 0).
See also
BetaSingleAlternative Beta-based envelope.
HousnerPiecewise envelope function.
- class sgsim.Functions.Housner[source]#
Bases:
ParametricFunctionHousner piecewise modulating function.
Three-phase envelope function: quadratic rise, constant plateau, and exponential decay. Classic model for earthquake strong motion.
- Parameters:
amplitude (float) – Constant amplitude during plateau phase (> 0).
decay (float) – Decay rate during tail phase (> 0).
shape (float) – Decay shape exponent (> 0).
tp (float) – Time to reach peak amplitude (> 0).
td (float) – Time to start decay phase (td > tp).
See also
GammaAlternative smooth envelope.
BetaSingleBeta-based envelope function.
- class sgsim.Functions.Linear[source]#
Bases:
ParametricFunctionLinear interpolation function.
Provides linear transition between start and end values over the time domain.
- Parameters:
start (float) – Starting value at t=0.
end (float) – Ending value at t=max(t).
See also
BilinearPiecewise linear with midpoint.
ExponentialExponential interpolation.
- class sgsim.Functions.Bilinear[source]#
Bases:
ParametricFunctionPiecewise linear interpolation function.
Provides two-segment linear transition through a specified midpoint, useful for modeling parameters with intermediate changes.
- Parameters:
start (float) – Starting value at t=0.
mid (float) – Value at midpoint time.
end (float) – Ending value at t=max(t).
t_mid (float) – Time at midpoint (0 < t_mid < max(t)).
See also
LinearSimple linear interpolation.
ExponentialSmooth exponential transition.
- class sgsim.Functions.Exponential[source]#
Bases:
ParametricFunctionExponential interpolation function.
Provides smooth exponential transition between start and end values, useful for parameters varying over orders of magnitude.
- Parameters:
start (float) – Starting value at t=0 (> 0).
end (float) – Ending value at t=max(t) (> 0).