Esempio n. 1
0
def test_outarea_weighted_connectivity_distribution():
    net = GeoNetwork.SmallTestNetwork()
    res = net.outarea_weighted_connectivity_distribution(n_bins=4)[0]
    exp = np.array([0.15645071, 0.33674395, 0.34459165, 0.16221375])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 2
0
def test_inarea_weighted_connectivity_cumulative_distribution():
    net = GeoNetwork.SmallTestNetwork()
    res = net.inarea_weighted_connectivity_cumulative_distribution(n_bins=4)[0]
    exp = np.array([1.00000007, 0.84354936, 0.50680541, 0.16221375])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 3
0
def test_geographical_cumulative_distribution():
    net = GeoNetwork.SmallTestNetwork()
    res = net.geographical_cumulative_distribution(sequence=net.degree(),
                                                   n_bins=3)[0]
    exp = np.array([1.00000007, 0.84354936, 0.50680541])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 4
0
def test_outarea_weighted_connectivity():
    res = GeoNetwork.SmallTestNetwork().outarea_weighted_connectivity()
    exp = np.array(
        [0.4854067, 0.4989577, 0.33418113, 0.34459165, 0.51459336, 0.17262428],
        dtype=np.float32)
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 5
0
def test_local_geographical_clustering():
    res = GeoNetwork.SmallTestNetwork().local_geographical_clustering()
    exp = np.array([0., 0.0998, 0.1489, 0., 0.2842, 0.])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 6
0
def test_geographical_distribution():
    net = GeoNetwork.SmallTestNetwork()
    res = net.geographical_distribution(sequence=net.degree(), n_bins=3)[0]
    exp = np.array([0.15645071, 0.33674395, 0.50680541])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 7
0
def test_local_distance_weighted_vulnerability():
    res = GeoNetwork.SmallTestNetwork().local_distance_weighted_vulnerability()
    exp = np.array([
        0.03252519, 0.3136603, 0.20562718, 0.02799094, -0.02828809, -0.28798557
    ])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 8
0
def test_distance_weighted_closeness():
    res = GeoNetwork.SmallTestNetwork().distance_weighted_closeness()
    exp = np.array([
        2.23782229, 2.45008978, 2.23956348, 2.45008978, 2.2396005, 1.19817005
    ])
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 9
0
def test_average_distance_weighted_path_length():
    res = GeoNetwork.SmallTestNetwork().average_distance_weighted_path_length()
    exp = 0.49846491
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 10
0
def test_max_link_distance():
    res = GeoNetwork.SmallTestNetwork().max_link_distance()
    exp = np.array(
        [0.48467883, 0.2911402, 0.19376467, 0.2920272, 0.38866287, 0.48467883],
        dtype=np.float32)
    assert np.allclose(res, exp, atol=1e-04)
Esempio n. 11
0
def test_outconnectivity_weighted_distance():
    net = GeoNetwork.SmallTestNetwork()
    res = net.outconnectivity_weighted_distance()
    exp = np.array(
        [0.0625227, 0.03207134, 0.02408994, 0.04192858, 0.0500332, 0.08366733])
    assert np.allclose(res, exp, atol=1e-04)