Skip to content
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

making the demos all work #99

Merged
merged 9 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UncertainSCI/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def __init__(self, flag=True, lbd=None, loc=None, mean=None,
self.transform_standard_dist_to_poly = AffineTransform(A=A, b=b)

if self.dim == 1:
A = lbd
A = np.array(lbd)
b = -A * loc
self.transform_to_standard = AffineTransform(A=A, b=b)

Expand Down
2 changes: 1 addition & 1 deletion demos/anisotropic_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
model = sine_modulation(N=N)

# Compute PCE (runs model)
lsq_residuals = pce.build_pce_wafp(model)
lsq_residuals = pce.build(model, oversampling=10)

Q = 6 # Number of quantile bands to plot

Expand Down
14 changes: 4 additions & 10 deletions demos/quantiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from UncertainSCI.indexing import TotalDegreeSet
from UncertainSCI.pce import PolynomialChaosExpansion

from UncertainSCI.vis import quantile_plot

# Number of parameters
dimension = 3

Expand Down Expand Up @@ -35,7 +37,7 @@
model = sine_modulation(N=N)

# Compute PCE (runs model)
lsq_residuals = pce.build_pce_wafp(model)
lsq_residuals = pce.build(model)

Q = 6 # Number of quantile bands to plot

Expand All @@ -57,16 +59,8 @@
for j in range(M):
output[j, :] = model(p_phys[j, :])

quantile_plot(pce, bands=3, xvals=x, xlabel='$x$')
plt.plot(x, output[:M, :].T, 'k', alpha=0.8, linewidth=0.2)
plt.plot(x, median, 'b', label='PCE median')

for ind in range(Q):
alpha = (Q-ind) * 1/Q - (1/(2*Q))
plt.fill_between(x, quantiles_lower[ind, :], quantiles_upper[ind, :],
interpolate=True, facecolor='red', alpha=alpha)

plt.xlabel('x')

plt.legend(loc='lower right')

plt.show()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='UncertainSCI',
version='0.2.0-b0',
version='0.2.1-b0',
author='UncertainSCI Developers',
author_email='[email protected]',
packages=find_packages(),
Expand Down