From e2473ab25cbce8448835d81282a2c6584323de3e Mon Sep 17 00:00:00 2001 From: Bartosz Bosak Date: Wed, 7 Dec 2022 11:26:41 +0100 Subject: [PATCH 1/4] removed 2020-resolver thus switching to default --- .github/workflows/benchmark.yml | 2 +- .github/workflows/coveralls.yml | 2 +- .github/workflows/pdocs.yml | 2 +- .github/workflows/python-package.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 01f974be7..18872a9f9 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,7 +24,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install pytest - if [ -f requirements.txt ]; then pip install --use-feature=2020-resolver -r requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py develop pip install pytest-benchmark - name: Benchmark with pytest diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index a6e7b118d..08b4c4511 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -27,7 +27,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install --use-feature=2020-resolver -r requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py develop python setup.py build_cannonsim pip install pytest-cov diff --git a/.github/workflows/pdocs.yml b/.github/workflows/pdocs.yml index 05ec51278..187e9a57b 100644 --- a/.github/workflows/pdocs.yml +++ b/.github/workflows/pdocs.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install --use-feature=2020-resolver -r requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py develop python setup.py build_cannonsim pip install pdoc diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e03334370..f7ad37709 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -27,7 +27,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install --use-feature=2020-resolver -r requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py develop python setup.py build_cannonsim pip install pytest-cov From a24173aaf3b40ee18ea8d51251f48189395ba95c Mon Sep 17 00:00:00 2001 From: Bartosz Bosak Date: Wed, 7 Dec 2022 11:50:55 +0100 Subject: [PATCH 2/4] returning ndarray instead of scalar value --- easyvvuq/analysis/pce_analysis.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/easyvvuq/analysis/pce_analysis.py b/easyvvuq/analysis/pce_analysis.py index e73579a6f..572ac2702 100644 --- a/easyvvuq/analysis/pce_analysis.py +++ b/easyvvuq/analysis/pce_analysis.py @@ -108,15 +108,15 @@ def _describe(self, qoi, statistic): return np.array([v.upper[0] for _, v in enumerate( self.raw_data['output_distributions'][qoi])]) elif statistic == '1%': - return self.raw_data['percentiles'][qoi]['p01'] + return np.array([self.raw_data['percentiles'][qoi]['p01']]) elif statistic == '10%': - return self.raw_data['percentiles'][qoi]['p10'] + return np.array([self.raw_data['percentiles'][qoi]['p10']]) elif statistic == '90%': - return self.raw_data['percentiles'][qoi]['p90'] + return np.array([self.raw_data['percentiles'][qoi]['p90']]) elif statistic == '99%': - return self.raw_data['percentiles'][qoi]['p99'] + return np.array([self.raw_data['percentiles'][qoi]['p99']]) elif statistic == 'median': - return self.raw_data['percentiles'][qoi]['p50'] + return np.array([self.raw_data['percentiles'][qoi]['p50']]) else: try: return self.raw_data['statistical_moments'][qoi][statistic] From 75c411d3400a921cb6027d4eece74e52f7920d10 Mon Sep 17 00:00:00 2001 From: Bartosz Bosak Date: Wed, 7 Dec 2022 13:32:20 +0100 Subject: [PATCH 3/4] fix for vector qois --- easyvvuq/analysis/pce_analysis.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/easyvvuq/analysis/pce_analysis.py b/easyvvuq/analysis/pce_analysis.py index 572ac2702..85ea70f84 100644 --- a/easyvvuq/analysis/pce_analysis.py +++ b/easyvvuq/analysis/pce_analysis.py @@ -108,15 +108,30 @@ def _describe(self, qoi, statistic): return np.array([v.upper[0] for _, v in enumerate( self.raw_data['output_distributions'][qoi])]) elif statistic == '1%': - return np.array([self.raw_data['percentiles'][qoi]['p01']]) + if isinstance(self.raw_data['percentiles'][qoi]['p01'], np.ndarray): + return self.raw_data['percentiles'][qoi]['p01'] + else: + return np.array([self.raw_data['percentiles'][qoi]['p01']]) elif statistic == '10%': - return np.array([self.raw_data['percentiles'][qoi]['p10']]) + if isinstance(self.raw_data['percentiles'][qoi]['p10'], np.ndarray): + return self.raw_data['percentiles'][qoi]['p10'] + else: + return np.array([self.raw_data['percentiles'][qoi]['p10']]) elif statistic == '90%': - return np.array([self.raw_data['percentiles'][qoi]['p90']]) + if isinstance(self.raw_data['percentiles'][qoi]['p90'], np.ndarray): + return self.raw_data['percentiles'][qoi]['p90'] + else: + return np.array([self.raw_data['percentiles'][qoi]['p90']]) elif statistic == '99%': - return np.array([self.raw_data['percentiles'][qoi]['p99']]) + if isinstance(self.raw_data['percentiles'][qoi]['p99'], np.ndarray): + return self.raw_data['percentiles'][qoi]['p99'] + else: + return np.array([self.raw_data['percentiles'][qoi]['p99']]) elif statistic == 'median': - return np.array([self.raw_data['percentiles'][qoi]['p50']]) + if isinstance(self.raw_data['percentiles'][qoi]['p50'], np.ndarray): + return self.raw_data['percentiles'][qoi]['p50'] + else: + return np.array([self.raw_data['percentiles'][qoi]['p50']]) else: try: return self.raw_data['statistical_moments'][qoi][statistic] From 58a213fcc4287eb57cbb1bee9eeb7882341d0781 Mon Sep 17 00:00:00 2001 From: Bartosz Bosak Date: Wed, 11 Jan 2023 10:50:01 +0100 Subject: [PATCH 4/4] remove plotting of 1% and 99% qois when they don't exist --- easyvvuq/analysis/results.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easyvvuq/analysis/results.py b/easyvvuq/analysis/results.py index 98bb5024b..f9e3b8903 100644 --- a/easyvvuq/analysis/results.py +++ b/easyvvuq/analysis/results.py @@ -546,8 +546,9 @@ def plot_moments( self.describe(qoi, 'std'), self.describe(qoi, 'mean') + self.describe(qoi, 'std'), label='std', alpha=alpha) ax.plot(xvalues, self.describe(qoi, 'mean'), label='mean') - ax.plot(xvalues, self.describe(qoi, '1%'), '--', label='1%', color='black') - ax.plot(xvalues, self.describe(qoi, '99%'), '--', label='99%', color='black') + if all(v in self.supported_stats() for v in ['1%', '99%']): + ax.plot(xvalues, self.describe(qoi, '1%'), '--', label='1%', color='black') + ax.plot(xvalues, self.describe(qoi, '99%'), '--', label='99%', color='black') ax.grid(True) if ylabel is None: ax.set_ylabel(qoi)