Beispiel #1
0
def test_dump_instrument(tmpdir):
    tmpdir.chdir()

    tool = DumpInstrumentTool(
        infile=get_dataset_path("gamma_test_large.simtel.gz"), )

    tool.run(argv=[])

    print(tmpdir.listdir())
    assert tmpdir.join('FlashCam.camgeom.fits.gz').exists()
Beispiel #2
0
def test_dump_instrument(tmpdir):
    sys.argv = ['dump_instrument']
    tmpdir.chdir()

    tool = DumpInstrumentTool(
        infile=get_dataset_path("gamma_test_large.simtel.gz"),
    )

    tool.run(argv=[])

    print(tmpdir.listdir())
    assert tmpdir.join('FlashCam.camgeom.fits.gz').exists()
Beispiel #3
0
def test_dump_instrument(tmpdir):
    from ctapipe.tools.dump_instrument import DumpInstrumentTool

    sys.argv = ['dump_instrument']
    tmpdir.chdir()

    tool = DumpInstrumentTool(infile=GAMMA_TEST_LARGE, )

    tool.run(argv=[])

    print(tmpdir.listdir())
    assert tmpdir.join('FlashCam.camgeom.fits.gz').exists()
Beispiel #4
0
def test_dump_instrument(tmpdir):
    from ctapipe.tools.dump_instrument import DumpInstrumentTool

    sys.argv = ['dump_instrument']
    tmpdir.chdir()

    tool = DumpInstrumentTool(
        infile=GAMMA_TEST_LARGE,
    )

    tool.run(argv=[])

    print(tmpdir.listdir())
    assert tmpdir.join('FlashCam.camgeom.fits.gz').exists()

    with pytest.raises(SystemExit):
        tool.run(['--help-all'])
Beispiel #5
0
def test_dump_instrument(tmpdir):
    from ctapipe.tools.dump_instrument import DumpInstrumentTool

    sys.argv = ["dump_instrument"]
    tmpdir.chdir()

    tool = DumpInstrumentTool(infile=GAMMA_TEST_LARGE, )

    assert run_tool(tool) == 0
    assert tmpdir.join("FlashCam.camgeom.fits.gz").exists()
    assert run_tool(tool, ["--help-all"]) == 0
Beispiel #6
0
def test_dump_instrument(tmpdir):
    from ctapipe.tools.dump_instrument import DumpInstrumentTool

    sys.argv = ["dump_instrument"]
    tmpdir.chdir()

    tool = DumpInstrumentTool()

    assert run_tool(tool, [f"--infile={GAMMA_TEST_LARGE}"]) == 0
    assert tmpdir.join("FlashCam.camgeom.fits.gz").exists()

    assert run_tool(tool, [f"--infile={GAMMA_TEST_LARGE}", "--format=ecsv"]) == 0
    assert tmpdir.join("MonteCarloArray.optics.ecsv.txt").exists()

    assert run_tool(tool, [f"--infile={GAMMA_TEST_LARGE}", "--format=hdf5"]) == 0
    assert tmpdir.join("subarray.h5").exists()

    assert run_tool(tool, ["--help-all"]) == 0
Beispiel #7
0
def test_dump_instrument(tmp_path):
    from ctapipe.tools.dump_instrument import DumpInstrumentTool

    sys.argv = ["dump_instrument"]
    tool = DumpInstrumentTool()

    assert run_tool(tool, [f"--input={GAMMA_TEST_LARGE}"], cwd=tmp_path) == 0
    assert (tmp_path / "FlashCam.camgeom.fits.gz").exists()

    assert (run_tool(tool, [f"--input={GAMMA_TEST_LARGE}", "--format=ecsv"],
                     cwd=tmp_path) == 0)
    assert (tmp_path / "MonteCarloArray.optics.ecsv.txt").exists()

    assert (run_tool(tool, [f"--input={GAMMA_TEST_LARGE}", "--format=hdf5"],
                     cwd=tmp_path) == 0)
    assert (tmp_path / "subarray.h5").exists()

    assert run_tool(tool, ["--help-all"], cwd=tmp_path) == 0
Beispiel #8
0
def test_optics_from_dump_instrument():
    # test with file written by dump-instrument

    svc_path_before = os.getenv("CTAPIPE_SVC_PATH")
    cwd = os.getcwd()

    with tempfile.TemporaryDirectory() as tmp_dir:
        os.chdir(tmp_dir)
        os.environ["CTAPIPE_SVC_PATH"] = tmp_dir

        infile = get_dataset_path("gamma_test_large.simtel.gz")
        run_tool(DumpInstrumentTool(), [f"--input={infile}", "--format=ecsv"])

        lst = OpticsDescription.from_name("LST_LST_LSTCam",
                                          "MonteCarloArray.optics")
        assert lst.num_mirrors == 1
        assert lst.equivalent_focal_length.to_value(u.m) == 28
        assert lst.num_mirror_tiles == 198

    os.chdir(cwd)
    if svc_path_before is None:
        del os.environ["CTAPIPE_SVC_PATH"]
    else:
        os.environ["CTAPIPE_SVC_PATH"] = svc_path_before