def test_get_simple_cubic_signal(self): s0 = dd.get_simple_cubic_signal() s0.plot() s1 = dd.get_simple_cubic_signal(image_noise=False) s1.plot() s2 = dd.get_simple_cubic_signal(image_noise=True) s2.plot()
def test_detector_normalisation(self): det_image = get_detector_image_signal() img = get_simple_cubic_signal(image_noise=True) img = (img) * 300000 + 4000 image_normalised = quant.detector_normalisation(img, det_image, 60) assert image_normalised.data.max() < 1 assert image_normalised.data.shape == img.data.shape
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))
def test_inverted_signal(self): s = dd.get_simple_cubic_signal() amm.run_image_filtering(s, invert_signal=True)
def test_standard(self): s = dd.get_simple_cubic_signal() amm.run_image_filtering(s)
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)
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)
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')
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)
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)
def test_simple(self): s = dd.get_simple_cubic_signal() s_fs = afr.get_feature_separation(s) s_fs.plot()
def test_too_low_separation(self, separation): s = dd.get_simple_cubic_signal() with pytest.raises(ValueError): afr.get_atom_positions(s, separation)