simetenn / uncertainpy

Uncertainpy: a Python toolbox for uncertainty quantification and sensitivity analysis, tailored towards computational neuroscience.
http://uncertainpy.readthedocs.io
GNU General Public License v3.0
220 stars 50 forks source link

Using Uncertainty Quantification on a Uniform Distribution for Varying Data #63

Open DougRDrake opened 11 months ago

DougRDrake commented 11 months ago

I'm wanting to create a distribution across an imported data set. I try importing the data and creating a chaospy distribution and each point and then passing in these distributions into the parameters functionality like this where eps and eps_double_prime are my imported data: eps_dist = [] eps_double_prime_dist = [] parameters = [] for i in range(len(eps)): eps_dist.append(cp.Uniform(0.9eps[i], 1.1eps[i])) eps_double_prime_dist.append(cp.Uniform(0.8eps_double_prime[i], 1.2eps_double_prime[i])) parameters_dict = {"eps":eps_dist[i],"eps_double_prime":eps_double_prime_dist[i]} #defining parameters for uncertainpy parameters.append(parameters_dict) parameters = un.Parameters(parameters)

Whenever I do this I'm given a "key error 1:" at line 216 in the parameters.py source code. un.Parameters works if I pass in single inputs from the parameters dictionary ie. parameters = un.Parameters(parameters[i]), but I want to pass the whole list into Uncertainty Quantification. Is there a way I can do this or do I have to pass each of the parameters from the dictionary in one at a time and then stitch the results together using other data tools in python?

Thanks for the help and I can clarify anything if you ask.