def test_calculation():
    chargeres = ChargeResolutionCalculator()
    measured = np.array([3.5, 2.7])
    true = 3
    n = measured.size

    sum_ = np.sum(np.power(measured - true, 2))
    assert_almost_equal(sum_, 0.34, 3)
    assert_almost_equal(chargeres.rmse_abs(sum_, n), 0.412, 3)
    assert_almost_equal(chargeres.rmse(true, sum_, n), 0.137, 3)
    assert_almost_equal(chargeres.charge_res_abs(true, sum_, n), 1.780, 3)
    assert_almost_equal(chargeres.charge_res(true, sum_, n), 0.593, 3)

    assert chargeres.rmse_abs(sum_, n) == chargeres.rmse(true, sum_, n) * true
    assert (chargeres.charge_res_abs(true, sum_, n) ==
            chargeres.charge_res(true, sum_, n) * true)
Beispiel #2
0
def test_calculation():
    chargeres = ChargeResolutionCalculator()
    measured = np.array([3.5, 2.7])
    true = 3
    n = measured.size

    sum_ = np.sum(np.power(measured - true, 2))
    assert_almost_equal(sum_, 0.34, 3)
    assert_almost_equal(chargeres.rmse_abs(sum_, n), 0.412, 3)
    assert_almost_equal(chargeres.rmse(true, sum_, n), 0.137, 3)
    assert_almost_equal(chargeres.charge_res_abs(true, sum_, n), 1.780, 3)
    assert_almost_equal(chargeres.charge_res(true, sum_, n), 0.593, 3)

    assert chargeres.rmse_abs(sum_, n) == chargeres.rmse(true, sum_, n) * true
    assert (chargeres.charge_res_abs(
        true, sum_, n) == chargeres.charge_res(true, sum_, n) * true)
def test_result():
    chargeres = ChargeResolutionCalculator(mc_true=False)
    measured = np.array([3.5, 2.7])
    true = 3
    n = measured.size
    sum_ = np.sum(np.power(measured - true, 2))

    chargeres.add(0, true, measured)
    df_p, df_c = chargeres.finish()
    assert (df_p['charge_resolution'].values[0] ==
            chargeres.rmse(true, sum_, n))
    assert (df_p['charge_resolution_abs'].values[0] ==
            chargeres.rmse_abs(sum_, n))
Beispiel #4
0
def test_result():
    chargeres = ChargeResolutionCalculator(mc_true=False)
    measured = np.array([3.5, 2.7])
    true = 3
    n = measured.size
    sum_ = np.sum(np.power(measured - true, 2))

    chargeres.add(0, true, measured)
    df_p, df_c = chargeres.finish()
    assert (df_p['charge_resolution'].values[0] == chargeres.rmse(
        true, sum_, n))
    assert (df_p['charge_resolution_abs'].values[0] == chargeres.rmse_abs(
        sum_, n))
Beispiel #5
0
def test_result():
    charge_res = ChargeResolutionCalculator(mc_true=False)
    measured = np.array([3.5, 2.7])
    true = 3
    n = measured.size
    sum_ = np.sum((measured - true)**2)

    charge_res.add(0, true, measured)
    df_p, df_c = charge_res.finish()
    resolution = df_p["charge_resolution"].values[0]
    assert resolution == charge_res.rmse(true, sum_, n)
    resolution_abs = df_p["charge_resolution_abs"].values[0]
    assert resolution_abs == charge_res.rmse_abs(sum_, n)