Weight changes during simulation

12 views
Skip to first unread message

Vincent Dumoulin

unread,
May 8, 2025, 12:03:11 PMMay 8
to NetPyNE Q&A forum
Hello,
I'm a beginner, I've been through all the netpyne tuto on youtube but I cannot figure out how to modify weights during the simulation. 
I created a fully connected with weight close to 0, and I want to increase some weights between active cells to underactive cells such that they all fire at a targeted rate.
I have tried with a function grow_connections that I call every 1 second (using sim.runSimWithIntervalFunc) but it does not really have an impact despite telling me it increases the weights.
I then tried using a mod file in which I defined my "homeostatic plasticity" mechanism. But it does work with some flag system so I have to use again a function to detect flags after I create the simulation and I feel like it's always here that the problem happens.

Is there a way to dynamically change the weights only with some .mod file of mechsyn or weightfunction? Such that I can just run the simulation with the usual "sim.createSimulateAnalyze()". Thank you for your help.

Valery Bragin

unread,
May 12, 2025, 2:03:52 PMMay 12
to NetPyNE Q&A forum
Hi Vincent,

Please make sure you're modifying the weights not just in netParams (which no longer has effect once the net is created), but in the actual underlying NetCon objects. For this, you can use sim.net.modifyConns (http://doc.netpyne.org/tutorial.html#tutorial-7-modifying-the-instantiated-network-interactively

The attached code example works for me and generates the following output:

Running with interval func using NEURON for 1000.0 ms...
Weight before:  0.002
Modfying connection parameters...
  Done; connections modification time = 0.01 s.
Weight after:  0.5

Note that I'm printing the weight of NetCon object (obtained by 'hObj'), not of connParams entry.

Hope this helps! If you are already doing it this way and it still fails, please send your code.

Best regards,
Valery

code_example.png
HHTut_raster.png

Vincent Dumoulin

unread,
May 13, 2025, 7:53:17 AMMay 13
to NetPyNE Q&A forum
Hello Valery,

Thank you for your response. Yes that was my mistake. It helped a lot.

All the best,
Vincent

Reply all
Reply to author
Forward
0 new messages