def test_calculation_addition_args(self):
        avg_periods = [0.05, 0.15, 1.0, 2.0, 4.0]
        gmm = GenericGmpeAvgSA(gmpe_name="KothaEtAl2020ESHM20",
                               avg_periods=avg_periods,
                               corr_func="akkar",
                               sigma_mu_epsilon=1.0)

        rctx = RuptureContext()
        rctx.mag = 6.
        rctx.hypo_depth = 15.
        dctx = DistancesContext()
        dctx.rjb = np.array([1., 10., 30., 70.])

        sctx = SitesContext()
        sctx.vs30 = 500.0 * np.ones(4)
        sctx.vs30measured = np.ones(4, dtype="bool")
        sctx.region = np.zeros(4, dtype=int)
        stdt = [const.StdDev.TOTAL]
        expected_mean = np.array(
            [-1.72305707, -2.2178751, -3.20100306, -4.19948242])
        expected_stddev = np.array(
            [0.5532021, 0.5532021, 0.5532021, 0.5532021])
        imtype = imt.AvgSA()
        mean, [stddev] = gmm.get_mean_and_stddevs(sctx, rctx, dctx, imtype,
                                                  stdt)
        np.testing.assert_almost_equal(mean, expected_mean)
        np.testing.assert_almost_equal(stddev, expected_stddev)
    def test_calculation_addition_args(self):
        avg_periods = [0.05, 0.15, 1.0, 2.0, 4.0]
        gmm = GenericGmpeAvgSA(gmpe_name="KothaEtAl2019SERA",
                               avg_periods=avg_periods,
                               corr_func="akkar",
                               sigma_mu_epsilon=1.0)

        rctx = RuptureContext()
        rctx.mag = 6.
        rctx.hypo_depth = 15.
        dctx = DistancesContext()
        dctx.rjb = np.array([1., 10., 30., 70.])

        sctx = SitesContext()
        sctx.vs30 = 500.0 * np.ones(4)
        sctx.vs30measured = np.ones(4, dtype="bool")
        stdt = [const.StdDev.TOTAL]
        expected_mean = np.array(
            [-1.45586338, -1.94419233, -2.91884965, -3.91919928])
        expected_stddev = np.array(
            [0.58317566, 0.58317566, 0.58317566, 0.58317566])
        imtype = imt.AvgSA()
        mean, [stddev] = gmm.get_mean_and_stddevs(sctx, rctx, dctx, imtype,
                                                  stdt)
        np.testing.assert_almost_equal(mean, expected_mean)
        np.testing.assert_almost_equal(stddev, expected_stddev)