def test_dnmrplot_2spin_frequencies_commute(): freqorder_ab = dnmrplot_2spin(165.00, 135.00, 1.50, 2.50, 0.50, 0.75) freqorder_ba = dnmrplot_2spin(135.00, 165.00, 1.50, 0.50, 2.50, 0.25) popplot(*freqorder_ab) popplot(*freqorder_ba) np.testing.assert_array_almost_equal(freqorder_ab, freqorder_ba)
def test_dnmr_two_singlets_commute(self): freqorder_ab = dnmr_two_singlets(165.00, 135.00, 1.50, 2.50, 0.50, 0.75) freqorder_ba = dnmr_two_singlets(135.00, 165.00, 1.50, 0.50, 2.50, 0.25) popplot(*freqorder_ab) popplot(*freqorder_ba) np.testing.assert_array_almost_equal(freqorder_ab, freqorder_ba)
def test_DnmrTwoSinglets_frequencies_commute(): ab = DnmrTwoSinglets(165.00, 135.00, 1.50, 2.50, 0.50, 0.75) ba = DnmrTwoSinglets(135.00, 165.00, 1.50, 0.50, 2.50, 0.25) ab_spec = ab.lineshape() # doing this saves a function call (faster test) ba_spec = ba.lineshape() popplot(*ab_spec) popplot(*ba_spec) np.testing.assert_array_almost_equal(ab_spec, ba_spec)
def test_dnmr_AB_frequencies_commute(): freqorder_ab = dnmr_AB(165.00, 135.00, 12.00, 12.00, 0.50, limits=(215, 85), points=800) freqorder_ba = dnmr_AB(135.00, 165.00, 12.00, 12.00, 0.50) popplot(*freqorder_ab) popplot(*freqorder_ba) np.testing.assert_array_almost_equal(freqorder_ab, freqorder_ba)
def test_two_spin_slow_exchange(): spectrum = TWOSPIN_SLOW peaks = get_maxima(spectrum) print("Maxima: ", peaks) args = (165, 135, 1.5, 0.5, 0.5, 0.5) x = np.linspace(85, 215, 800) y = two_spin(x, *args) popplot(x, y) for peak in peaks: print('Testing vs. accepted peak at: ', peak) calculated_intensity = two_spin(peak[0], *args) print('i.e. input of frequency ', peak[0], ' should give output of ' 'intensity ', peak[1]) print('Calculated intensity is actually: ', calculated_intensity) np.testing.assert_almost_equal(calculated_intensity, peak[1])
def test_TwoSinglets_slow_exchange(): spectrum = TWOSPIN_SLOW peaks = get_maxima(spectrum) print("Maxima: ", peaks) Simulation = TwoSinglets(165, 135, 1.5, 0.5, 0.5, 50) popplot(*Simulation.spectrum()) print('Testing intensity calculator on 135: ', Simulation.intensity(135)) print('Testing intensity calculator on 165: ', Simulation.intensity(165)) for peak in peaks: print('Testing vs. accepted peak at: ', peak) calculated_intensity = Simulation.intensity(peak[0]) print('i.e. input of frequency ', peak[0], ' should give output of ' 'intensity ', peak[1]) print('Calculated intensity is actually: ', calculated_intensity) np.testing.assert_almost_equal(calculated_intensity, peak[1])
def test_d2s_func_slow_exchange(): spectrum = TWOSPIN_SLOW peaks = get_maxima(spectrum) print("Maxima: ", peaks) intensity_calculator = d2s_func(165, 135, 1.5, 0.5, 0.5, 0.5) x = np.linspace(85, 215, 800) y = intensity_calculator(x) popplot(x, y) print('Testing intensity calculator on 135: ', intensity_calculator(135)) print('Testing intensity calculator on 165: ', intensity_calculator(165)) for peak in peaks: print('Testing vs. accepted peak at: ', peak) calculated_intensity = intensity_calculator(peak[0]) print('i.e. input of frequency ', peak[0], ' should give output of ' 'intensity ', peak[1]) print('Calculated intensity is actually: ', calculated_intensity) np.testing.assert_almost_equal(calculated_intensity, peak[1])
def test_DnmrTwoSinglets_fastexchange(): sim = DnmrTwoSinglets(165, 135, 1000, 0.5, 0.5, 0.5) assert np.allclose(sim.lineshape(), TWOSPIN_FAST) popplot(*sim.lineshape())
def test_DnmrTwoSinglets_coalesce(): sim = DnmrTwoSinglets(165, 135, 65.9, 0.5, 0.5, 0.5) assert np.allclose(sim.lineshape(), TWOSPIN_COALESCE) popplot(*sim.lineshape())
def test_DnmrTwoSinglets_slow_exchange(): sim = DnmrTwoSinglets(165, 135, 1.5, 0.5, 0.5, 0.5) assert np.allclose(sim.lineshape(), TWOSPIN_SLOW) popplot(*sim.lineshape())
def test_dnmrplot_AB_frequencies_commute(): freqorder_ab = dnmrplot_AB(165.00, 135.00, 12.00, 12.00, 0.50) freqorder_ba = dnmrplot_AB(135.00, 165.00, 12.00, 12.00, 0.50) popplot(*freqorder_ab) popplot(*freqorder_ba) np.testing.assert_array_almost_equal(freqorder_ab, freqorder_ba)