예제 #1
0
def test_weighting_one_1(cmtsource, dcon_one):
    config = DefaultWeightConfig(
        normalize_by_energy=False, normalize_by_category=False,
        comp_weight={"Z": 1.0, "R": 1.0, "T": 1.0},
        love_dist_weight=1.0, pnl_dist_weight=1.0,
        rayleigh_dist_weight=1.0, azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    for meta in weight.metas:
        for w in meta.weights:
            npt.assert_allclose(w, 1.0)
예제 #2
0
def test_weighting_two(cmtsource):
    dcon_two = construct_dcon_two()

    config = DefaultWeightConfig(
        normalize_by_energy=True, normalize_by_category=True,
        comp_weight={"Z": 1.0, "R": 1.0, "T": 1.0},
        love_dist_weight=1.0, pnl_dist_weight=1.0,
        rayleigh_dist_weight=1.0, azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_two, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_two.nwindows)
예제 #3
0
def test_weighting_one_2(cmtsource, dcon_one):
    config = DefaultWeightConfig(
        normalize_by_energy=False, normalize_by_category=False,
        comp_weight={"Z": 2.0, "R": 1.0, "T": 2.0},
        love_dist_weight=1.0, pnl_dist_weight=1.0,
        rayleigh_dist_weight=1.0, azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_one.nwindows)

    npt.assert_allclose(weight.metas[0].weights, 5/9.0)
    npt.assert_allclose(weight.metas[1].weights,
                        [10./9, 10./9])
    npt.assert_allclose(weight.metas[2].weights,
                        [10./9, 10./9])
예제 #4
0
def test_weighting_one_1(cmtsource, dcon_one):
    config = DefaultWeightConfig(normalize_by_energy=False,
                                 normalize_by_category=False,
                                 comp_weight={
                                     "Z": 1.0,
                                     "R": 1.0,
                                     "T": 1.0
                                 },
                                 love_dist_weight=1.0,
                                 pnl_dist_weight=1.0,
                                 rayleigh_dist_weight=1.0,
                                 azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    for meta in weight.metas:
        for w in meta.weights:
            npt.assert_allclose(w, 1.0)
예제 #5
0
def test_weighting_one_3(cmtsource, dcon_one):
    config = DefaultWeightConfig(
        normalize_by_energy=False, normalize_by_category=False,
        comp_weight={"Z": 2.0, "R": 1.0, "T": 2.0},
        love_dist_weight=0.78, pnl_dist_weight=1.15,
        rayleigh_dist_weight=0.5, azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_one.nwindows)

    for meta in weight.metas:
        print(meta)
    npt.assert_allclose(weight.metas[0].weights, 0.46054087)
    npt.assert_allclose(weight.metas[1].weights,
                        [1.13969125, 1.13969125])
    npt.assert_allclose(weight.metas[2].weights,
                        [0.92108173, 1.3389949])
예제 #6
0
def test_weighting_two(cmtsource):
    dcon_two = construct_dcon_two()

    config = DefaultWeightConfig(normalize_by_energy=True,
                                 normalize_by_category=True,
                                 comp_weight={
                                     "Z": 1.0,
                                     "R": 1.0,
                                     "T": 1.0
                                 },
                                 love_dist_weight=1.0,
                                 pnl_dist_weight=1.0,
                                 rayleigh_dist_weight=1.0,
                                 azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_two, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_two.nwindows)
예제 #7
0
def test_weighting_one_2(cmtsource, dcon_one):
    config = DefaultWeightConfig(normalize_by_energy=False,
                                 normalize_by_category=False,
                                 comp_weight={
                                     "Z": 2.0,
                                     "R": 1.0,
                                     "T": 2.0
                                 },
                                 love_dist_weight=1.0,
                                 pnl_dist_weight=1.0,
                                 rayleigh_dist_weight=1.0,
                                 azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_one.nwindows)

    npt.assert_allclose(weight.metas[0].weights, 5 / 9.0)
    npt.assert_allclose(weight.metas[1].weights, [10. / 9, 10. / 9])
    npt.assert_allclose(weight.metas[2].weights, [10. / 9, 10. / 9])
예제 #8
0
def test_weighting_one_3(cmtsource, dcon_one):
    config = DefaultWeightConfig(normalize_by_energy=False,
                                 normalize_by_category=False,
                                 comp_weight={
                                     "Z": 2.0,
                                     "R": 1.0,
                                     "T": 2.0
                                 },
                                 love_dist_weight=0.78,
                                 pnl_dist_weight=1.15,
                                 rayleigh_dist_weight=0.5,
                                 azi_exp_idx=0.5)

    weight = Weight(cmtsource, dcon_one, config)
    weight.setup_weight()

    sumw = weight_sum(weight.metas)
    npt.assert_allclose(sumw, dcon_one.nwindows)

    for meta in weight.metas:
        print(meta)
    npt.assert_allclose(weight.metas[0].weights, 0.46054087)
    npt.assert_allclose(weight.metas[1].weights, [1.13969125, 1.13969125])
    npt.assert_allclose(weight.metas[2].weights, [0.92108173, 1.3389949])