def test_Kernel_Smoother_tabular(self): point_array = np.array(self.points) bbox = [[0, 0], [45, 45]] dfa = self.dfa sf = sm.Spatial_Filtering(bbox, point_array, dfa.e, dfa.b, 2, 2, r=30) np.testing.assert_allclose(sf.r, self.sf_exp, rtol=RTOL, atol=ATOL) dfa['geometry'] = self.points sf = sm.Spatial_Filtering.by_col(dfa, 'e', 'b', 3, 3, r=30) r_answer = np.array([ 0.07692308, 0.07213115, 0.07213115, 0.07692308, 0.07692308, 0.07692308, 0.07692308, 0.07692308, 0.07692308 ]) x_answer = np.array( [10.0, 10.0, 10.0, 20.0, 20.0, 20.0, 30.0, 30.0, 30.0]) y_answer = np.array([ 10.000000, 16.666667, 23.333333, 10.000000, 16.666667, 23.333333, 10.000000, 16.666667, 23.333333 ]) columns = [ 'e-b_spatial_filtering_{}'.format(name) for name in ['X', 'Y', 'R'] ] for col, answer in zip(columns, [x_answer, y_answer, r_answer]): np.testing.assert_allclose(sf[col].values, answer, rtol=RTOL, atol=ATOL)
def test_Spatial_Filtering(self): points = np.array(self.points) bbox = [[0, 0], [45, 45]] sf = sm.Spatial_Filtering(bbox, points, self.e, self.b, 2, 2, r=30) exp = [0.11111111, 0.11111111, 0.20000000000000001, 0.085106379999999995, 0.076923080000000005, 0.05789474, 0.052173909999999997, 0.066666669999999997, 0.04117647] self.assertEqual(list(sf.r.round(8)), exp)
def test_Spatial_Filtering(self): points = np.array(self.points) bbox = [[0, 0], [45, 45]] sf = sm.Spatial_Filtering(bbox, points, self.e, self.b, 2, 2, r=30) np.testing.assert_allclose(sf.r, self.sf_exp, rtol=RTOL, atol=ATOL)