コード例 #1
0
ファイル: test_optics.py プロジェクト: ParsonsRD/ctapipe
def test_guess_optics():
    od = OpticsDescription.guess(28.0 * u.m)
    od.info()

    assert od.tel_type == 'LST'
    assert od.tel_subtype == ''
    assert od.mirror_type == 'DC'

    with pytest.raises(KeyError):
        OpticsDescription.guess(0 * u.m)  # unknown tel
コード例 #2
0
def test_guess_optics():

    od = OpticsDescription.guess(28.0 * u.m)

    assert od.tel_type == 'LST'
    assert od.tel_subtype == ''
    assert od.mirror_type == 'DC'

    with pytest.raises(KeyError):
        od2 = OpticsDescription.guess(0 * u.m)
コード例 #3
0
ファイル: test_optics.py プロジェクト: ParsonsRD/ctapipe
def test_construct_optics():
    with pytest.raises(ValueError):
        OpticsDescription(mirror_type="DC",
                          tel_type="bad",  # bad value
                          tel_subtype="1M",
                          equivalent_focal_length=10 * u.m)

    with pytest.raises(ValueError):
        OpticsDescription(mirror_type="bad",  # bad value
                          tel_type="MST",
                          tel_subtype="1M",
                          equivalent_focal_length=10 * u.m)

    with pytest.raises(u.UnitsError):
        OpticsDescription.guess(28.0 * u.kg)  # bad unit

    with pytest.raises(TypeError):
        OpticsDescription.guess(28.0)  # not a unit quantity
コード例 #4
0
def test_construct_optics():
    with pytest.raises(ValueError):
        OpticsDescription(
            mirror_type="DC",
            tel_type="bad",  # bad value
            tel_subtype="1M",
            equivalent_focal_length=10 * u.m)

    with pytest.raises(ValueError):
        OpticsDescription(
            mirror_type="bad",  # bad value
            tel_type="MST",
            tel_subtype="1M",
            equivalent_focal_length=10 * u.m)

    with pytest.raises(u.UnitsError):
        OpticsDescription.guess(28.0 * u.kg)  # bad unit

    with pytest.raises(TypeError):
        OpticsDescription.guess(28.0)  # not a unit quantity