From ddb55f55e92f252fcc4ebafc21336220871dc1c4 Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Thu, 15 Aug 2024 12:20:20 +0200 Subject: [PATCH] Renamed ._unique to .unique --- model_server/base/accessors.py | 2 +- tests/test_ilastik/test_ilastik.py | 2 +- tests/test_ilastik/test_roiset_workflow.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model_server/base/accessors.py b/model_server/base/accessors.py index f7d076fa..6ccd74b7 100644 --- a/model_server/base/accessors.py +++ b/model_server/base/accessors.py @@ -88,7 +88,7 @@ class GenericImageDataAccessor(ABC): def _gc(self, channels): return self.get_channels(list(channels)) - def _unique(self): + def unique(self): return np.unique(self.data, return_counts=True) @property diff --git a/tests/test_ilastik/test_ilastik.py b/tests/test_ilastik/test_ilastik.py index b6a6f851..9e2bbd3d 100644 --- a/tests/test_ilastik/test_ilastik.py +++ b/tests/test_ilastik/test_ilastik.py @@ -382,7 +382,7 @@ class TestIlastikOnMultichannelInputs(conf.TestServerBaseClass): acc_input = generate_file_accessor(self.pa_input_image) acc_obmap = res['ob_map'] self.assertEqual(acc_obmap.hw, acc_input.hw) - self.assertEqual(len(acc_obmap._unique()[1]), 3) + self.assertEqual(len(acc_obmap.unique()[1]), 3) def test_api(self): diff --git a/tests/test_ilastik/test_roiset_workflow.py b/tests/test_ilastik/test_roiset_workflow.py index 19c7d9f7..4d8d4ec3 100644 --- a/tests/test_ilastik/test_roiset_workflow.py +++ b/tests/test_ilastik/test_roiset_workflow.py @@ -119,9 +119,9 @@ class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase): trace.write_interm(Path(output_path) / 'trace', 'roiset_worfklow_trace', skip_first=False, skip_last=False) self.assertTrue('ob_id' in trace.keys()) - self.assertEqual(len(trace['labeled']._unique()[0]), 14) + self.assertEqual(len(trace['labeled'].unique()[0]), 14) self.assertEqual(rois.count, 13) - self.assertEqual(len(trace['ob_id']._unique()[0]), 2) + self.assertEqual(len(trace['ob_id'].unique()[0]), 2) class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProducts): @@ -183,8 +183,8 @@ class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProd def test_workflow_with_object_classifier(self): acc = self._object_map_workflow(self.test_load_object_classifier()) - self.assertTrue(np.all(acc._unique()[0] == [0, 1, 2])) + self.assertTrue(np.all(acc.unique()[0] == [0, 1, 2])) def test_workflow_without_object_classifier(self): acc = self._object_map_workflow(None) - self.assertTrue(np.all(acc._unique()[0] == [0, 1])) + self.assertTrue(np.all(acc.unique()[0] == [0, 1])) -- GitLab