Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow integer values where doubles are expected in NEST #2009

Closed
heplesser opened this issue Apr 13, 2021 · 0 comments · Fixed by #2024
Closed

Allow integer values where doubles are expected in NEST #2009

heplesser opened this issue Apr 13, 2021 · 0 comments · Fixed by #2024
Assignees
Labels
good first issue Good for newcomers I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation
Projects
Milestone

Comments

@heplesser
Copy link
Contributor

heplesser commented Apr 13, 2021

Is your feature request related to a problem? Please describe.

NEST does not convert integers to doubles even in cases where this would be unproblematic. The only exception is the Simulate call. Furthermore, the error message emitted if users use integers where double is required is often difficult to comprehend because it does not indicate which entry in a dictionary causes the error, as in this example from the NEST Mailing list:

 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')

where the problem lies with the integer values for extent.

Describe the solution you'd like

  1. NEST should silently convert integers to doubles in keeping with rules for most common programming languages.
  2. We should consider whether to accept integer-values doubles where integers are expected (e.g., receptor types)
  3. When a type error message is emitted while reading a dictionary entry, the name of the entry should be included in the error message.
@heplesser heplesser added T: Enhancement New functionality, model or documentation S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) good first issue Good for newcomers labels Apr 13, 2021
@heplesser heplesser added this to To do (open issues) in Kernel via automation Apr 13, 2021
@heplesser heplesser added this to the NEST 3.1 milestone Jun 30, 2021
Kernel automation moved this from To do (open issues) to Done (PRs and issues) Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation
Projects
Kernel
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants