示例#1
0
def test_atten_finder2():
    d = simulate.find_delta(24000,
                            precise=True,
                            characteristic='atten',
                            verbose=verbose)
    assert 0.0312442 == d['characteristic_value']
    assert 24000.0 == d['closest_energy']
示例#2
0
def test_atten_finder1():
    d = simulate.find_delta("24000",
                            precise=True,
                            data_file='Be_atten.dat',
                            characteristic='atten',
                            verbose=verbose)
    assert 0.0312459 == d['characteristic_value']
    assert 24003.0 == d['closest_energy']
示例#3
0
def test_delta_finder1s():
    d = simulate.find_delta("24000",
                            precise=True,
                            data_file='Be_delta.dat',
                            verbose=verbose)
    assert 5.91145636e-07 == d['characteristic_value']
    assert 24001.0234 == d['closest_energy']
    assert 'file' == d['method']
示例#4
0
def test_calc_ideal_focus1():
    delta = simulate.find_delta(9000, calc_delta=True)['characteristic_value']
    d = simulate.calc_ideal_focus(radius=1.5e-3, n=20, delta=delta, p0=20.0)
    assert round(8.924966829362239, ndigits) == round(d['ideal_focus'],
                                                      ndigits)
    assert round(16.11727331530564, ndigits) == round(d['p1_ideal'], ndigits)
    assert round(36.11727331530564,
                 ndigits) == round(d['p1_ideal_from_source'], ndigits)
示例#5
0
def test_calc_ideal_focus0():
    delta = simulate.find_delta(9000, calc_delta=True)['characteristic_value']
    with pytest.raises(AssertionError):
        simulate.calc_ideal_focus(radius=1.5e-3, n=0, delta=delta, p0=20.0)
示例#6
0
def test_delta_finder3s():
    d = simulate.find_delta("24000", calc_delta=True, verbose=verbose)
    assert 5.908635405401086e-07 == d['characteristic_value']
    assert 24000 == d['closest_energy']
    assert 'calculation' == d['method']
示例#7
0
def test_delta_finder2s():
    d = simulate.find_delta("24000", precise=True, verbose=verbose)
    assert 5.91196169e-07 == d['characteristic_value']
    assert 23999.998 == d['closest_energy']
    assert 'server' == d['method']