Пример #1
0
 def test_angle_histogram(self, p3ht_gsd):
     angles_hist = angle_distribution(
             p3ht_gsd, "cc", "ss", "cc", start=0, stop=1, histogram=True
     )
     angles_no_hist = angle_distribution(
             p3ht_gsd, "cc", "ss", "cc", start=0, stop=1, histogram=False
     )
     assert angles_hist.ndim == 2
     assert angles_no_hist.ndim == 1
Пример #2
0
 def test_angle_distribution_order(self, p3ht_gsd):
     angles = angle_distribution(p3ht_gsd,
                                 "ss",
                                 "cc",
                                 "cd",
                                 start=0,
                                 stop=1)
     angles2 = angle_distribution(p3ht_gsd,
                                  "cd",
                                  "cc",
                                  "ss",
                                  start=0,
                                  stop=1)
     assert angles.shape[0] > 0
     assert angles.shape == angles2.shape
     assert np.array_equal(angles, angles2)
Пример #3
0
 def test_angle_not_found(self, p3ht_gsd):
     with pytest.raises(ValueError):
         angles = angle_distribution(p3ht_gsd,
                                     "cc",
                                     "xx",
                                     "cc",
                                     start=0,
                                     stop=1)
Пример #4
0
 def test_angle_distribution_rad(self, p3ht_gsd):
     angles = angle_distribution(p3ht_gsd,
                                 "cc",
                                 "ss",
                                 "cc",
                                 start=0,
                                 stop=1,
                                 degrees=False)
     for ang in angles:
         assert 1.40 < ang < 1.75
Пример #5
0
 def test_angle_distribution_deg(self, p3ht_gsd):
     angles = angle_distribution(p3ht_gsd,
                                 "cc",
                                 "ss",
                                 "cc",
                                 start=0,
                                 stop=1,
                                 degrees=True)
     for ang in angles:
         assert 80 < ang < 100
Пример #6
0
 def test_angle_range_outside(self, p3ht_gsd):
     with pytest.warns(UserWarning):
         angles_hist = angle_distribution(p3ht_gsd,
                                          "cc",
                                          "ss",
                                          "cc",
                                          start=0,
                                          stop=1,
                                          histogram=True,
                                          theta_min=120,
                                          theta_max=180)
Пример #7
0
 def test_angle_dist_normalize(self, p3ht_gsd):
     angles_hist = angle_distribution(
             p3ht_gsd,
             "cc",
             "ss",
             "cc",
             start=0,
             stop=1,
             histogram=True,
             normalize=True,
     )
     assert np.allclose(np.sum(angles_hist[:,1]), 1, 1e-3)
Пример #8
0
 def test_angle_distribution_range(self, p3ht_gsd):
     angles = angle_distribution(p3ht_gsd,
                                 "cc",
                                 "ss",
                                 "cc",
                                 start=0,
                                 stop=1,
                                 histogram=True,
                                 degrees=True,
                                 theta_min=10,
                                 theta_max=180)
     assert np.allclose(angles[0, 0], 10, atol=0.5)
     assert np.allclose(angles[-1, 0], 180, atol=0.5)