Skip to content

Commit

Permalink
fix a bug in qmc analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitfold committed Nov 24, 2020
1 parent 93c9927 commit eba0b63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions easyvvuq/analysis/qmc_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def get_samples(self, data_frame):
"""
samples = {k: [] for k in self.qoi_cols}
for run_id in data_frame.run_id.unique():
for run_id in data_frame[('run_id', 0)].unique():
for k in self.qoi_cols:
data = data_frame.loc[data_frame['run_id'] == run_id][k]
data = data_frame.loc[data_frame[('run_id', 0)] == run_id][k]
samples[k].append(data.values)
return samples

Expand Down
10 changes: 6 additions & 4 deletions tests/test_analysis_qmc_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ def test_analyse():
"b": cp.Uniform(0.0, 1.0)
}
sampler = QMCSampler(vary, 100)
samples = []
samples = {('run_id', 0): [], ('a', 0): [], ('b', 0): [], ('a+b', 0): []}
for i, sample in enumerate(sampler):
samples.append(
[i, sample['a'], sample['b'], sample['a'] + sample['b']])
df = pd.DataFrame(samples, columns=['run_id', 'a', 'b', 'a+b'])
samples[('run_id', 0)].append(i)
samples[('a', 0)].append(sample['a'])
samples[('b', 0)].append(sample['b'])
samples[('a+b', 0)].append(sample['a'] + sample['b'])
df = pd.DataFrame(samples)
analysis = QMCAnalysis(sampler)
results = analysis.analyse(df)

Expand Down

0 comments on commit eba0b63

Please sign in to comment.