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 diff --git a/easyvvuq/analysis/pce_analysis.py b/easyvvuq/analysis/pce_analysis.py index e73579a6f..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 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 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 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 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 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] 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)