def test_compute_hazard_map(self):
        curves = [
            [0.8, 0.5, 0.1],
            [0.98, 0.15, 0.05],
            [0.6, 0.5, 0.4],
            [0.1, 0.01, 0.001],
            [0.8, 0.2, 0.1],
        ]
        imls = [0.005, 0.007, 0.0098]
        poe = 0.2

        expected = [[0.00847798, 0.00664814, 0.0098, 0, 0.007]]
        actual = post_proc.compute_hazard_maps(curves, imls, poe)
        aaae(expected, actual)
    def test_compute_hazard_map_multi_poe(self):
        curves = [
            [0.8, 0.5, 0.1],
            [0.98, 0.15, 0.05],
            [0.6, 0.5, 0.4],
            [0.1, 0.01, 0.001],
            [0.8, 0.2, 0.1],
        ]
        imls = [0.005, 0.007, 0.0098]
        poes = [0.1, 0.2]

        expected = [
            [0.0098, 0.0084, 0.0098, 0.005, 0.0098],
            [0.0091, 0.00687952, 0.0098, 0.005, 0.007],
        ]

        actual = post_proc.compute_hazard_maps(curves, imls, poes)
        aaae(expected, actual)
    def test_compute_hazard_map_poes_list_of_one(self):
        curves = [
            [0.8, 0.5, 0.1],
            [0.98, 0.15, 0.05],
            [0.6, 0.5, 0.4],
            [0.1, 0.01, 0.001],
            [0.8, 0.2, 0.1],
        ]

        # NOTE(LB): Curves may be passed as a generator or iterator;
        # let's make sure that works, too.
        curves = iter(curves)

        imls = [0.005, 0.007, 0.0098]
        poe = [0.2]
        expected = [[0.00847798, 0.00664814, 0.0098, 0, 0.007]]
        actual = post_proc.compute_hazard_maps(curves, imls, poe)
        aaae(expected, actual)