Closed maciej-jedynak closed 6 years ago
This happens when returning a list of spiketrains (and using ignore=True
otherwise the code will raise an error elsewhere), and when not using the NestModel
class.
The model evaluations (the spiketrains) are then not regular, and are are therefore a numpy object array. numpy.isnan
does not work for such object arrays, nor can such arrays be saved as hdf5 files.
You can try to remove the model evaluations before saving by:
data = UQ.quantify(save=False)
data["name_of_your_model"].evaluations = np.nan
data.save("filename")
I will figure out a proper fix for how to either properly ignore the model evaluations, or creating a regular result of a list of general spiketrains (from for example Brian)
This is fixed in v0.9.3, along with proper handling of model.ignore
and ability to save irregular and empty results.
Spike train [[19.700000000000003, 22.0, 24.7, 28.200000000000003, 30.500000000000004, 32.4, 34.2, 36.1, 38.0, 49.9], [12.5, 14.8, 17.5, 21.0, 23.1, 25.7, 27.6, 29.5, 31.400000000000002, 47.300000000000004, 48.9], [15.5, 17.9, 20.6, 24.0, 30.3], [], [], [28.200000000000003, 30.500000000000004, 33.2, 36.7, 42.800000000000004], [8.1, 10.200000000000001, 12.0, 13.7, 15.4, 17.6, 19.5, 21.400000000000002, 23.700000000000003, 26.3, 29.400000000000002, 33.9, 36.2, 38.3, 40.199999999999996, 42.1], [20.3, 22.3, 24.099999999999998, 25.8, 27.6, 29.5, 31.400000000000002, 39.199999999999996, 41.5, 43.4, 45.3, 47.199999999999996, 49.2], [13.5, 15.8, 18.6, 22.1], [8.1, 10.100000000000001, 12.0, 13.7, 15.4, 17.6, 19.5, 21.400000000000002, 23.700000000000003, 26.3, 29.400000000000002, 33.9, 36.2, 38.3, 40.199999999999996, 42.1], [], [25.7, 28.0, 30.7, 34.2, 40.400000000000006], [7.800000000000001, 10.0, 11.9, 13.600000000000001, 19.3, 34.9, 37.1, 39.300000000000004, 41.2, 43.1, 45.00000000000001, 46.8, 48.6], [20.0, 22.1, 24.0, 26.0, 28.200000000000003, 30.0, 31.900000000000006, 33.800000000000004, 35.6, 41.6, 43.9, 46.3, 49.1], [7.5, 9.9, 11.799999999999999, 13.9, 16.400000000000002, 19.200000000000003, 23.0], [28.5, 30.6, 32.5, 34.5, 36.7, 38.5, 40.699999999999996, 42.9, 44.8, 47.199999999999996, 49.800000000000004]] Running model: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 22/22 [02:07<00:00, 5.81s/it] ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at http://groups.google.com/group/brian-development/, or to the issue tracker at https://github.com/brian-team/brian2/issues. Please include this file with debug information in your report: /tmp/brian_debug_sRAD4V.log Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_LTQpab.py Thanks! [brian2] Traceback (most recent call last): File "ntwk_sim_demo_un_NetworkFeatures.py", line 307, in
data = UQ.quantify()
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/uncertainty.py", line 372, in quantify
custom_kwargs)
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/uncertainty.py", line 636, in polynomial_chaos
custom_kwargs
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/uncertainty_calculations.py", line 1219, in polynomial_chaos
allow_incomplete=allow_incomplete)
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/uncertainty_calculations.py", line 518, in create_PCE_collocation
data = self.runmodel.run(nodes, uncertain_parameters)
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/run_model.py", line 498, in run
data = self.results_to_data(results)
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/run_model.py", line 221, in results_to_data
results = self.regularize_nan_results(results)
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/run_model.py", line 590, in regularize_nan_results
results = regularize(results, "values")
File "/home/maciek/anaconda3/envs/HH_MF/lib/python2.7/site-packages/uncertainpy/core/run_model.py", line 577, in regularize
if not np.all(np.isnan(values)):
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''