-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full Integration Tests #295
base: dev
Are you sure you want to change the base?
Changes from 6 commits
50c7511
32f7f7b
6c92296
6d28fc2
21bb203
ca59500
8a776fc
83bb7bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import easyvvuq as uq | ||
import chaospy as cp | ||
import os | ||
import sys | ||
Check notice Code scanning / CodeQL Unused import Note test
Import of 'sys' is not used.
|
||
import pytest | ||
import itertools | ||
import tempfile | ||
|
||
@pytest.mark.parametrize( | ||
'encoder,decoder,sampler_analysis', | ||
itertools.product( | ||
[uq.encoders.GenericEncoder( | ||
template_fname='tests/cooling/cooling.template', | ||
delimiter='$', | ||
target_filename='cooling_in.json')], | ||
[uq.decoders.SimpleCSV( | ||
target_filename='output.csv', | ||
output_columns=['te']), | ||
uq.decoders.JSONDecoder( | ||
target_filename='output.json', | ||
output_columns=['te'])], | ||
[(uq.sampling.PCESampler, uq.analysis.PCEAnalysis), | ||
(uq.sampling.SCSampler, uq.analysis.SCAnalysis), | ||
(lambda vary: uq.sampling.QMCSampler(vary, 25), uq.analysis.QMCAnalysis)])) | ||
def test_full_campaign(encoder, decoder, sampler_analysis): | ||
with tempfile.TemporaryDirectory() as tmp_path: | ||
params = { | ||
"temp_init": { | ||
"type": "float", | ||
"min": 0.0, | ||
"max": 100.0, | ||
"default": 95.0}, | ||
"kappa": { | ||
"type": "float", | ||
"min": 0.0, | ||
"max": 0.1, | ||
"default": 0.025}, | ||
"t_env": { | ||
"type": "float", | ||
"min": 0.0, | ||
"max": 40.0, | ||
"default": 15.0}, | ||
"out_file": { | ||
"type": "string", | ||
"default": "output.csv" | ||
} | ||
} | ||
vary = { | ||
"kappa": cp.Uniform(0.025, 0.075), | ||
"t_env": cp.Uniform(15, 25) | ||
} | ||
sampler, analysis = sampler_analysis | ||
sampler = sampler(vary) | ||
analysis = analysis(sampler, qoi_cols=['te']) | ||
actions = uq.actions.ExecuteLocal("tests/cooling/cooling_model.py cooling_in.json") | ||
campaign = uq.Campaign( | ||
name='test_campaign', work_dir=tmp_path, db_location='sqlite:///:memory:') | ||
campaign.add_app(name='test_app', | ||
params=params, | ||
encoder=encoder, | ||
decoder=decoder) | ||
Comment on lines
+58
to
+61
Check failure Code scanning / CodeQL Wrong name for an argument in a call Error test
Keyword argument 'encoder' is not a supported parameter name of
method Campaign.add_app Error loading related location Loading Keyword argument 'decoder' is not a supported parameter name of method Campaign.add_app Error loading related location Loading |
||
campaign.set_app('test_app') | ||
campaign.set_sampler(sampler) | ||
campaign.draw_samples() | ||
campaign.populate_runs_dir() | ||
campaign.apply_for_each_run_dir(actions) | ||
campaign.collate() | ||
df = campaign.get_collation_result() | ||
result = analysis.analyse(df) | ||
Check notice Code scanning / CodeQL Unused local variable Note test
Variable result is not used.
|
||
|
Check notice
Code scanning / CodeQL
Unused import Note test