nest / nestml

A domain specific language for neuron and synapse models in spiking neural network simulation
GNU General Public License v2.0
46 stars 45 forks source link

elif language construct is not working #949

Closed max-talanov closed 1 year ago

max-talanov commented 1 year ago

Dear developers. I'm trying to extend nest with muscle model. Unfortunately I have hit the problem that if i use elif nestml language construct the compilation process crashes with the following error message: File "/home/max/.local/lib/python3.10/site-packages/NESTML-5.3.0.post0.dev0-py3.10.egg/pynestml/cocos/co_co_user_defined_function_correctly_defined.py", line 67, in check_co_co cls.check_return_recursively(symbol.get_return_type(), File "/home/max/.local/lib/python3.10/site-packages/NESTML-5.3.0.post0.dev0-py3.10.egg/pynestml/cocos/co_co_user_defined_function_correctly_defined.py", line 142, in check_return_recursively cls.__check_return_recursively(type_symbol, else_ifs.get_block().get_stmt(), ret_defined) AttributeError: 'ASTBlock' object has no attribute 'get_stmt'. Did you mean: 'get_stmts'?

If I use nested ifs then compilation works fine. Thank you so much in advance.

pnbabu commented 1 year ago

@max-talanov are you referring to the elif block in the update block?

# sending spikes: crossing 0 mV, pseudo-refractoriness and local maximum...
        if n_r > 0: # is refractory?
            n_r -= 1
        elif V_m > 0 mV and U_old > V_m: # threshold && maximum
            n_r = RefractoryCounts
            emit_spike()

Please provide the example code where elif doesn't work for you.

max-talanov commented 1 year ago

I have created the file to reproduce an error please see line 359: https://github.com/max-talanov/bypass/blob/main/nestML/muscle/nestmlmodule/hh_moto_5ht_muscle.nestml#L359

pnbabu commented 1 year ago

@max-talanov This was a typo in the function name and apparently, none of our tests caught it. Thank you for pointing this out. I have fixed this also in #950.

max-talanov commented 1 year ago

@pnbabu thank you so much!

clinssen commented 1 year ago

Fixed in #950.