Esempio n. 1
0
 def test_make_pmap(self):
     trunclevel = 3
     imtls = DictArray({'PGA': [0.01]})
     gsims = [valid.gsim('AkkarBommer2010')]
     ctxs = []
     for occ_rate in (.001, .002):
         ctx = RuptureContext()
         ctx.mag = 5.5
         ctx.rake = 90
         ctx.occurrence_rate = occ_rate
         ctx.sids = numpy.array([0.])
         ctx.vs30 = numpy.array([760.])
         ctx.rrup = numpy.array([100.])
         ctx.rjb = numpy.array([99.])
         ctxs.append(ctx)
     pmap = make_pmap(ctxs, gsims, imtls, trunclevel, 50.)
     numpy.testing.assert_almost_equal(pmap[0].array, 0.066381)
Esempio n. 2
0
 def test_get_pmap(self):
     truncation_level = 3
     imtls = DictArray({'PGA': [0.01]})
     gsims = [valid.gsim('AkkarBommer2010')]
     ctxs = []
     for occ_rate in (.001, .002):
         ctx = RuptureContext()
         ctx.mag = 5.5
         ctx.rake = 90
         ctx.occurrence_rate = occ_rate
         ctx.sids = numpy.array([0.])
         ctx.vs30 = numpy.array([760.])
         ctx.rrup = numpy.array([100.])
         ctx.rjb = numpy.array([99.])
         ctxs.append(ctx)
     cmaker = ContextMaker(
         'TRT', gsims, dict(imtls=imtls, truncation_level=truncation_level))
     cmaker.tom = PoissonTOM(time_span=50)
     pmap = cmaker.get_pmap(ctxs)
     numpy.testing.assert_almost_equal(pmap[0].array, 0.066381)
Esempio n. 3
0
 def _get_stds(self, within_absolute=None, between_absolute=None):
     if within_absolute is not None:
         gmm = SplitSigmaGMPE(gmpe_name='Campbell2003',
                              within_absolute=within_absolute)
     elif between_absolute is not None:
         gmm = SplitSigmaGMPE(gmpe_name='Campbell2003',
                              between_absolute=between_absolute)
     else:
         raise ValueError('Unknown option')
     # Set parameters
     ctx = RuptureContext()
     ctx.mag = 6.0
     ctx.sids = [0, 1, 2, 3]
     ctx.vs30 = [760.] * 4
     ctx.rrup = np.array([1., 10., 30., 70.])
     ctx.occurrence_rate = .0001
     imt = PGA()
     stds_types = [const.StdDev.TOTAL, const.StdDev.INTER_EVENT,
                   const.StdDev.INTRA_EVENT]
     # Compute results
     mean, stds = gmm.get_mean_and_stddevs(ctx, ctx, ctx, imt, stds_types)
     return stds, stds_types