SmokinCaterpillar / pypet

The new python parameter exploration toolbox. pypet manages exploration of the parameter space and data storage into HDF5 files for you.
BSD 3-Clause "New" or "Revised" License
89 stars 22 forks source link

type error between original vs new type #67

Closed Lakshya3141 closed 1 year ago

Lakshya3141 commented 1 year ago

I am sorry if this is relatively simple, but I have been trying to solve this for a while.

So I add the variable "sig_u" using the following line in the add_parameters() function: -> traj.f_add_parameter('com.sig_u', np.sqrt(10.0), comment='Utilisation curve variance')

And then subsequently try to explore the parameter using the line: -> explore_dict = {'sig_u': np.arange(8.0, 21.0, 2.0).tolist(), 'a0': [np.array([i, j]) for i in ra0 for j in ra0]}
-> explore_dict = cartesian_product(explore_dict, ('sig_u', 'a0')) -> # ra0 is a list here to explore all desirable combinations of parameter a0

I always get the error image

I have tried changing the data type by changing the .dtype parameter to "np.float64" in np.arange(), however I still get the same error. Tried a bunch of other stuff too, could you please help me out? In my knowledge, np.arang(8.0, 21.0, 2.0) should automatically have the class type float64.

Lakshya3141 commented 1 year ago

I got it to work by adding the default value of the parameter as np.sqrt(10.0).item(), which convert the "numpy float 64" class to the native python class "float".