You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to run the coffee cup example with dependant variables. I am passing the dependant distribution to the Uncertainpy as Parameters(distribution=joint_mvNorm), which later fails with an error. I am using the following code:
#!/usr/bin/env python
# coding: utf-8
import uncertainpy as un
import chaospy as cp
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def coffee_cup_dependent(T_env, alpha):
# Initial temperature and time
time = np.linspace(0, 200, 150) # Minutes
T_0 = 95 # Celsius
# The equation describing the model
def f(T, time, alpha, T_env):
return -alpha*(T - T_env)
# Solving the equation by integration.
temperature = odeint(f, T_0, time, args=(alpha, T_env))[:, 0]
# Return time and model results
return time, temperature
model = un.Model(run=coffee_cup_dependent, labels=["Time (min)", "Temperature (C)"])
#alpha, T_env
mean_param = [0.2, 20]
cov_param = [[0.0005, 0.01], [0.01, 1.5]]
joint_mvNorm = cp.MvNormal(mean_param, cov_param)
parameters = un.Parameters(distribution=joint_mvNorm)
# Set up the uncertainty quantification
UQ = un.UncertaintyQuantification(model=model, parameters=parameters)
# Perform the uncertainty quantification using polynomial chaos with point collocation (by default)
data = UQ.quantify(method="pc",
pc_method="collocation",
rosenblatt=True,
uncertain_parameters=None,
polynomial_order=4,
nr_collocation_nodes=None,
quadrature_order=None,
nr_pc_mc_samples=10**4,
nr_mc_samples=10**4,
allow_incomplete=False,
seed=None,
single=False,
plot="condensed_first",
figure_folder="figures",
figureformat=".png",
save=True,
data_folder="data",
filename=None,)
Running the script above produces an error:
Traceback (most recent call last):
File "coffee_cup_dep_ucpy.py", line 92, in <module>
data = UQ.quantify(method="pc",
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/uncertainpy/uncertainty.py", line 415, in quantify
data = self.polynomial_chaos(uncertain_parameters=uncertain_parameters,
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/uncertainpy/uncertainty.py", line 702, in polynomial_chaos
self.data = self.uncertainty_calculations.polynomial_chaos(
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/uncertainpy/core/uncertainty_calculations.py", line 1345, in polynomial_chaos
self.create_PCE_collocation_rosenblatt(uncertain_parameters=uncertain_parameters,
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/uncertainpy/core/uncertainty_calculations.py", line 925, in create_PCE_collocation_rosenblatt
dist_R = cp.J(*dist_R)
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/chaospy/distributions/operators/joint.py", line 54, in __init__
super(J, self).__init__(
File "/Users/Juraj/anaconda3/envs/uncertainpy/lib/python3.9/site-packages/chaospy/distributions/baseclass/distribution.py", line 73, in __init__
assert min(rotation) == 0
ValueError: min() arg is an empty sequence
Hi, I am trying to run the coffee cup example with dependant variables. I am passing the dependant distribution to the Uncertainpy as
Parameters(distribution=joint_mvNorm)
, which later fails with an error. I am using the following code:Running the script above produces an error:
My environment:
The text was updated successfully, but these errors were encountered: