Exemplo n.º 1
0
def test_DmrTwoSinglets_pa():
    sim = DnmrTwoSinglets(165, 135, 1.5, 0.5, 0.5, 0.5)
    sim.pa = 0.75
    assert sim.pa == 0.75
    with pytest.raises(ValueError):
        sim.pa = -0.00000000001
    with pytest.raises(ValueError):
        sim.pa = 1.00000000001
Exemplo n.º 2
0
def test_DnmrTwoSinglets_properties():
    sim = DnmrTwoSinglets(1, 2, 3, 4, 5, 0.6, (7, 8))
    sim.va = 165.0
    sim.vb = 135.0
    sim.k = 1.5
    sim.wa = 0.5
    sim.wb = 0.5
    sim.pa = 0.5
    sim.limits = (85.0, 215.0)
    sim_args = (sim.va, sim.vb, sim.k, sim.wa, sim.wb, sim.pa, sim.limits)
    print('result: ', sim_args)
    assert sim_args == (165.0, 135.0, 1.5, 0.5, 0.5, 0.5, (85.0, 215.0))
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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())
Exemplo n.º 5
0
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())
Exemplo n.º 6
0
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())
Exemplo n.º 7
0
def test_DnmrTwoSinglets_limit_error(limits):
    with pytest.raises((AttributeError, TypeError, ValueError)):
        sim = DnmrTwoSinglets(limits=limits)
        assert sim
Exemplo n.º 8
0
def test_DnmrTwoSinglets_instantiates():
    args = (165, 135, 1.5, 0.5, 0.5, 0.5, (215, 85))
    sim = DnmrTwoSinglets(*args)
    expected_args = (165, 135, 1.5, 0.5, 0.5, (85, 215))
    actual_args = (sim.va, sim.vb, sim.k, sim.wa, sim.wb, sim.limits)
    assert expected_args == actual_args
Exemplo n.º 9
0
def test_DnmrTwoSinglets_limits():
    sim = DnmrTwoSinglets(165, 135, 1.5, 0.5, 0.5, 0.5)
    sim.limits = (500, 0)
    assert sim.limits == (0, 500)