示例#1
0
def test_invalid_suffix(tmp_path):
    from pylbo.exceptions import InvalidLegolasFile

    parfile = tmp_path / "parfile.par"
    parfile.write_text("content")
    with pytest.raises(InvalidLegolasFile):
        pylbo.load(parfile)
示例#2
0
def ds_test(setup):
    if setup["test_needs_run"]:
        parfile = pylbo.generate_parfiles(
            parfile_dict=setup["config"],
            basename=setup["datfile"].stem,
            output_dir=setup["config"]["output_folder"],
        )
        pylbo.run_legolas(parfile, remove_parfiles=True)
        setup["test_needs_run"] = False
    return pylbo.load(setup["datfile"])
示例#3
0
def _main():
    parser = ArgumentParser()
    parser.add_argument('-i', '--datfile', dest='datfile')
    args = parser.parse_args()
    datfile = args.datfile

    if datfile is None:
        datfile = Path('output/datfile.dat').resolve()
        if not datfile.is_file():
            raise FileNotFoundError(datfile)

    ds = pylbo.load(datfile)
    p2 = pylbo.plot_equilibrium(ds)
    p = pylbo.plot_spectrum(ds)
    p.add_continua()
    p.add_eigenfunctions()
    p.showall()
示例#4
0
def ds_answer(setup):
    return pylbo.load(setup["answer_datfile"])
示例#5
0
def test_load_invalid(datfile_v0, datfile_v1):
    with pytest.raises(ValueError):
        pylbo.load([datfile_v0, datfile_v1])
示例#6
0
def test_invalid_file():
    with pytest.raises(FileNotFoundError):
        pylbo.load("unknown_file")
示例#7
0
def datfile_v1():
    return pylbo.load(utils / "v1_datfile_matrices.dat")
示例#8
0
def datfile_v09():
    return pylbo.load(utils / "v0.9.0_datfile.dat")
示例#9
0
def datfile_v0():
    return pylbo.load(utils / "v0_datfile_efs.dat")