Hi Chris,

Thanks for reporting on this issue. Officially PyNN is not yet fully supported for NESTML, but I'd be happy to use this opportunity to see how far we can get!

For a little bit of background on the error, see here: https://nestml.readthedocs.io/en/latest/running/running_nest.html#dendritic-delay-and-synaptic-weight.

I noticed that inserting the following lines of code just before the return of ``get_synapse_defaults()`` in ``pyNN/nest/synapses.py`` allows your script to run without errors:

   if "w" in default_params and "weight" in default_params: 
       default_params.pop("w") 
   if "d" in default_params and "delay" in default_params: 
       default_params.pop("d")

With this patch in place, could you check whether the script then produces the intended results?

I put Andrew Davison on cc to get his insight into this. The issue is that although NEST has predefined special names like "weight" and "delay", in NESTML you can give these parameters any name. As a result, we generate getters (via NEST ``get_status()``) that return the values under both names. Although the four lines above work for this particular synapse model, it hard-codes the "w" and "d" names, which are actually the ones chosen by the user in the model, so they can be anything in principle. The check for whether they are both being set at the same time is in the generated code, as such:

void noisy_synapse< targetidentifierT >::set_status( const DictionaryDatum& __d,  ConnectorModel& cm )
{
 if (__d->known(nest::noisy_synapse_names::_w) and __d->known(nest::names::weight)) 
 {
   throw BadProperty( "To prevent inconsistencies, please set either 'weight' or 'w' variable; not both at the same time." ); 
 }
 if (__d->known(nest::noisy_synapse_names::_d) and __d->known(nest::names::delay)) 
 {
   throw BadProperty( "To prevent inconsistencies, please set either 'delay' or 'd' variable; not both at the same time." ); 
 }

Would there be a convenient point to record the fact that "for this synapse, 'w' and 'weight' are both aliases for the same parameter"? We could possibly ease the check, so that it's allowed to set both "w" and "weight" at the same time, so long as they are bit-for-bit identical in value.

Thanks in advance for your thoughts!
Charl


On Mon, Sep 16, 2024, at 14:26, Chris Huyck wrote:

I’ve now tried it in pyNN (0.12.3) and get an error

 

nest.lib.hl_api_exceptions.NESTErrors.BadProperty: BadProperty in SLI function SetDefaults_l_D: To prevent inconsistencies, please set either 'weight' or 'w' variable; not both at the same time.

 

When I run anything that connects two neurons with noisy_synapse model.  I tried to change the variable in the noisy_synapse from w to weight, but that failed to build.  I’ve attached the pynn model in case you want to try it  (Just change the .txt suffix to .py).  From the python shell I still get this problem with one_to_one,  all_to_all, and my preferred list_connector projection methods. 

 

I don’t mind contacting the pyNN guys for support from their end, but the w-weight problem seems like you have dependencies built in. 

-Chris

 

From: Charl Linssen <nest-users@turingbirds.com>
Sent: 13 September 2024 15:29
To: users@nest-simulator.org
Subject: [NEST Users] Re: stdp synapse nestml erro

 

Hi Chris,

 

Sorry for the confusion. For NEST synapses, you need to specify a variable in the model that will be treated as a special "synaptic weight" variable (could be a state or a parameter), and another variable that will be treated as "synaptic delay" (can only be a parameter). There is some documentation about this feature on https://nestml.readthedocs.io/en/latest/running/running_nest.html#dendritic-delay-and-synaptic-weight, but the error messages are a bit cryptic. I have filed a pull request to make the errors a bit more user-friendly at https://github.com/nest/nestml/pull/1098. Thanks very much for the feedback and please let us know if you run into any further issues.

 

With kind regards,

Charl

 

On Fri, Sep 13, 2024, at 15:09, Chris Huyck wrote:

It was straight forward to install nestml 8.0.0.  The version is 8.0.0-rc2.  I got the integrate_and_fire_neuron model from the latest models , and that worked.  I then tried a noisy_synapse, and that didn’t work.  Nor did static_synapse or stdp_synapse. 

 

I get a

 

KeyError: ‘static_synapse’

From nest_code_generator.py

delay_variable = self.get_option(“delay_variable”)[synapse_named_stripped]

 

with the error pointing to synapse_name_stripped.  This is the same error I get with the other two synapses.

 

Any thoughts?

-Chris

 

From: Charl Linssen <nest-users@turingbirds.com>
Sent: 24 July 2024 11:17
To: users@nest-simulator.org
Subject: [NEST Users] Re: stdp synapse nestml erro

 



Hi Chris,

 

We have a release candidate out for NESTML 8.0.0, as there were some big changes since the last version, could I ask you to work with that? It should be easy to install using "pip install --pre nestml"; please let us know if you run into any issues.

 

To generate the code for an STDP synapse, you need to tell the code generator that there is one spiking input in the synapse model that should be connected to the postsynaptic partner. Please see here for documentation:

 

 

And see here for a usage example:

 

 

Hope this helps!

 

With kind regards,

Charl

 

 

On Tue, Jul 23, 2024, at 12:16, Chris Huyck wrote:

I’m working with the nestml 7.0.2. I got the example models from https://github.com/nest/nestml/blob/v7.0.2/models/neurons/hill_tononi.nestml this git tree.  I tried three different stdp models including stdp_triplet_naive.nestml. All give

AssertionError: Synapses only support one spiking input port

when I generate_target in python.

 

-Chris

 

_______________________________________________

NEST Users mailing list -- users@nest-simulator.org

To unsubscribe send an email to users-leave@nest-simulator.org

 

 

_______________________________________________

NEST Users mailing list -- users@nest-simulator.org

To unsubscribe send an email to users-leave@nest-simulator.org

 

 

_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org


Attachments: