def test_get_M_midpoint_rel(self): # Pull out the test data z = self.test_data['z_raw'] Ez = self.test_data['Ez_raw'] Bz = self.test_data['Bz_raw'] valid_M = self.test_data['M2'] # Get the matrix h = 5e-6 test_M = belinear.get_M(z, Ez, Bz, h, gamma_initial=2, method='midpoint') # Compare the matrices self.assertTrue(np.isclose(valid_M, test_M).all())
def test_get_M_constant_rest(self): # Pull out the test data z = self.test_data['z_raw'] Ez = self.test_data['Ez_raw'] Bz = self.test_data['Bz_raw'] valid_M = self.test_data['M1'] # Get the matrix h = 5e-6 test_M = belinear.get_M(z, Ez, Bz, h, gamma_initial=1, method='constant_field') # Compare the matrices self.assertTrue(np.isclose(valid_M, test_M, rtol=0.01).all())