How to use the easyvvuq.analysis function in easyvvuq

To help you get started, we’ve selected a few easyvvuq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UCL-CCS / EasyVVUQ / tests / test_gauss_fix.py View on Github external
# TODO: Assert no. samples in db = number_of_samples*number_of_replicas

    my_campaign.populate_runs_dir()

    assert(len(my_campaign.get_campaign_runs_dir()) > 0)
    runs_dir = my_campaign.get_campaign_runs_dir()
    assert(os.path.exists(runs_dir))
    assert(os.path.isdir(runs_dir))

    my_campaign.apply_for_each_run_dir(
        uq.actions.ExecuteLocal("tests/gauss/gauss_json.py gauss_in.json"))

    my_campaign.collate()

    # Create a EnsembleBoot analysis element and apply it to the campaign
    stats = uq.analysis.EnsembleBoot(groupby=["mu"], qoi_cols=["Value"])
    my_campaign.apply_analysis(stats)
    print("stats:", my_campaign.get_last_analysis())
github UCL-CCS / EasyVVUQ / tests / test_stochastic_collocation.py View on Github external
def test_lagrange_poly():
    assert(uq.analysis.sc_analysis.lagrange_poly(2.0, [8, 4, 9], 0) == -3.5)
    assert(uq.analysis.sc_analysis.lagrange_poly(2.0, [8, 4, 9], 1) == 2.0999999999999996)
    assert(uq.analysis.sc_analysis.lagrange_poly(2.0, [8, 4, 9], 2) == 2.4000000000000004)
    with pytest.raises(IndexError):
        uq.analysis.sc_analysis.lagrange_poly(2.0, [8, 4, 9], 3)
github UCL-CCS / EasyVVUQ / tests / test_qmc.py View on Github external
number_of_samples=100)

    # Associate the sampler with the campaign
    my_campaign.set_sampler(my_sampler)

    # Will draw all (of the finite set of samples)
    my_campaign.draw_samples()

    my_campaign.populate_runs_dir()
    my_campaign.apply_for_each_run_dir(uq.actions.ExecuteLocal(
        "tests/cooling/cooling_model.py cooling_in.json"))

    my_campaign.collate()

    # Post-processing analysis
    my_analysis = uq.analysis.QMCAnalysis(sampler=my_sampler,
                                          qoi_cols=output_columns)

    my_campaign.apply_analysis(my_analysis)

    results = my_campaign.get_last_analysis()

    # Get Descriptive Statistics
    stats = results['statistical_moments']['te']
    per = results['percentiles']['te']

    return stats, per