def __init__(self, scenario: model.Scenario):
"""Initialize the model."""
super().__init__(scenario)
s = self._scenario
flag_rs = flag_ss = flag_ns = 0
if s.mechanism == 'SS':
flag_ss = 1
elif s.mechanism == 'NS':
flag_ns = 1
elif s.mechanism == 'RS':
flag_rs = 1
event = (s.mag, s.depth_hyp, flag_rs, flag_ss, flag_ns, s.dist_jb,
s.v_s30)
global INTERPOLATOR
if INTERPOLATOR is None:
with np.load(fname_data) as data:
INTERPOLATOR = NearestNDInterpolator(data['events'],
data['predictions'])
prediction = INTERPOLATOR(event)
self._ln_resp = prediction[0::2]
self._ln_std = np.sqrt(prediction[1::2])
评论列表
文章目录