コード例 #1
0
ファイル: test_Lysozyme.py プロジェクト: gitter-badger/wepy-1
def test_we(datadir_factory, printer):

    datadir = datadir_factory.mkdatadir(f'../_examples/{EXAMPLE}')

    with chdir(datadir):

        with check:

            printer("running CPU-NoResampler")
            run([
                'python', 'source/we.py', '2', '2', '10', '1', 'CPU',
                'NoResampler'
            ], )

        printer("running CPU-REVOResampler")
        with check:
            print("CPU-REVOResampler")
            run([
                'python', 'source/we.py', '2', '2', '10', '1', 'CPU',
                'REVOResampler'
            ], )

        printer("running CPU-WExploreResampler")
        with check:
            print("CPU_WExploreResampler")
            run([
                'python', 'source/we.py', '2', '2', '10', '1', 'CPU',
                'WExploreResampler'
            ], )
コード例 #2
0
def test_scripts(datadir_factory, printer):

    datadir = datadir_factory.mkdatadir(f'../_examples/{EXAMPLE}')

    with chdir(datadir):

        run(['python', 'source/make_orchestrator.py', '1', '10', '10', '3'], )
コード例 #3
0
def test_chdir_goes_away(workspace):
    os.chdir(workspace.workspace)
    workspace.teardown()
    bindir = os.path.realpath('/bin')
    with cmdline.chdir(bindir):
        assert os.getcwd() == bindir
    assert os.getcwd() == '/'
コード例 #4
0
def test_sim_maker_run(datadir_factory, printer):

    example = "Lennard_Jones_Pair"

    datadir = datadir_factory.mkdatadir(f'../_examples/{example}')

    with chdir(datadir):
        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'Reference', 'NoResampler'],
        )

        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'Reference', 'WExploreResampler'],
        )
        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'Reference', 'REVOResampler'],
        )
        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'CPU', 'NoResampler'],
        )
        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'CPU', 'WExploreResampler'],
        )
        run(['python',
            'source/sim_maker_run.py',
            '2', '100', '10', '1', 'CPU', 'REVOResampler'],
        )
コード例 #5
0
ファイル: test_Lysozyme.py プロジェクト: gitter-badger/wepy-1
def test_runs(datadir_factory, printer):

    datadir = datadir_factory.mkdatadir(f'../_examples/{EXAMPLE}')

    with chdir(datadir):
        run([
            'bash',
            '_tangle_source/run0.bash',
        ], )
コード例 #6
0
def test_readme(datadir_factory):

    datadir = Path(datadir_factory.mkdatadir('../_tangled_docs/README'))

    with chdir(datadir):

        out = run([
            'bash',
            'check_installation.bash',
        ], )
コード例 #7
0
def test_scripts(datadir_factory, printer):

    datadir = datadir_factory.mkdatadir(f'../_examples/{EXAMPLE}')

    with chdir(datadir):

        run(['python', 'source/rw_conventional.py', '1', '10', '10', '3'], )

        run(['python', 'source/rw_revo.py', '1', '10', '10', '3'], )

        run(['python', 'source/rw_wexplore.py', '1', '10', '10', '3'], )
コード例 #8
0
def test_trivial_run(datadir_factory, printer):

    example = "Lennard_Jones_Pair"

    datadir = datadir_factory.mkdatadir(f'../_examples/{example}')

    with chdir(datadir):
        run(['python',
            'source/trivial_run.py',
            ],
        )
コード例 #9
0
def test_reference(datadir_factory):

    datadir = Path(
        datadir_factory.mkdatadir('../_tangled_docs/info/reference'))
    with chdir(datadir):

        out = run([
            'python',
            'decision_fields_0.py',
        ], )

        out = run([
            'python',
            'record_fields_0.py',
        ], )
コード例 #10
0
def test_quick_start(datadir_factory):

    datadir = Path(
        datadir_factory.mkdatadir('../_tangled_docs/info/quick_start'))

    with chdir(datadir):

        out = run([
            'bash',
            'test_drive.bash',
        ], )

        out = run([
            'python',
            'noresampler_example.py',
        ], )

        out = run([
            'bash',
            'noresampler_example.bash',
        ], )
コード例 #11
0
def test_tutorial(datadir_factory, printer):

    tutorial = "data_analysis"

    datadir = datadir_factory.mkdatadir(f'../_tutorials/{tutorial}')

    assert (datadir / "README.ipynb").is_file()
    assert (datadir / "input").is_dir()

    with chdir(datadir):

        run([
            'python',
            '_tangle_source/README.py',
        ], )

        assert (datadir / '_output/results_run1.wepy.h5').exists()
        assert (datadir / '_output/results_run2.wepy.h5').exists()
        assert (datadir / '_output/results_run3.wepy.h5').exists()

        assert (datadir / '_output/lj-pair.pdb').exists()
        assert (datadir / '_output/lj-pair_walker_lineage').exists()
コード例 #12
0
def test_chdir():
    here = os.getcwd()
    bindir = os.path.realpath('/bin')
    with cmdline.chdir(bindir):
        assert os.getcwd() == bindir
    assert os.getcwd() == here
コード例 #13
0
def test_run0(datadir_factory, printer):

    tutorial = "extended_test_drive"

    datadir = datadir_factory.mkdatadir(f'../_tutorials/{tutorial}')

    with chdir(datadir):

        # check that the help message runs

        run([
            'bash',
            '_tangle_source/run-help.bash',
        ], )

        # default Run with WExplore

        run0_out = run([
            'bash',
            '_tangle_source/run0.bash',
        ], )

        with check:
            assert (
                datadir /
                '_tangle_source/expected_run0_ls.txt').read_text() == run0_out

        assert (datadir / '_output/run0/root.wepy.h5').exists()
        assert (datadir / '_output/run0/root.dash.org').exists()
        assert (datadir / '_output/run0/root.init_top.pdb').exists()
        assert (datadir / '_output/run0/root.walkers.dcd').exists()

        # REVO run

        run([
            'bash',
            '_tangle_source/revo_run.bash',
        ], )

        assert (datadir / '_output/revo_run/root.wepy.h5').exists()
        assert (datadir / '_output/revo_run/root.dash.org').exists()
        assert (datadir / '_output/revo_run/root.init_top.pdb').exists()
        assert (datadir / '_output/revo_run/root.walkers.dcd').exists()

        # No run

        run([
            'bash',
            '_tangle_source/no_run.bash',
        ], )

        assert (datadir / '_output/no_run/root.wepy.h5').exists()
        assert (datadir / '_output/no_run/root.dash.org').exists()
        assert (datadir / '_output/no_run/root.init_top.pdb').exists()
        assert (datadir / '_output/no_run/root.walkers.dcd').exists()

        ## analysis

        # part 0
        analysis0_out = run([
            'python',
            '_tangle_source/analysis0.py',
        ], )

        assert (datadir / '_output/run0/traj0.dcd').exists()
        assert (datadir / "_output/run0/last_cycle.dcd").exists()

        with check:
            assert (datadir / '_tangle_source/test_analysis_0.txt').read_text() == \
                analysis0_out.strip()
コード例 #14
0
def test_chdir():
    here = os.getcwd()
    with cmdline.chdir('/bin'):
        assert os.getcwd() == '/bin'
    assert os.getcwd() == here
コード例 #15
0
def test_we_analysis(datadir_factory, printer):

    example = "Lennard_Jones_Pair"

    datadir = datadir_factory.mkdatadir(f'../_examples/{example}')

    printer("Testing from inside test_we_analysis")

    with chdir(datadir):

        printer(f"Datadir: {datadir}")
        printer(f"Current dir: {os.getcwd()}")

        out = run([
            "python",
            "source/we.py",
            "10", '100', "10"])

        printer(out)

        assert (datadir / "_output/we/results.wepy.h5").is_file()
        assert (datadir / "_output/we/wepy.dash.org").is_file()


        out = run([
            "python",
            "source/compute_distance_observable.py",
        ])

        printer(out)

        out = run([
            "python",
            "source/state_network.py",
        ])

        printer(out)

        assert (datadir / "_output/state.dcd").is_file()
        assert (datadir / "_output/random_macrostates.csn.gexf").is_file()



        ### Tangled sources

        out = run([
            "python",
            "_tangle_source/inspect_observable.py",
        ])

        printer(out)

        out = run([
            "bash",
            "./_tangle_source/run0.bash",
        ]
        )

        printer(out)

        out = run([
            "bash",
            "./_tangle_source/run1.bash",
        ]
        )