Hello,
I am having a basic problem creating layers with topology (pyhton 3.6 and NEST 2.20.1). It always complains about the dictionary sent to CreateLayer, telling it is a number. The code below correctly prints
<class 'dict'>
but prints this error:
Traceback (most recent call last): File "test/binary_gdf.py", line 9, in <module> kk=tp.CreateLayer({'extent': [1, 1],'rows': 20, 'columns': 20,'elements' : 'izhikevich','edge_wrap':True}) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/topology/hl_api.py", line 650, in CreateLayer return topology_func('{ CreateLayer } Map', specs) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/topology/ll_api.py", line 61, in topology_func return nest.ll_api.sli_func(slifunc, *args) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/ll_api.py", line 182, in sli_func sli_run(slifun) # SLI support code to execute s on args File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/ll_api.py", line 132, in catching_sli_run raise exceptionCls(commandname, message) nest.lib.hl_api_exceptions.TypeMismatch: ('TypeMismatch in CreateLayer_D: Expected datatype: doubletype\nProvided datatype: integertype', 'TypeMismatch', <SLILiteral: CreateLayer_D>, ': Expected datatype: doubletype\nProvided datatype: integertype')
Any help would be nice :-)
Xavier
---- import nest import nest.topology as tp
nest.SetKernelStatus({"overwrite_files": True})
my_dict = {'extent': [1, 1],'rows': 20, 'columns': 20,'elements' : 'izhikevich','edge_wrap':True} print(type(my_dict)) kk=tp.CreateLayer(my_dict)
Hello Xavier,
From a quick look, it seems the problem is the
'extent': [1, 1]
in the dictionary. It should be
'extent': [1.0, 1.0]
NEST does not automatically convert integers to floats (the argument to Simulate is the only exception) and the error message given is indeed not very helpful.
This is really one of the not-so-nice features of NEST and I have created an issue to remind us to do something about it: https://github.com/nest/nest-simulator/issues/2009
Best, Hans Ekkehard
--
Prof. Dr. Hans Ekkehard Plesser Head, Department of Data Science
Faculty of Science and Technology Norwegian University of Life Sciences PO Box 5003, 1432 Aas, Norway
Phone +47 6723 1560 Email hans.ekkehard.plesser@nmbu.no Home http://arken.nmbu.no/~plesser
On 13/04/2021, 01:02, "xotazu@cvc.uab.es" xotazu@cvc.uab.es wrote:
Hello,
I am having a basic problem creating layers with topology (pyhton 3.6 and NEST 2.20.1). It always complains about the dictionary sent to CreateLayer, telling it is a number. The code below correctly prints
<class 'dict'>
but prints this error:
Traceback (most recent call last): File "test/binary_gdf.py", line 9, in <module> kk=tp.CreateLayer({'extent': [1, 1],'rows': 20, 'columns': 20,'elements' : 'izhikevich','edge_wrap':True}) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/topology/hl_api.py", line 650, in CreateLayer return topology_func('{ CreateLayer } Map', specs) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/topology/ll_api.py", line 61, in topology_func return nest.ll_api.sli_func(slifunc, *args) File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/ll_api.py", line 182, in sli_func sli_run(slifun) # SLI support code to execute s on args File "/home/neurobit/local/nest-py3/lib64/python3.6/site-packages/nest/ll_api.py", line 132, in catching_sli_run raise exceptionCls(commandname, message) nest.lib.hl_api_exceptions.TypeMismatch: ('TypeMismatch in CreateLayer_D: Expected datatype: doubletype\nProvided datatype: integertype', 'TypeMismatch', <SLILiteral: CreateLayer_D>, ': Expected datatype: doubletype\nProvided datatype: integertype')
Any help would be nice :-)
Xavier
---- import nest import nest.topology as tp
nest.SetKernelStatus({"overwrite_files": True})
my_dict = {'extent': [1, 1],'rows': 20, 'columns': 20,'elements' : 'izhikevich','edge_wrap':True} print(type(my_dict)) kk=tp.CreateLayer(my_dict) _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
Thank you!
Since you stopped support for python2, I was switching from python2 to python3. After your help, now my code is working flawlesly :-)
Xavier