Пример #1
0
 def test_no_density_a(self):
     # Points on bin edge may be allocated ambiguously due to floating point
     # issues - testing here with slightly offset edges
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'a', [0,.101,.201,.301],
                         density=False)
     assert_array_almost_equal(o_ring[0][1]['x'], [0.0505, 0.151, 0.251])
     assert_array_almost_equal(o_ring[0][1]['y'], [8, 4, 0])
Пример #2
0
 def test_density_b(self):
     # First radius is 0.05
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'b', [0,.10000001,.1828427])
     assert_array_almost_equal(o_ring[0][1]['y'],
                               [6 / (1.25*np.pi*(0.1)**2),
                                6 / (3/8 * np.pi*(0.1828427**2 - 0.1**2))],
                               3)
Пример #3
0
 def test_density_a(self):
     # First radius is 0.05
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'a', [0,.10000001])
     assert_array_almost_equal(o_ring[0][1]['y'],
                               [8 / (1.25*np.pi*(0.1)**2)],
                               3)
Пример #4
0
 def test_with_split_b(self):
     o_ring = emp.o_ring(self.pat1, self.cols1, 'y:2', 'b', [0,.1,.2],
                         density=False)
     assert_array_equal(o_ring[0][1]['y'], [])  # Bottom
     assert_array_equal(o_ring[1][1]['y'], [6, 6])  # Top
Пример #5
0
 def test_no_density_b(self):
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'b', [0,.1,.2,.3],
                         density=False)
     assert_array_almost_equal(o_ring[0][1]['x'], [0.05, 0.15,0.25])
     assert_array_almost_equal(o_ring[0][1]['y'], [6, 6, 0])
Пример #6
0
 def test_one_individual_returns_zeros(self):
     self.pat1.table = self.pat1.table[2:4]  # Leave 1 'a' and 1 'b'
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'a', [0,.1,.2])
     assert_array_equal(o_ring[0][1]['y'], [0, 0])
Пример #7
0
 def test_spp_no_present_returns_empty_df(self):
     o_ring = emp.o_ring(self.pat1, self.cols1, '', 'nothere', [0,.1,.2])
     assert_frame_equal(o_ring[0][1], pd.DataFrame(columns=['x','y']))