suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
146 stars 137 forks source link

NetPyNE v1.0.3 produces different network structure for same seed #719

Closed pgleeson closed 1 year ago

pgleeson commented 1 year ago

Using the same seed for network generation should produce the same set of connections/weights/delays across different versions of NetPyNE presumably.

This script HHSmall.py generates a NetPyNE net and exports it to NeuroML, and has consistently been producing the same connections, but now is producing different delays:

>$ pip install netpyne==1.0.3
...
>$ python HH_export.py 
...
        <projection id="NetConn_PYR_PYR_AMPA" presynapticPopulation="PYR" postsynapticPopulation="PYR" synapse="AMPA">
            <connectionWD id="0" preCellId="../PYR/1/CELL_HH_PYR" postCellId="../PYR/0/CELL_HH_PYR" weight="0.002" delay="12.75675057908854 ms"/>
            <connectionWD id="1" preCellId="../PYR/2/CELL_HH_PYR" postCellId="../PYR/0/CELL_HH_PYR" weight="0.002" delay="12.516664339611445 ms"/>
            <connectionWD id="2" preCellId="../PYR/0/CELL_HH_PYR" postCellId="../PYR/1/CELL_HH_PYR" weight="0.002" delay="12.882266700443374 ms"/>
            <connectionWD id="3" preCellId="../PYR/2/CELL_HH_PYR" postCellId="../PYR/1/CELL_HH_PYR" weight="0.002" delay="14.214732391680146 ms"/>
            <connectionWD id="4" preCellId="../PYR/0/CELL_HH_PYR" postCellId="../PYR/2/CELL_HH_PYR" weight="0.002" delay="14.602870231822557 ms"/>
            <connectionWD id="5" preCellId="../PYR/1/CELL_HH_PYR" postCellId="../PYR/2/CELL_HH_PYR" weight="0.002" delay="11.514025612022943 ms"/>
        </projection>
        <projection id="NetConn_NetStim_bkg_PYR_20_0_AMPA__PYR" presynapticPopulation="Pop_NetStim_bkg_PYR_20_0_AMPA" postsynapticPopulation="PYR" synapse="AMPA">
            <connectionWD id="0" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[0]" postCellId="../PYR/0/CELL_HH_PYR" weight="0.1" delay="13.41088594672948 ms"/>
            <connectionWD id="1" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[1]" postCellId="../PYR/1/CELL_HH_PYR" weight="0.1" delay="9.837649130533066 ms"/>
            <connectionWD id="2" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[2]" postCellId="../PYR/2/CELL_HH_PYR" weight="0.1" delay="10.651358881580792 ms"/>
        </projection>
    </network>

>$ pip install netpyne==1.0.2.1
...

>$ python HH_export.py 

...
        <projection id="NetConn_PYR_PYR_AMPA" presynapticPopulation="PYR" postsynapticPopulation="PYR" synapse="AMPA">
            <connectionWD id="0" preCellId="../PYR/1/CELL_HH_PYR" postCellId="../PYR/0/CELL_HH_PYR" weight="0.002" delay="12.75675057908854 ms"/>
            <connectionWD id="1" preCellId="../PYR/2/CELL_HH_PYR" postCellId="../PYR/0/CELL_HH_PYR" weight="0.002" delay="12.516664339611445 ms"/>
            <connectionWD id="2" preCellId="../PYR/0/CELL_HH_PYR" postCellId="../PYR/1/CELL_HH_PYR" weight="0.002" delay="12.882266700443374 ms"/>
            <connectionWD id="3" preCellId="../PYR/2/CELL_HH_PYR" postCellId="../PYR/1/CELL_HH_PYR" weight="0.002" delay="14.214732391680146 ms"/>
            <connectionWD id="4" preCellId="../PYR/0/CELL_HH_PYR" postCellId="../PYR/2/CELL_HH_PYR" weight="0.002" delay="14.602870231822557 ms"/>
            <connectionWD id="5" preCellId="../PYR/1/CELL_HH_PYR" postCellId="../PYR/2/CELL_HH_PYR" weight="0.002" delay="11.514025612022943 ms"/>
        </projection>
        <projection id="NetConn_NetStim_bkg_PYR_20_0_AMPA__PYR" presynapticPopulation="Pop_NetStim_bkg_PYR_20_0_AMPA" postsynapticPopulation="PYR" synapse="AMPA">
            <connectionWD id="0" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[0]" postCellId="../PYR/0/CELL_HH_PYR" weight="0.1" delay="9.804068700223214 ms"/>
            <connectionWD id="1" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[1]" postCellId="../PYR/1/CELL_HH_PYR" weight="0.1" delay="13.447764532536322 ms"/>
            <connectionWD id="2" preCellId="../Pop_NetStim_bkg_PYR_20_0_AMPA[2]" postCellId="../PYR/2/CELL_HH_PYR" weight="0.1" delay="10.846951113583764 ms"/>
        </projection>
    </network>

The first set of delays are the same, but those in the 2nd projection are different (all values come directly from what's generated by NetPyNE)

salvadord commented 1 year ago

@vvbragin can you please look into this? maybe related to some of the latest changes? thx

vvbragin commented 1 year ago

Hi @pgleeson, thanks for sharing this. I've found out that it is the case only for transition from 1.0.2.1 to later versions, and only for delays of stimSource-stimTargetParams. We had a minor issue in stims generation code, one side effect of which was that it used to re-pick values from random distribution more than once for each stim (so the original value was being overridden by subsequent ones). After we fixed it in 1.0.3, it generates correctly, but this also means the values are different from now on.

@salvadord CC

pgleeson commented 1 year ago

Ok, thanks for this clarification @vvbragin. I'll update my tests to use the latest values and assume those will be generated from this version on.