def test_ones(self): data = np.ones((100, 100)) * 10 beta = bst_to_beta(data, 200000) assert data.shape == beta.shape assert (data != 0.0).all()
def test_bst_to_beta_to_bst(self): bst = 10e-6 output = beta_to_bst(bst_to_beta(bst, 200000), 200000) assert bst == output
def test_known_value(self): # From https://dx.doi.org/10.1016/j.ultramic.2016.03.006 bst = 10e-9 * 1 # 10 nm, 1 Tesla av = 200000 # 200 kV beta = bst_to_beta(bst, av) assert np.isclose(beta, 6.064e-6, rtol=1e-4)
def test_zero(self): data = np.zeros((100, 100)) beta = bst_to_beta(data, 200000) assert data.shape == beta.shape assert (data == 0.0).all()
def test_beta_to_bst_to_beta(self): beta = 2e-6 output = bst_to_beta(beta_to_bst(beta, 200000), 200000) assert beta == output