Use RVT input motion with:
In [1]:
import matplotlib.pyplot as plt
import numpy as np
import pysra
%matplotlib inline
In [2]:
# Increased figure sizes
plt.rcParams['figure.dpi'] = 120
In [3]:
def create_motion(calculator):
mag = 7.0
dist = 30.0
region = 'wna'
m = pysra.motion.SourceTheoryRvtMotion(
mag, dist, region,
peak_calculator=calculator,
# These calculators need to know about the event for the RMS duration correction
calc_kwds={
'region': region,
'mag': mag,
'dist': dist,
}
)
return m
calculator_names = ['BT12', 'BT15', 'WR18']
motions = [create_motion(cn) for cn in calculator_names]
In [4]:
for m in motions:
m.calc_fourier_amps()
In [5]:
profile = pysra.site.Profile([
pysra.site.Layer(
pysra.site.SoilType('Soil', 18., None, 0.02),
300, 600
),
pysra.site.Layer(
pysra.site.SoilType(
'Rock', 24., None, 0.01
),
0, 2000
),
])
In [6]:
calc = pysra.propagation.LinearElasticCalculator()
In [7]:
freqs = np.logspace(-1, 2, num=500)
outputs = pysra.output.OutputCollection([
pysra.output.ResponseSpectrumOutput(
# Frequency
freqs,
# Location out (numerator)
pysra.output.OutputLocation('outcrop', index=0),
# Damping
0.05),
pysra.output.ResponseSpectrumRatioOutput(
# Frequency
freqs,
# Location in (denominator),
pysra.output.OutputLocation('outcrop', index=-1),
# Location out (numerator)
pysra.output.OutputLocation('outcrop', index=0),
# Damping
0.05)
])
Compute the response of the site, and store the state within the calculation object. Use the calculator, to compute the outputs.
In [8]:
for m in motions:
calc(m, profile, profile.location('outcrop', index=-1))
outputs(calc, m.peak_calculator.ABBREV)
In [9]:
for output in outputs:
fig, ax = plt.subplots(dpi=150)
for name, refs, values in output.iter_results():
ax.plot(refs, values, label=name)
ax.set(xlabel=output.xlabel, xscale='log', ylabel=output.ylabel)
ax.legend()
fig.tight_layout();