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
144 stars 135 forks source link

Fraction approximations for diversity #615

Closed FernandoSBorges closed 2 years ago

FernandoSBorges commented 3 years ago

https://github.com/Neurosim-lab/netpyne/blob/24d1995b518cdb761730fe89a74e49e687c266c8/netpyne/network/network.py#L103

    def _setDiversityRanges(self):
        from .. import sim

        condFracs = {}
        for cellRule in sim.net.params.cellParams.values():
            if 'diversityFraction' in cellRule:
                divFrac = cellRule['diversityFraction']
                cellType = cellRule['conds'].get('cellType', None)
                cellModel = cellRule['conds'].get('CellModel', None)
                pop = cellRule['conds'].get('pop', None)

                if (cellType, cellModel, pop) in condFracs:
                    startFrac = float(condFracs[(cellType, cellModel, pop)])
                    endFrac = startFrac + divFrac
                    cellRule['conds']['fraction'] = [startFrac-1e-12, endFrac-1e-12]
                    condFracs[(cellType, cellModel, pop)] = endFrac
                else:
                    startFrac = 0
                    endFrac = startFrac + divFrac
                    cellRule['conds']['fraction'] = [startFrac, endFrac-1e-12]
                    condFracs[(cellType, cellModel, pop)] = endFrac
vvbragin commented 2 years ago

https://github.com/suny-downstate-medical-center/netpyne/commit/00917331a6869154f160f5a5fd62355a15a6b8c1