Ejemplo n.º 1
0
 def test_adf(self):
     s_adf = self.s_adf
     get_feature_separation(s_adf,
                            separation_range=(5, 7),
                            separation_step=1,
                            pca=True,
                            subtract_background=True,
                            normalize_intensity=True)
Ejemplo n.º 2
0
 def test_dtypes(self):
     dtype_list = [
         'float64', 'float32', 'uint64', 'uint32', 'uint16', 'uint8',
         'int64', 'int32', 'int16', 'int8'
     ]
     s = dd.get_simple_cubic_signal()
     s *= 10**9
     for dtype in dtype_list:
         print(dtype)
         s.change_dtype(dtype)
         afr.get_feature_separation(s, separation_range=(10, 15))
     s.change_dtype('float16')
     with pytest.raises(ValueError):
         afr.get_feature_separation(s, separation_range=(10, 15))
Ejemplo n.º 3
0
 def test_pca_subtract_background_normalize_intensity(self):
     s = dd.get_simple_cubic_signal()
     s_fs = afr.get_feature_separation(s,
                                       pca=True,
                                       subtract_background=True,
                                       normalize_intensity=True)
     assert hasattr(s_fs, 'data')
Ejemplo n.º 4
0
 def test_separation_step(self):
     sr0, sr1, s_step = 10, 16, 2
     s = dd.get_simple_cubic_signal()
     s_fs = afr.get_feature_separation(s,
                                       separation_range=(sr0, sr1),
                                       separation_step=s_step)
     assert s_fs.axes_manager.navigation_size == ((sr1 - sr0) / s_step)
Ejemplo n.º 5
0
 def test_find_no_peaks(self):
     s = dd.get_simple_cubic_signal().isig[:5., :5.]
     with pytest.raises(ValueError):
         afr.get_feature_separation(s)
Ejemplo n.º 6
0
 def test_small_input_size_large_separation_range(self):
     # For small images and large separation, no peaks can be returned.
     # This test checks that this doesn't result in an error.
     s = dd.get_simple_cubic_signal().isig[:50., :50.]
     afr.get_feature_separation(s)
Ejemplo n.º 7
0
 def test_separation_range_bad(self, separation_range):
     s = dd.get_simple_cubic_signal()
     with pytest.raises(ValueError):
         afr.get_feature_separation(s, separation_range)
Ejemplo n.º 8
0
 def test_too_low_separation_low(self, separation_low):
     separation_range = (separation_low, 3)
     s = dd.get_simple_cubic_signal()
     with pytest.raises(ValueError):
         afr.get_feature_separation(s, separation_range)
Ejemplo n.º 9
0
 def test_separation_range(self):
     sr0, sr1 = 10, 15
     s = dd.get_simple_cubic_signal()
     s_fs = afr.get_feature_separation(s, separation_range=(sr0, sr1))
     assert s_fs.axes_manager.navigation_size == (sr1 - sr0)
     assert s_fs.axes_manager.navigation_extent == (sr0, sr1 - 1)
Ejemplo n.º 10
0
 def test_simple(self):
     s = dd.get_simple_cubic_signal()
     s_fs = afr.get_feature_separation(s)
     s_fs.plot()