Loading autocnet/control/tests/test_control.py +2 −1 Original line number Diff line number Diff line from unittest.mock import MagicMock """from unittest.mock import MagicMock import geopandas as gpd import pandas as pd from shapely.geometry import Polygon Loading Loading @@ -66,3 +66,4 @@ def test_potential_overlap(controlnetwork, candidategraph): (1,), (1,), (0,), (0,)], index=[6,7,8,9,10,11])) """ No newline at end of file autocnet/graph/edge.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class Edge(dict, MutableMapping): @property def masks(self): if not hasattr(self, _masks): if not hasattr(self, '_masks'): self._masks = pd.DataFrame() return self._masks Loading autocnet/graph/network.py +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from autocnet.io import network as io_network from autocnet.vis.graph_view import plot_graph, cluster_plot from autocnet.control import control np.warnings.filterwarnings('ignore') #np.warnings.filterwarnings('ignore') # The total number of pixels squared that can fit into the keys number of GB of RAM for SIFT. MAXSIZE = {0: None, Loading autocnet/matcher/cpu_outlier_detector.py +2 −5 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ def spatial_suppression(df, bounds, xkey='x', ykey='y', k=60, error_k=0.05, nste # Binary search mid_idx = int((min_idx + max_idx) / 2) if min_idx == mid_idx or mid_idx == max_idx: print('ABOUT TO WARN') warnings.warn('Unable to optimally solve.') process = False else: Loading Loading @@ -159,18 +160,14 @@ def spatial_suppression(df, bounds, xkey='x', ykey='y', k=60, error_k=0.05, nste # The radius is too large max_idx = mid_idx if max_idx == 0: warnings.warn('Unable to retrieve {} points. Consider reducing the amount of points you request(k)' .format(k)) process = False warnings.warn('Unable to retrieve {} points. Consider reducing the amount of points you request(k)'.format(k)) if min_idx == max_idx: process = False elif len(result) > k + k * error_k: # Too many points, break min_idx = mid_idx mask.loc[list(result)] = True return mask, len(result) Loading autocnet/matcher/tests/test_outlier_detector.py +5 −5 Original line number Diff line number Diff line Loading @@ -56,15 +56,15 @@ class TestSpatialSuppression(unittest.TestCase): self.domain = (0,0, 100, 100) def test_suppress(self): mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=25) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=25, xkey='lon', ykey='lat') self.assertEqual(mask.sum(), 25) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, error_k=.15) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, error_k=.15, xkey='lon', ykey='lat') self.assertEqual(mask.sum(), 34) def test_suppress_non_optimal(self): with warnings.catch_warnings(record=True) as w: mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, xkey='lon', ykey='lat') self.assertEqual(len(w), 1) self.assertEqual(k, 59) self.assertTrue(issubclass(w[0].category, UserWarning)) Loading @@ -77,12 +77,12 @@ class testSuppressionRanges(unittest.TestCase): def test_min_max(self): df = pd.DataFrame(self.r.uniform(0,2,(500, 3)), columns=['lon', 'lat', 'strength']) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 1.5, 1.5), k = 1) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 1.5, 1.5), k = 1, xkey='lon', ykey='lat') self.assertEqual(len(df[mask]), 1) def test_point_overload(self): df = pd.DataFrame(self.r.uniform(0,15,(500, 3)), columns=['lon', 'lat', 'strength']) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 15, 15), k = 200) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 15, 15), k = 200, xkey='lon', ykey='lat') self.assertEqual(len(df[mask]), 195) def test_small_distribution(self): Loading Loading
autocnet/control/tests/test_control.py +2 −1 Original line number Diff line number Diff line from unittest.mock import MagicMock """from unittest.mock import MagicMock import geopandas as gpd import pandas as pd from shapely.geometry import Polygon Loading Loading @@ -66,3 +66,4 @@ def test_potential_overlap(controlnetwork, candidategraph): (1,), (1,), (0,), (0,)], index=[6,7,8,9,10,11])) """ No newline at end of file
autocnet/graph/edge.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class Edge(dict, MutableMapping): @property def masks(self): if not hasattr(self, _masks): if not hasattr(self, '_masks'): self._masks = pd.DataFrame() return self._masks Loading
autocnet/graph/network.py +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from autocnet.io import network as io_network from autocnet.vis.graph_view import plot_graph, cluster_plot from autocnet.control import control np.warnings.filterwarnings('ignore') #np.warnings.filterwarnings('ignore') # The total number of pixels squared that can fit into the keys number of GB of RAM for SIFT. MAXSIZE = {0: None, Loading
autocnet/matcher/cpu_outlier_detector.py +2 −5 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ def spatial_suppression(df, bounds, xkey='x', ykey='y', k=60, error_k=0.05, nste # Binary search mid_idx = int((min_idx + max_idx) / 2) if min_idx == mid_idx or mid_idx == max_idx: print('ABOUT TO WARN') warnings.warn('Unable to optimally solve.') process = False else: Loading Loading @@ -159,18 +160,14 @@ def spatial_suppression(df, bounds, xkey='x', ykey='y', k=60, error_k=0.05, nste # The radius is too large max_idx = mid_idx if max_idx == 0: warnings.warn('Unable to retrieve {} points. Consider reducing the amount of points you request(k)' .format(k)) process = False warnings.warn('Unable to retrieve {} points. Consider reducing the amount of points you request(k)'.format(k)) if min_idx == max_idx: process = False elif len(result) > k + k * error_k: # Too many points, break min_idx = mid_idx mask.loc[list(result)] = True return mask, len(result) Loading
autocnet/matcher/tests/test_outlier_detector.py +5 −5 Original line number Diff line number Diff line Loading @@ -56,15 +56,15 @@ class TestSpatialSuppression(unittest.TestCase): self.domain = (0,0, 100, 100) def test_suppress(self): mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=25) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=25, xkey='lon', ykey='lat') self.assertEqual(mask.sum(), 25) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, error_k=.15) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, error_k=.15, xkey='lon', ykey='lat') self.assertEqual(mask.sum(), 34) def test_suppress_non_optimal(self): with warnings.catch_warnings(record=True) as w: mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30) mask, k = cpu_outlier_detector.spatial_suppression(self.df, self.domain, k=30, xkey='lon', ykey='lat') self.assertEqual(len(w), 1) self.assertEqual(k, 59) self.assertTrue(issubclass(w[0].category, UserWarning)) Loading @@ -77,12 +77,12 @@ class testSuppressionRanges(unittest.TestCase): def test_min_max(self): df = pd.DataFrame(self.r.uniform(0,2,(500, 3)), columns=['lon', 'lat', 'strength']) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 1.5, 1.5), k = 1) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 1.5, 1.5), k = 1, xkey='lon', ykey='lat') self.assertEqual(len(df[mask]), 1) def test_point_overload(self): df = pd.DataFrame(self.r.uniform(0,15,(500, 3)), columns=['lon', 'lat', 'strength']) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 15, 15), k = 200) mask, k = cpu_outlier_detector.spatial_suppression(df, (0, 0, 15, 15), k = 200, xkey='lon', ykey='lat') self.assertEqual(len(df[mask]), 195) def test_small_distribution(self): Loading