コード例 #1
0
def test_fit_data_with_user_training_set():
    tdir = setup_training_set()
    _, name = tempfile.mkstemp(suffix=".cfg", prefix="test_nanite_cli_rate_")
    name = pathlib.Path(name)
    pf = profile.Profile(path=name)
    pf["rating training set"] = tdir
    pf["fit param R value"] = 37.28e-6 / 2
    pout = tempfile.mkdtemp(prefix="test_nanite_cli_rate_ts")
    pout = pathlib.Path(pout)
    rating.fit_perform(path=jpkfile2, path_results=pout, profile_path=name)
    stats = np.loadtxt(pout / "statistics.tsv", skiprows=1, usecols=(1, 2, 3))
    assert np.all(stats[:, 0] == [109, 129, 416])
    assert np.all((3.5 < stats[:, 2]) * (stats[:, 2] < 5))
コード例 #2
0
def test_fit_data_with_zef18():
    _, name = tempfile.mkstemp(suffix=".cfg", prefix="test_nanite_cli_rate_")
    name = pathlib.Path(name)
    pf = profile.Profile(path=name)
    pf["rating training set"] = "zef18"
    pf["weight_cp"] = 2e-6
    pf["fit param R value"] = 137.28e-6 / 2
    pout = tempfile.mkdtemp(prefix="test_nanite_cli_rate_ts")
    pout = pathlib.Path(pout)
    rating.fit_perform(path=jpkfile2, path_results=pout, profile_path=name)
    stats = np.loadtxt(pout / "statistics.tsv", skiprows=1, usecols=(1, 2, 3))
    assert np.all(stats[:, 0] == [109, 129, 416])
    assert stats[0, 2] == 9.5
    assert stats[1, 2] == 2.4
    assert stats[2, 2] == 4.9