repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
Neurosim-lab/netpyne
netpyne/analysis/traces.py
plotTraces
def plotTraces (include = None, timeRange = None, overlay = False, oneFigPer = 'cell', rerun = False, colors = None, ylim = None, axis='on', fontSize=12, figSize = (10,8), saveData = None, saveFig = None, showFig = True): ''' Plot recorded traces - include (['all',|'allCells','allNetStims',|,120,|...
python
def plotTraces (include = None, timeRange = None, overlay = False, oneFigPer = 'cell', rerun = False, colors = None, ylim = None, axis='on', fontSize=12, figSize = (10,8), saveData = None, saveFig = None, showFig = True): ''' Plot recorded traces - include (['all',|'allCells','allNetStims',|,120,|...
[ "def", "plotTraces", "(", "include", "=", "None", ",", "timeRange", "=", "None", ",", "overlay", "=", "False", ",", "oneFigPer", "=", "'cell'", ",", "rerun", "=", "False", ",", "colors", "=", "None", ",", "ylim", "=", "None", ",", "axis", "=", "'on'"...
Plot recorded traces - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of cells for which to plot the recorded traces (default: []) - timeRange ([start:stop]): Time range of spikes shown; if None shows all (default: None) - overlay (True|Fa...
[ "Plot", "recorded", "traces", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "List", "of", "cells", "for", "which",...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/traces.py#L33-L286
Neurosim-lab/netpyne
netpyne/network/conn.py
fullConn
def fullConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells ''' if sim.cfg.verbose: print('Generating set of all-to-all connections (rule: %s) ...' % (connParam['label'])) # get list of params that have a lambda function ...
python
def fullConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells ''' if sim.cfg.verbose: print('Generating set of all-to-all connections (rule: %s) ...' % (connParam['label'])) # get list of params that have a lambda function ...
[ "def", "fullConn", "(", "self", ",", "preCellsTags", ",", "postCellsTags", ",", "connParam", ")", ":", "from", ".", ".", "import", "sim", "if", "sim", ".", "cfg", ".", "verbose", ":", "print", "(", "'Generating set of all-to-all connections (rule: %s) ...'", "%"...
Generates connections between all pre and post-syn cells
[ "Generates", "connections", "between", "all", "pre", "and", "post", "-", "syn", "cells" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L310-L327
Neurosim-lab/netpyne
netpyne/network/conn.py
probConn
def probConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of probabilistic connections (rule: %s) ...' % (connParam['label'])) allRands = self.gen...
python
def probConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of probabilistic connections (rule: %s) ...' % (connParam['label'])) allRands = self.gen...
[ "def", "probConn", "(", "self", ",", "preCellsTags", ",", "postCellsTags", ",", "connParam", ")", ":", "from", ".", ".", "import", "sim", "if", "sim", ".", "cfg", ".", "verbose", ":", "print", "(", "'Generating set of probabilistic connections (rule: %s) ...'", ...
Generates connections between all pre and post-syn cells based on probability values
[ "Generates", "connections", "between", "all", "pre", "and", "post", "-", "syn", "cells", "based", "on", "probability", "values" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L356-L404
Neurosim-lab/netpyne
netpyne/network/conn.py
convConn
def convConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of convergent connections (rule: %s) ...' % (connParam['label'])) # get list ...
python
def convConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of convergent connections (rule: %s) ...' % (connParam['label'])) # get list ...
[ "def", "convConn", "(", "self", ",", "preCellsTags", ",", "postCellsTags", ",", "connParam", ")", ":", "from", ".", ".", "import", "sim", "if", "sim", ".", "cfg", ".", "verbose", ":", "print", "(", "'Generating set of convergent connections (rule: %s) ...'", "%"...
Generates connections between all pre and post-syn cells based on probability values
[ "Generates", "connections", "between", "all", "pre", "and", "post", "-", "syn", "cells", "based", "on", "probability", "values" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L422-L463
Neurosim-lab/netpyne
netpyne/network/conn.py
divConn
def divConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of divergent connections (rule: %s) ...' % (connParam['label'])) # get list of param...
python
def divConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based on probability values''' if sim.cfg.verbose: print('Generating set of divergent connections (rule: %s) ...' % (connParam['label'])) # get list of param...
[ "def", "divConn", "(", "self", ",", "preCellsTags", ",", "postCellsTags", ",", "connParam", ")", ":", "from", ".", ".", "import", "sim", "if", "sim", ".", "cfg", ".", "verbose", ":", "print", "(", "'Generating set of divergent connections (rule: %s) ...'", "%", ...
Generates connections between all pre and post-syn cells based on probability values
[ "Generates", "connections", "between", "all", "pre", "and", "post", "-", "syn", "cells", "based", "on", "probability", "values" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L469-L508
Neurosim-lab/netpyne
netpyne/network/conn.py
fromListConn
def fromListConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based list of relative cell ids''' if sim.cfg.verbose: print('Generating set of connections from list (rule: %s) ...' % (connParam['label'])) orderedPreGids ...
python
def fromListConn (self, preCellsTags, postCellsTags, connParam): from .. import sim ''' Generates connections between all pre and post-syn cells based list of relative cell ids''' if sim.cfg.verbose: print('Generating set of connections from list (rule: %s) ...' % (connParam['label'])) orderedPreGids ...
[ "def", "fromListConn", "(", "self", ",", "preCellsTags", ",", "postCellsTags", ",", "connParam", ")", ":", "from", ".", ".", "import", "sim", "if", "sim", ".", "cfg", ".", "verbose", ":", "print", "(", "'Generating set of connections from list (rule: %s) ...'", ...
Generates connections between all pre and post-syn cells based list of relative cell ids
[ "Generates", "connections", "between", "all", "pre", "and", "post", "-", "syn", "cells", "based", "list", "of", "relative", "cell", "ids" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L514-L549
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
calculateRate
def calculateRate (include = ['allCells', 'eachPop'], peakBin = 5, timeRange = None): ''' Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. ...
python
def calculateRate (include = ['allCells', 'eachPop'], peakBin = 5, timeRange = None): ''' Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. ...
[ "def", "calculateRate", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "peakBin", "=", "5", ",", "timeRange", "=", "None", ")", ":", "from", ".", ".", "import", "sim", "print", "(", "'Calculating avg and peak firing rates ...'", ")", "# ...
Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRange ([st...
[ "Calculate", "avg", "and", "peak", "rate", "of", "different", "subsets", "of", "cells", "for", "specific", "time", "period", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L43-L110
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotRates
def plotRates (include =['allCells', 'eachPop'], peakBin = 5, timeRanges = None, timeRangeLabels = None, colors = None, figSize = ((5,5)), saveData = None, ylim = None, saveFig = None, showFig = True): ''' Calculate avg and peak rate of different subsets of cells for specific time period - inc...
python
def plotRates (include =['allCells', 'eachPop'], peakBin = 5, timeRanges = None, timeRangeLabels = None, colors = None, figSize = ((5,5)), saveData = None, ylim = None, saveFig = None, showFig = True): ''' Calculate avg and peak rate of different subsets of cells for specific time period - inc...
[ "def", "plotRates", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "peakBin", "=", "5", ",", "timeRanges", "=", "None", ",", "timeRangeLabels", "=", "None", ",", "colors", "=", "None", ",", "figSize", "=", "(", "(", "5", ",", "5"...
Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRanges ([[...
[ "Calculate", "avg", "and", "peak", "rate", "of", "different", "subsets", "of", "cells", "for", "specific", "time", "period", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L117-L217
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotSyncs
def plotSyncs (include =['allCells', 'eachPop'], timeRanges = None, timeRangeLabels = None, colors = None, figSize = ((5,5)), saveData = None, saveFig = None, showFig = True): ''' Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','...
python
def plotSyncs (include =['allCells', 'eachPop'], timeRanges = None, timeRangeLabels = None, colors = None, figSize = ((5,5)), saveData = None, saveFig = None, showFig = True): ''' Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','...
[ "def", "plotSyncs", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "timeRanges", "=", "None", ",", "timeRangeLabels", "=", "None", ",", "colors", "=", "None", ",", "figSize", "=", "(", "(", "5", ",", "5", ")", ")", ",", "saveData...
Calculate avg and peak rate of different subsets of cells for specific time period - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRanges ([[...
[ "Calculate", "avg", "and", "peak", "rate", "of", "different", "subsets", "of", "cells", "for", "specific", "time", "period", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L224-L288
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotRaster
def plotRaster (include = ['allCells'], timeRange = None, maxSpikes = 1e8, orderBy = 'gid', orderInverse = False, labels = 'legend', popRates = False, spikeHist=None, spikeHistBin=5, syncLines=False, lw=2, marker='|', markerSize=5, popColors=None, figSize=(10, 8), fontSize=12, dpi = 100, saveData = None...
python
def plotRaster (include = ['allCells'], timeRange = None, maxSpikes = 1e8, orderBy = 'gid', orderInverse = False, labels = 'legend', popRates = False, spikeHist=None, spikeHistBin=5, syncLines=False, lw=2, marker='|', markerSize=5, popColors=None, figSize=(10, 8), fontSize=12, dpi = 100, saveData = None...
[ "def", "plotRaster", "(", "include", "=", "[", "'allCells'", "]", ",", "timeRange", "=", "None", ",", "maxSpikes", "=", "1e8", ",", "orderBy", "=", "'gid'", ",", "orderInverse", "=", "False", ",", "labels", "=", "'legend'", ",", "popRates", "=", "False",...
Raster plot of network cells - include (['all',|'allCells',|'allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to include (default: 'allCells') - timeRange ([start:stop]): Time range of spikes shown; if None shows all (default: None) - maxSpikes (int): maximum number of spikes that ...
[ "Raster", "plot", "of", "network", "cells", "-", "include", "(", "[", "all", "|", "allCells", "|", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Cells", "to", "i...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L295-L549
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotSpikeHist
def plotSpikeHist (include = ['allCells', 'eachPop'], timeRange = None, binSize = 5, overlay=True, graphType='line', yaxis = 'rate', popColors = [], norm = False, dpi = 100, figSize = (10,8), smooth=None, filtFreq = False, filtOrder=3, axis = 'on', saveData = None, saveFig = None, showFig = True, **kwargs): ...
python
def plotSpikeHist (include = ['allCells', 'eachPop'], timeRange = None, binSize = 5, overlay=True, graphType='line', yaxis = 'rate', popColors = [], norm = False, dpi = 100, figSize = (10,8), smooth=None, filtFreq = False, filtOrder=3, axis = 'on', saveData = None, saveFig = None, showFig = True, **kwargs): ...
[ "def", "plotSpikeHist", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "timeRange", "=", "None", ",", "binSize", "=", "5", ",", "overlay", "=", "True", ",", "graphType", "=", "'line'", ",", "yaxis", "=", "'rate'", ",", "popColors", ...
Plot spike histogram - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRange ([start:stop]): Time range of spikes shown; if None shows all (defa...
[ "Plot", "spike", "histogram", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "List", "of", "data", "series", "to", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L556-L730
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotSpikeStats
def plotSpikeStats (include = ['allCells', 'eachPop'], statDataIn = {}, timeRange = None, graphType='boxplot', stats = ['rate', 'isicv'], bins = 50, popColors = [], histlogy = False, histlogx = False, histmin = 0.0, density = False, includeRate0=False, legendLabels = None, normfit = False, ...
python
def plotSpikeStats (include = ['allCells', 'eachPop'], statDataIn = {}, timeRange = None, graphType='boxplot', stats = ['rate', 'isicv'], bins = 50, popColors = [], histlogy = False, histlogx = False, histmin = 0.0, density = False, includeRate0=False, legendLabels = None, normfit = False, ...
[ "def", "plotSpikeStats", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "statDataIn", "=", "{", "}", ",", "timeRange", "=", "None", ",", "graphType", "=", "'boxplot'", ",", "stats", "=", "[", "'rate'", ",", "'isicv'", "]", ",", "bi...
Plot spike histogram - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRange ([start:stop]): Time range of spikes shown; if None shows all (def...
[ "Plot", "spike", "histogram", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "List", "of", "data", "series", "to", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L737-L1084
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
plotRatePSD
def plotRatePSD(include=['allCells', 'eachPop'], timeRange=None, binSize=5, maxFreq=100, NFFT=256, noverlap=128, smooth=0, overlay=True, ylim = None, popColors = {}, fontSize=12, figSize=(10,8), saveData=None, saveFig=None, showFig=True): ''' Plot firing rate power spectral density (PSD) - include...
python
def plotRatePSD(include=['allCells', 'eachPop'], timeRange=None, binSize=5, maxFreq=100, NFFT=256, noverlap=128, smooth=0, overlay=True, ylim = None, popColors = {}, fontSize=12, figSize=(10,8), saveData=None, saveFig=None, showFig=True): ''' Plot firing rate power spectral density (PSD) - include...
[ "def", "plotRatePSD", "(", "include", "=", "[", "'allCells'", ",", "'eachPop'", "]", ",", "timeRange", "=", "None", ",", "binSize", "=", "5", ",", "maxFreq", "=", "100", ",", "NFFT", "=", "256", ",", "noverlap", "=", "128", ",", "smooth", "=", "0", ...
Plot firing rate power spectral density (PSD) - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of data series to include. Note: one line per item, not grouped (default: ['allCells', 'eachPop']) - timeRange ([start:stop]): Time range of spikes show...
[ "Plot", "firing", "rate", "power", "spectral", "density", "(", "PSD", ")", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")"...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L1091-L1239
Neurosim-lab/netpyne
netpyne/support/bsmart.py
timefreq
def timefreq(x,fs=200): """ TIMEFREQ This function takes the time series and the sampling rate and calculates the total number of points, the maximum frequency, the minimum (or change in) frequency, and the vector of frequency points F. Version: 2011may04 """ from numpy import ...
python
def timefreq(x,fs=200): """ TIMEFREQ This function takes the time series and the sampling rate and calculates the total number of points, the maximum frequency, the minimum (or change in) frequency, and the vector of frequency points F. Version: 2011may04 """ from numpy import ...
[ "def", "timefreq", "(", "x", ",", "fs", "=", "200", ")", ":", "from", "numpy", "import", "size", ",", "shape", ",", "arange", ",", "append", "maxfreq", "=", "float", "(", "fs", ")", "/", "2.0", "# Maximum frequency", "minfreq", "=", "float", "(", "fs...
TIMEFREQ This function takes the time series and the sampling rate and calculates the total number of points, the maximum frequency, the minimum (or change in) frequency, and the vector of frequency points F. Version: 2011may04
[ "TIMEFREQ", "This", "function", "takes", "the", "time", "series", "and", "the", "sampling", "rate", "and", "calculates", "the", "total", "number", "of", "points", "the", "maximum", "frequency", "the", "minimum", "(", "or", "change", "in", ")", "frequency", "...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/bsmart.py#L70-L87
Neurosim-lab/netpyne
netpyne/support/bsmart.py
ckchol
def ckchol(M): """ CKCHOL This function computes the Cholesky decomposition of the matrix if it's positive-definite; else it returns the identity matrix. It was written to handle the "matrix must be positive definite" error in linalg.cholesky. Version: 2011may03 """ from numpy ...
python
def ckchol(M): """ CKCHOL This function computes the Cholesky decomposition of the matrix if it's positive-definite; else it returns the identity matrix. It was written to handle the "matrix must be positive definite" error in linalg.cholesky. Version: 2011may03 """ from numpy ...
[ "def", "ckchol", "(", "M", ")", ":", "from", "numpy", "import", "linalg", ",", "matrix", ",", "eye", ",", "size", "try", ":", "# First, try the Cholesky decomposition", "output", "=", "linalg", ".", "cholesky", "(", "M", ")", "except", ":", "# If not, just r...
CKCHOL This function computes the Cholesky decomposition of the matrix if it's positive-definite; else it returns the identity matrix. It was written to handle the "matrix must be positive definite" error in linalg.cholesky. Version: 2011may03
[ "CKCHOL", "This", "function", "computes", "the", "Cholesky", "decomposition", "of", "the", "matrix", "if", "it", "s", "positive", "-", "definite", ";", "else", "it", "returns", "the", "identity", "matrix", ".", "It", "was", "written", "to", "handle", "the", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/bsmart.py#L90-L108
Neurosim-lab/netpyne
netpyne/support/bsmart.py
granger
def granger(vec1,vec2,order=10,rate=200,maxfreq=0): """ GRANGER Provide a simple way of calculating the key quantities. Usage: F,pp,cohe,Fx2y,Fy2x,Fxy=granger(vec1,vec2,order,rate,maxfreq) where: F is a 1xN vector of frequencies pp is a 2xN array of power spectra ...
python
def granger(vec1,vec2,order=10,rate=200,maxfreq=0): """ GRANGER Provide a simple way of calculating the key quantities. Usage: F,pp,cohe,Fx2y,Fy2x,Fxy=granger(vec1,vec2,order,rate,maxfreq) where: F is a 1xN vector of frequencies pp is a 2xN array of power spectra ...
[ "def", "granger", "(", "vec1", ",", "vec2", ",", "order", "=", "10", ",", "rate", "=", "200", ",", "maxfreq", "=", "0", ")", ":", "from", ".", "bsmart", "import", "timefreq", ",", "pwcausalr", "from", "scipy", "import", "array", ",", "size", "if", ...
GRANGER Provide a simple way of calculating the key quantities. Usage: F,pp,cohe,Fx2y,Fy2x,Fxy=granger(vec1,vec2,order,rate,maxfreq) where: F is a 1xN vector of frequencies pp is a 2xN array of power spectra cohe is the coherence between vec1 and vec2 Fx2y i...
[ "GRANGER", "Provide", "a", "simple", "way", "of", "calculating", "the", "key", "quantities", ".", "Usage", ":", "F", "pp", "cohe", "Fx2y", "Fy2x", "Fxy", "=", "granger", "(", "vec1", "vec2", "order", "rate", "maxfreq", ")", "where", ":", "F", "is", "a"...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/bsmart.py#L285-L317
Neurosim-lab/netpyne
netpyne/cell/compartCell.py
CompartCell.getSomaPos
def getSomaPos(self): ''' Get soma position; Used to calculate seg coords for LFP calc (one per population cell; assumes same morphology)''' n3dsoma = 0 r3dsoma = np.zeros(3) for sec in [sec for secName, sec in self.secs.items() if 'soma' in secName]: sec['hObj'].push...
python
def getSomaPos(self): ''' Get soma position; Used to calculate seg coords for LFP calc (one per population cell; assumes same morphology)''' n3dsoma = 0 r3dsoma = np.zeros(3) for sec in [sec for secName, sec in self.secs.items() if 'soma' in secName]: sec['hObj'].push...
[ "def", "getSomaPos", "(", "self", ")", ":", "n3dsoma", "=", "0", "r3dsoma", "=", "np", ".", "zeros", "(", "3", ")", "for", "sec", "in", "[", "sec", "for", "secName", ",", "sec", "in", "self", ".", "secs", ".", "items", "(", ")", "if", "'soma'", ...
Get soma position; Used to calculate seg coords for LFP calc (one per population cell; assumes same morphology)
[ "Get", "soma", "position", ";", "Used", "to", "calculate", "seg", "coords", "for", "LFP", "calc", "(", "one", "per", "population", "cell", ";", "assumes", "same", "morphology", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1209-L1229
Neurosim-lab/netpyne
netpyne/cell/compartCell.py
CompartCell.calcAbsSegCoords
def calcAbsSegCoords(self): ''' Calculate absolute seg coords by translating the relative seg coords -- used for LFP calc''' from .. import sim p3dsoma = self.getSomaPos() pop = self.tags['pop'] morphSegCoords = sim.net.pops[pop]._morphSegCoords # rotated coordinates ar...
python
def calcAbsSegCoords(self): ''' Calculate absolute seg coords by translating the relative seg coords -- used for LFP calc''' from .. import sim p3dsoma = self.getSomaPos() pop = self.tags['pop'] morphSegCoords = sim.net.pops[pop]._morphSegCoords # rotated coordinates ar...
[ "def", "calcAbsSegCoords", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "p3dsoma", "=", "self", ".", "getSomaPos", "(", ")", "pop", "=", "self", ".", "tags", "[", "'pop'", "]", "morphSegCoords", "=", "sim", ".", "net", ".", "pops", "[", ...
Calculate absolute seg coords by translating the relative seg coords -- used for LFP calc
[ "Calculate", "absolute", "seg", "coords", "by", "translating", "the", "relative", "seg", "coords", "--", "used", "for", "LFP", "calc" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1231-L1243
Neurosim-lab/netpyne
netpyne/cell/compartCell.py
CompartCell.setImembPtr
def setImembPtr(self): """Set PtrVector to point to the i_membrane_""" jseg = 0 for sec in list(self.secs.values()): hSec = sec['hObj'] for iseg, seg in enumerate(hSec): self.imembPtr.pset(jseg, seg._ref_i_membrane_) # notice the underscore at the end (i...
python
def setImembPtr(self): """Set PtrVector to point to the i_membrane_""" jseg = 0 for sec in list(self.secs.values()): hSec = sec['hObj'] for iseg, seg in enumerate(hSec): self.imembPtr.pset(jseg, seg._ref_i_membrane_) # notice the underscore at the end (i...
[ "def", "setImembPtr", "(", "self", ")", ":", "jseg", "=", "0", "for", "sec", "in", "list", "(", "self", ".", "secs", ".", "values", "(", ")", ")", ":", "hSec", "=", "sec", "[", "'hObj'", "]", "for", "iseg", ",", "seg", "in", "enumerate", "(", "...
Set PtrVector to point to the i_membrane_
[ "Set", "PtrVector", "to", "point", "to", "the", "i_membrane_" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1245-L1252
Neurosim-lab/netpyne
netpyne/cell/compartCell.py
CompartCell.getImemb
def getImemb(self): """Gather membrane currents from PtrVector into imVec (does not need a loop!)""" self.imembPtr.gather(self.imembVec) return self.imembVec.as_numpy()
python
def getImemb(self): """Gather membrane currents from PtrVector into imVec (does not need a loop!)""" self.imembPtr.gather(self.imembVec) return self.imembVec.as_numpy()
[ "def", "getImemb", "(", "self", ")", ":", "self", ".", "imembPtr", ".", "gather", "(", "self", ".", "imembVec", ")", "return", "self", ".", "imembVec", ".", "as_numpy", "(", ")" ]
Gather membrane currents from PtrVector into imVec (does not need a loop!)
[ "Gather", "membrane", "currents", "from", "PtrVector", "into", "imVec", "(", "does", "not", "need", "a", "loop!", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1255-L1258
Neurosim-lab/netpyne
netpyne/cell/compartCell.py
CompartCell.updateShape
def updateShape(self): """Call after h.define_shape() to update cell coords""" x = self.tags['x'] y = -self.tags['y'] # Neuron y-axis positive = upwards, so assume pia=0 and cortical depth = neg z = self.tags['z'] for sec in list(self.secs.values()): ...
python
def updateShape(self): """Call after h.define_shape() to update cell coords""" x = self.tags['x'] y = -self.tags['y'] # Neuron y-axis positive = upwards, so assume pia=0 and cortical depth = neg z = self.tags['z'] for sec in list(self.secs.values()): ...
[ "def", "updateShape", "(", "self", ")", ":", "x", "=", "self", ".", "tags", "[", "'x'", "]", "y", "=", "-", "self", ".", "tags", "[", "'y'", "]", "# Neuron y-axis positive = upwards, so assume pia=0 and cortical depth = neg", "z", "=", "self", ".", "tags", "...
Call after h.define_shape() to update cell coords
[ "Call", "after", "h", ".", "define_shape", "()", "to", "update", "cell", "coords" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1261-L1277
Neurosim-lab/netpyne
examples/RL_arm/main.py
saveWeights
def saveWeights(sim): ''' Save the weights for each plastic synapse ''' with open(sim.weightsfilename,'w') as fid: for weightdata in sim.allWeights: fid.write('%0.0f' % weightdata[0]) # Time for i in range(1,len(weightdata)): fid.write('\t%0.8f' % weightdata[i]) fid.w...
python
def saveWeights(sim): ''' Save the weights for each plastic synapse ''' with open(sim.weightsfilename,'w') as fid: for weightdata in sim.allWeights: fid.write('%0.0f' % weightdata[0]) # Time for i in range(1,len(weightdata)): fid.write('\t%0.8f' % weightdata[i]) fid.w...
[ "def", "saveWeights", "(", "sim", ")", ":", "with", "open", "(", "sim", ".", "weightsfilename", ",", "'w'", ")", "as", "fid", ":", "for", "weightdata", "in", "sim", ".", "allWeights", ":", "fid", ".", "write", "(", "'%0.0f'", "%", "weightdata", "[", ...
Save the weights for each plastic synapse
[ "Save", "the", "weights", "for", "each", "plastic", "synapse" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/examples/RL_arm/main.py#L127-L134
Neurosim-lab/netpyne
netpyne/specs/utils.py
validateFunction
def validateFunction(strFunc, netParamsVars): ''' returns True if "strFunc" can be evaluated''' from math import exp, log, sqrt, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, pi, e rand = h.Random() stringFuncRandMethods = ['binomial', 'discunif', 'erlang', 'geometric', 'hypergeo', 'lognor...
python
def validateFunction(strFunc, netParamsVars): ''' returns True if "strFunc" can be evaluated''' from math import exp, log, sqrt, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, pi, e rand = h.Random() stringFuncRandMethods = ['binomial', 'discunif', 'erlang', 'geometric', 'hypergeo', 'lognor...
[ "def", "validateFunction", "(", "strFunc", ",", "netParamsVars", ")", ":", "from", "math", "import", "exp", ",", "log", ",", "sqrt", ",", "sin", ",", "cos", ",", "tan", ",", "asin", ",", "acos", ",", "atan", ",", "sinh", ",", "cosh", ",", "tanh", "...
returns True if "strFunc" can be evaluated
[ "returns", "True", "if", "strFunc", "can", "be", "evaluated" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/specs/utils.py#L17-L50
Neurosim-lab/netpyne
netpyne/analysis/network.py
plotConn
def plotConn (includePre = ['all'], includePost = ['all'], feature = 'strength', orderBy = 'gid', figSize = (10,10), groupBy = 'pop', groupByIntervalPre = None, groupByIntervalPost = None, graphType = 'matrix', synOrConn = 'syn', synMech = None, connsFile = None, tagsFile = None, clim = None, fontSize = 12, saveData = ...
python
def plotConn (includePre = ['all'], includePost = ['all'], feature = 'strength', orderBy = 'gid', figSize = (10,10), groupBy = 'pop', groupByIntervalPre = None, groupByIntervalPost = None, graphType = 'matrix', synOrConn = 'syn', synMech = None, connsFile = None, tagsFile = None, clim = None, fontSize = 12, saveData = ...
[ "def", "plotConn", "(", "includePre", "=", "[", "'all'", "]", ",", "includePost", "=", "[", "'all'", "]", ",", "feature", "=", "'strength'", ",", "orderBy", "=", "'gid'", ",", "figSize", "=", "(", "10", ",", "10", ")", ",", "groupBy", "=", "'pop'", ...
Plot network connectivity - includePre (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all']) - includePost (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all']) - feature ('weight'|'...
[ "Plot", "network", "connectivity", "-", "includePre", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Cells", "to", "show", "(", "d...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/network.py#L519-L673
Neurosim-lab/netpyne
netpyne/analysis/network.py
plot2Dnet
def plot2Dnet (include = ['allCells'], figSize = (12,12), view = 'xy', showConns = True, popColors = None, fontSize = 12, tagsFile = None, saveData = None, saveFig = None, showFig = True): ''' Plot 2D representation of network cell positions and connections - include (['all',|'allCells...
python
def plot2Dnet (include = ['allCells'], figSize = (12,12), view = 'xy', showConns = True, popColors = None, fontSize = 12, tagsFile = None, saveData = None, saveFig = None, showFig = True): ''' Plot 2D representation of network cell positions and connections - include (['all',|'allCells...
[ "def", "plot2Dnet", "(", "include", "=", "[", "'allCells'", "]", ",", "figSize", "=", "(", "12", ",", "12", ")", ",", "view", "=", "'xy'", ",", "showConns", "=", "True", ",", "popColors", "=", "None", ",", "fontSize", "=", "12", ",", "tagsFile", "=...
Plot 2D representation of network cell positions and connections - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all']) - showConns (True|False): Whether to show connections or not (default: True) - figSize ((width, height)): Size...
[ "Plot", "2D", "representation", "of", "network", "cell", "positions", "and", "connections", "-", "include", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/network.py#L680-L810
Neurosim-lab/netpyne
netpyne/analysis/network.py
plotShape
def plotShape (includePost = ['all'], includePre = ['all'], showSyns = False, showElectrodes = False, synStyle = '.', synSiz=3, dist=0.6, cvar=None, cvals=None, iv=False, ivprops=None, includeAxon=True, bkgColor = None, fontSize = 12, figSize = (10,8), saveData = None, dpi = 300, saveFig = None, showFig = True): ...
python
def plotShape (includePost = ['all'], includePre = ['all'], showSyns = False, showElectrodes = False, synStyle = '.', synSiz=3, dist=0.6, cvar=None, cvals=None, iv=False, ivprops=None, includeAxon=True, bkgColor = None, fontSize = 12, figSize = (10,8), saveData = None, dpi = 300, saveFig = None, showFig = True): ...
[ "def", "plotShape", "(", "includePost", "=", "[", "'all'", "]", ",", "includePre", "=", "[", "'all'", "]", ",", "showSyns", "=", "False", ",", "showElectrodes", "=", "False", ",", "synStyle", "=", "'.'", ",", "synSiz", "=", "3", ",", "dist", "=", "0....
Plot 3D cell shape using NEURON Interview PlotShape - includePre: (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): List of presynaptic cells to consider when plotting connections (default: ['all']) - includePost: (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2'...
[ "Plot", "3D", "cell", "shape", "using", "NEURON", "Interview", "PlotShape", "-", "includePre", ":", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/network.py#L817-L998
Neurosim-lab/netpyne
netpyne/support/filter.py
bandpass
def bandpass(data, freqmin, freqmax, df, corners=4, zerophase=True): """ Butterworth-Bandpass Filter. Filter data from ``freqmin`` to ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). ...
python
def bandpass(data, freqmin, freqmax, df, corners=4, zerophase=True): """ Butterworth-Bandpass Filter. Filter data from ``freqmin`` to ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). ...
[ "def", "bandpass", "(", "data", ",", "freqmin", ",", "freqmax", ",", "df", ",", "corners", "=", "4", ",", "zerophase", "=", "True", ")", ":", "fe", "=", "0.5", "*", "df", "low", "=", "freqmin", "/", "fe", "high", "=", "freqmax", "/", "fe", "# rai...
Butterworth-Bandpass Filter. Filter data from ``freqmin`` to ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). :type data: numpy.ndarray :param data: Data to filter. :param freqmin:...
[ "Butterworth", "-", "Bandpass", "Filter", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L45-L86
Neurosim-lab/netpyne
netpyne/support/filter.py
bandstop
def bandstop(data, freqmin, freqmax, df, corners=4, zerophase=False): """ Butterworth-Bandstop Filter. Filter data removing data between frequencies ``freqmin`` and ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt...
python
def bandstop(data, freqmin, freqmax, df, corners=4, zerophase=False): """ Butterworth-Bandstop Filter. Filter data removing data between frequencies ``freqmin`` and ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt...
[ "def", "bandstop", "(", "data", ",", "freqmin", ",", "freqmax", ",", "df", ",", "corners", "=", "4", ",", "zerophase", "=", "False", ")", ":", "fe", "=", "0.5", "*", "df", "low", "=", "freqmin", "/", "fe", "high", "=", "freqmax", "/", "fe", "# ra...
Butterworth-Bandstop Filter. Filter data removing data between frequencies ``freqmin`` and ``freqmax`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). :type data: numpy.ndarray :param data: Data ...
[ "Butterworth", "-", "Bandstop", "Filter", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L89-L128
Neurosim-lab/netpyne
netpyne/support/filter.py
lowpass
def lowpass(data, freq, df, corners=4, zerophase=False): """ Butterworth-Lowpass Filter. Filter data removing data over certain frequency ``freq`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). ...
python
def lowpass(data, freq, df, corners=4, zerophase=False): """ Butterworth-Lowpass Filter. Filter data removing data over certain frequency ``freq`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). ...
[ "def", "lowpass", "(", "data", ",", "freq", ",", "df", ",", "corners", "=", "4", ",", "zerophase", "=", "False", ")", ":", "fe", "=", "0.5", "*", "df", "f", "=", "freq", "/", "fe", "# raise for some bad scenarios", "if", "f", ">", "1", ":", "f", ...
Butterworth-Lowpass Filter. Filter data removing data over certain frequency ``freq`` using ``corners`` corners. The filter uses :func:`scipy.signal.iirfilter` (for design) and :func:`scipy.signal.sosfilt` (for applying the filter). :type data: numpy.ndarray :param data: Data to filter. :p...
[ "Butterworth", "-", "Lowpass", "Filter", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L131-L165
Neurosim-lab/netpyne
netpyne/support/filter.py
remez_fir
def remez_fir(data, freqmin, freqmax, df): """ The minimax optimal bandpass using Remez algorithm. (experimental) .. warning:: This is experimental code. Use with caution! :type data: numpy.ndarray :param data: Data to filter. :param freqmin: Low corner frequency. :param freqmax: High corn...
python
def remez_fir(data, freqmin, freqmax, df): """ The minimax optimal bandpass using Remez algorithm. (experimental) .. warning:: This is experimental code. Use with caution! :type data: numpy.ndarray :param data: Data to filter. :param freqmin: Low corner frequency. :param freqmax: High corn...
[ "def", "remez_fir", "(", "data", ",", "freqmin", ",", "freqmax", ",", "df", ")", ":", "# Remez filter description", "# ========================", "#", "# So, let's go over the inputs that you'll have to worry about.", "# First is numtaps. This parameter will basically determine how g...
The minimax optimal bandpass using Remez algorithm. (experimental) .. warning:: This is experimental code. Use with caution! :type data: numpy.ndarray :param data: Data to filter. :param freqmin: Low corner frequency. :param freqmax: High corner frequency. :param df: Sampling rate in Hz. :...
[ "The", "minimax", "optimal", "bandpass", "using", "Remez", "algorithm", ".", "(", "experimental", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L221-L291
Neurosim-lab/netpyne
netpyne/support/filter.py
lowpass_fir
def lowpass_fir(data, freq, df, winlen=2048): """ FIR-Lowpass Filter. (experimental) .. warning:: This is experimental code. Use with caution! Filter data by passing data only below a certain frequency. :type data: numpy.ndarray :param data: Data to filter. :param freq: Data below this fr...
python
def lowpass_fir(data, freq, df, winlen=2048): """ FIR-Lowpass Filter. (experimental) .. warning:: This is experimental code. Use with caution! Filter data by passing data only below a certain frequency. :type data: numpy.ndarray :param data: Data to filter. :param freq: Data below this fr...
[ "def", "lowpass_fir", "(", "data", ",", "freq", ",", "df", ",", "winlen", "=", "2048", ")", ":", "# Source: Travis Oliphant", "# https://mail.scipy.org/pipermail/scipy-user/2004-February/002628.html", "#", "# There is not currently an FIR-filter design program in SciPy. One", "# ...
FIR-Lowpass Filter. (experimental) .. warning:: This is experimental code. Use with caution! Filter data by passing data only below a certain frequency. :type data: numpy.ndarray :param data: Data to filter. :param freq: Data below this frequency pass. :param df: Sampling rate in Hz. :par...
[ "FIR", "-", "Lowpass", "Filter", ".", "(", "experimental", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L294-L333
Neurosim-lab/netpyne
netpyne/support/filter.py
integer_decimation
def integer_decimation(data, decimation_factor): """ Downsampling by applying a simple integer decimation. Make sure that no signal is present in frequency bands above the new Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a lowpass filter beforehand! New sampling rate is o...
python
def integer_decimation(data, decimation_factor): """ Downsampling by applying a simple integer decimation. Make sure that no signal is present in frequency bands above the new Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a lowpass filter beforehand! New sampling rate is o...
[ "def", "integer_decimation", "(", "data", ",", "decimation_factor", ")", ":", "if", "not", "isinstance", "(", "decimation_factor", ",", "int", ")", ":", "msg", "=", "\"Decimation_factor must be an integer!\"", "raise", "TypeError", "(", "msg", ")", "# reshape and on...
Downsampling by applying a simple integer decimation. Make sure that no signal is present in frequency bands above the new Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a lowpass filter beforehand! New sampling rate is old sampling rate divided by decimation_factor. :type dat...
[ "Downsampling", "by", "applying", "a", "simple", "integer", "decimation", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L336-L356
Neurosim-lab/netpyne
netpyne/support/filter.py
lowpass_cheby_2
def lowpass_cheby_2(data, freq, df, maxorder=12, ba=False, freq_passband=False): """ Cheby2-Lowpass Filter Filter data by passing data only below a certain frequency. The main purpose of this cheby2 filter is downsampling. #318 shows some plots of this filter design itself. ...
python
def lowpass_cheby_2(data, freq, df, maxorder=12, ba=False, freq_passband=False): """ Cheby2-Lowpass Filter Filter data by passing data only below a certain frequency. The main purpose of this cheby2 filter is downsampling. #318 shows some plots of this filter design itself. ...
[ "def", "lowpass_cheby_2", "(", "data", ",", "freq", ",", "df", ",", "maxorder", "=", "12", ",", "ba", "=", "False", ",", "freq_passband", "=", "False", ")", ":", "nyquist", "=", "df", "*", "0.5", "# rp - maximum ripple of passband, rs - attenuation of stopband",...
Cheby2-Lowpass Filter Filter data by passing data only below a certain frequency. The main purpose of this cheby2 filter is downsampling. #318 shows some plots of this filter design itself. This method will iteratively design a filter, whose pass band frequency is determined dynamically, such that...
[ "Cheby2", "-", "Lowpass", "Filter" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L359-L406
Neurosim-lab/netpyne
netpyne/conversion/sonataImport.py
_distributeCells
def _distributeCells(numCellsPop): ''' distribute cells across compute nodes using round-robin''' from .. import sim hostCells = {} for i in range(sim.nhosts): hostCells[i] = [] for i in range(numCellsPop): hostCells[sim.nextHost].append(i) sim.next...
python
def _distributeCells(numCellsPop): ''' distribute cells across compute nodes using round-robin''' from .. import sim hostCells = {} for i in range(sim.nhosts): hostCells[i] = [] for i in range(numCellsPop): hostCells[sim.nextHost].append(i) sim.next...
[ "def", "_distributeCells", "(", "numCellsPop", ")", ":", "from", ".", ".", "import", "sim", "hostCells", "=", "{", "}", "for", "i", "in", "range", "(", "sim", ".", "nhosts", ")", ":", "hostCells", "[", "i", "]", "=", "[", "]", "for", "i", "in", "...
distribute cells across compute nodes using round-robin
[ "distribute", "cells", "across", "compute", "nodes", "using", "round", "-", "robin" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L82-L99
Neurosim-lab/netpyne
netpyne/conversion/sonataImport.py
fix_axon_peri
def fix_axon_peri(hobj): """Replace reconstructed axon with a stub :param hobj: hoc object """ for i,sec in enumerate(hobj.axon): hobj.axon[i] = None for i,sec in enumerate(hobj.all): if 'axon' in sec.name(): hobj.all[i] = None hobj.all = [sec for sec in hobj.all if...
python
def fix_axon_peri(hobj): """Replace reconstructed axon with a stub :param hobj: hoc object """ for i,sec in enumerate(hobj.axon): hobj.axon[i] = None for i,sec in enumerate(hobj.all): if 'axon' in sec.name(): hobj.all[i] = None hobj.all = [sec for sec in hobj.all if...
[ "def", "fix_axon_peri", "(", "hobj", ")", ":", "for", "i", ",", "sec", "in", "enumerate", "(", "hobj", ".", "axon", ")", ":", "hobj", ".", "axon", "[", "i", "]", "=", "None", "for", "i", ",", "sec", "in", "enumerate", "(", "hobj", ".", "all", "...
Replace reconstructed axon with a stub :param hobj: hoc object
[ "Replace", "reconstructed", "axon", "with", "a", "stub", ":", "param", "hobj", ":", "hoc", "object" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L103-L131
Neurosim-lab/netpyne
netpyne/conversion/sonataImport.py
fix_axon_peri_v2
def fix_axon_peri_v2(hobj): """Replace reconstructed axon with a stub :param hobj: hoc object """ for i,sec in enumerate(hobj.axon): if i < 2: sec.L = 30 sec.diam = 1 else: sec.L = 1e-6 sec.diam = 1 h.define_shape()
python
def fix_axon_peri_v2(hobj): """Replace reconstructed axon with a stub :param hobj: hoc object """ for i,sec in enumerate(hobj.axon): if i < 2: sec.L = 30 sec.diam = 1 else: sec.L = 1e-6 sec.diam = 1 h.define_shape()
[ "def", "fix_axon_peri_v2", "(", "hobj", ")", ":", "for", "i", ",", "sec", "in", "enumerate", "(", "hobj", ".", "axon", ")", ":", "if", "i", "<", "2", ":", "sec", ".", "L", "=", "30", "sec", ".", "diam", "=", "1", "else", ":", "sec", ".", "L",...
Replace reconstructed axon with a stub :param hobj: hoc object
[ "Replace", "reconstructed", "axon", "with", "a", "stub", ":", "param", "hobj", ":", "hoc", "object" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L135-L147
Neurosim-lab/netpyne
netpyne/conversion/sonataImport.py
fix_sec_nseg
def fix_sec_nseg(secs, dL): """ Set nseg of sections based on dL param: section.nseg = 1 + 2 * int(section.L / (2*dL)) :param secs: netpyne dictionary with all sections :param dL: dL from config file """ for secName in secs: secs[secName]['geom']['nseg'] = 1 + 2 * int(secs[secName]['geom']...
python
def fix_sec_nseg(secs, dL): """ Set nseg of sections based on dL param: section.nseg = 1 + 2 * int(section.L / (2*dL)) :param secs: netpyne dictionary with all sections :param dL: dL from config file """ for secName in secs: secs[secName]['geom']['nseg'] = 1 + 2 * int(secs[secName]['geom']...
[ "def", "fix_sec_nseg", "(", "secs", ",", "dL", ")", ":", "for", "secName", "in", "secs", ":", "secs", "[", "secName", "]", "[", "'geom'", "]", "[", "'nseg'", "]", "=", "1", "+", "2", "*", "int", "(", "secs", "[", "secName", "]", "[", "'geom'", ...
Set nseg of sections based on dL param: section.nseg = 1 + 2 * int(section.L / (2*dL)) :param secs: netpyne dictionary with all sections :param dL: dL from config file
[ "Set", "nseg", "of", "sections", "based", "on", "dL", "param", ":", "section", ".", "nseg", "=", "1", "+", "2", "*", "int", "(", "section", ".", "L", "/", "(", "2", "*", "dL", "))", ":", "param", "secs", ":", "netpyne", "dictionary", "with", "all...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L149-L156
Neurosim-lab/netpyne
netpyne/conversion/sonataImport.py
SONATAImporter.createConns
def createConns(self): # SONATA method - works but same results as NeuroMLlite ''' from sonata.io import File, Edge data = File(data_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edges.h5')], data_type_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edge_types.csv')]) ...
python
def createConns(self): # SONATA method - works but same results as NeuroMLlite ''' from sonata.io import File, Edge data = File(data_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edges.h5')], data_type_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edge_types.csv')]) ...
[ "def", "createConns", "(", "self", ")", ":", "# SONATA method - works but same results as NeuroMLlite", "# NeuroMLlite Method", "self", ".", "edges_info", "=", "{", "}", "self", ".", "conn_info", "=", "{", "}", "synMechSubs", "=", "{", "'level_of_detail'", ":", "'mo...
from sonata.io import File, Edge data = File(data_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edges.h5')], data_type_files=[self.subs('$NETWORK_DIR/excvirt_cortex_edge_types.csv')])
[ "from", "sonata", ".", "io", "import", "File", "Edge", "data", "=", "File", "(", "data_files", "=", "[", "self", ".", "subs", "(", "$NETWORK_DIR", "/", "excvirt_cortex_edges", ".", "h5", ")", "]", "data_type_files", "=", "[", "self", ".", "subs", "(", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L474-L568
Neurosim-lab/netpyne
netpyne/conversion/neuronPyHoc.py
importCell
def importCell (fileName, cellName, cellArgs = None, cellInstance = False): h.initnrn() varList = mechVarList() # list of properties for all density mechanisms and point processes origGlob = getGlobals(list(varList['mechs'].keys())+list(varList['pointps'].keys())) origGlob['v_init'] = -65 # add by han...
python
def importCell (fileName, cellName, cellArgs = None, cellInstance = False): h.initnrn() varList = mechVarList() # list of properties for all density mechanisms and point processes origGlob = getGlobals(list(varList['mechs'].keys())+list(varList['pointps'].keys())) origGlob['v_init'] = -65 # add by han...
[ "def", "importCell", "(", "fileName", ",", "cellName", ",", "cellArgs", "=", "None", ",", "cellInstance", "=", "False", ")", ":", "h", ".", "initnrn", "(", ")", "varList", "=", "mechVarList", "(", ")", "# list of properties for all density mechanisms and point pro...
Import cell from HOC template or python file into framework format (dict of sections, with geom, topol, mechs, syns)
[ "Import", "cell", "from", "HOC", "template", "or", "python", "file", "into", "framework", "format", "(", "dict", "of", "sections", "with", "geom", "topol", "mechs", "syns", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/neuronPyHoc.py#L162-L220
Neurosim-lab/netpyne
netpyne/conversion/neuronPyHoc.py
importCellsFromNet
def importCellsFromNet (netParams, fileName, labelList, condsList, cellNamesList, importSynMechs): h.initnrn() ''' Import cell from HOC template or python file into framework format (dict of sections, with geom, topol, mechs, syns)''' if fileName.endswith('.hoc') or fileName.endswith('.tem'): p...
python
def importCellsFromNet (netParams, fileName, labelList, condsList, cellNamesList, importSynMechs): h.initnrn() ''' Import cell from HOC template or python file into framework format (dict of sections, with geom, topol, mechs, syns)''' if fileName.endswith('.hoc') or fileName.endswith('.tem'): p...
[ "def", "importCellsFromNet", "(", "netParams", ",", "fileName", ",", "labelList", ",", "condsList", ",", "cellNamesList", ",", "importSynMechs", ")", ":", "h", ".", "initnrn", "(", ")", "if", "fileName", ".", "endswith", "(", "'.hoc'", ")", "or", "fileName",...
Import cell from HOC template or python file into framework format (dict of sections, with geom, topol, mechs, syns)
[ "Import", "cell", "from", "HOC", "template", "or", "python", "file", "into", "framework", "format", "(", "dict", "of", "sections", "with", "geom", "topol", "mechs", "syns", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/neuronPyHoc.py#L223-L265
Neurosim-lab/netpyne
netpyne/support/csd.py
Vaknin
def Vaknin (x): """ Vaknin correction for CSD analysis (Max Sherman [Brown U] implementation) Allows CSD to be performed on all N contacts instead of N-2 contacts See Vaknin et al (1989) for more details """ # Preallocate array with 2 more rows than input array x_new = np.zeros((x.shape[0]+2, x.shape[1]))...
python
def Vaknin (x): """ Vaknin correction for CSD analysis (Max Sherman [Brown U] implementation) Allows CSD to be performed on all N contacts instead of N-2 contacts See Vaknin et al (1989) for more details """ # Preallocate array with 2 more rows than input array x_new = np.zeros((x.shape[0]+2, x.shape[1]))...
[ "def", "Vaknin", "(", "x", ")", ":", "# Preallocate array with 2 more rows than input array", "x_new", "=", "np", ".", "zeros", "(", "(", "x", ".", "shape", "[", "0", "]", "+", "2", ",", "x", ".", "shape", "[", "1", "]", ")", ")", "# print x_new.shape", ...
Vaknin correction for CSD analysis (Max Sherman [Brown U] implementation) Allows CSD to be performed on all N contacts instead of N-2 contacts See Vaknin et al (1989) for more details
[ "Vaknin", "correction", "for", "CSD", "analysis", "(", "Max", "Sherman", "[", "Brown", "U", "]", "implementation", ")", "Allows", "CSD", "to", "be", "performed", "on", "all", "N", "contacts", "instead", "of", "N", "-", "2", "contacts", "See", "Vaknin", "...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/csd.py#L14-L28
Neurosim-lab/netpyne
netpyne/support/csd.py
getCSD
def getCSD (lfps,sampr,minf=0.05,maxf=300,norm=True,vaknin=False,spacing=1.0): """ get current source density approximation using set of local field potentials with equidistant spacing first performs a lowpass filter lfps is a list or numpy array of LFPs arranged spatially by column spacing is in microns ...
python
def getCSD (lfps,sampr,minf=0.05,maxf=300,norm=True,vaknin=False,spacing=1.0): """ get current source density approximation using set of local field potentials with equidistant spacing first performs a lowpass filter lfps is a list or numpy array of LFPs arranged spatially by column spacing is in microns ...
[ "def", "getCSD", "(", "lfps", ",", "sampr", ",", "minf", "=", "0.05", ",", "maxf", "=", "300", ",", "norm", "=", "True", ",", "vaknin", "=", "False", ",", "spacing", "=", "1.0", ")", ":", "datband", "=", "getbandpass", "(", "lfps", ",", "sampr", ...
get current source density approximation using set of local field potentials with equidistant spacing first performs a lowpass filter lfps is a list or numpy array of LFPs arranged spatially by column spacing is in microns
[ "get", "current", "source", "density", "approximation", "using", "set", "of", "local", "field", "potentials", "with", "equidistant", "spacing", "first", "performs", "a", "lowpass", "filter", "lfps", "is", "a", "list", "or", "numpy", "array", "of", "LFPs", "arr...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/csd.py#L35-L54
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
Cell.createSynapses
def createSynapses(self): """Add an exponentially decaying synapse """ synsoma = h.ExpSyn(self.soma(0.5)) synsoma.tau = 2 synsoma.e = 0 syndend = h.ExpSyn(self.dend(0.5)) syndend.tau = 2 syndend.e = 0 self.synlist.append(synsoma) # synlist is defined in Ce...
python
def createSynapses(self): """Add an exponentially decaying synapse """ synsoma = h.ExpSyn(self.soma(0.5)) synsoma.tau = 2 synsoma.e = 0 syndend = h.ExpSyn(self.dend(0.5)) syndend.tau = 2 syndend.e = 0 self.synlist.append(synsoma) # synlist is defined in Ce...
[ "def", "createSynapses", "(", "self", ")", ":", "synsoma", "=", "h", ".", "ExpSyn", "(", "self", ".", "soma", "(", "0.5", ")", ")", "synsoma", ".", "tau", "=", "2", "synsoma", ".", "e", "=", "0", "syndend", "=", "h", ".", "ExpSyn", "(", "self", ...
Add an exponentially decaying synapse
[ "Add", "an", "exponentially", "decaying", "synapse" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L30-L39
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
Cell.createNetcon
def createNetcon(self, thresh=10): """ created netcon to record spikes """ nc = h.NetCon(self.soma(0.5)._ref_v, None, sec = self.soma) nc.threshold = thresh return nc
python
def createNetcon(self, thresh=10): """ created netcon to record spikes """ nc = h.NetCon(self.soma(0.5)._ref_v, None, sec = self.soma) nc.threshold = thresh return nc
[ "def", "createNetcon", "(", "self", ",", "thresh", "=", "10", ")", ":", "nc", "=", "h", ".", "NetCon", "(", "self", ".", "soma", "(", "0.5", ")", ".", "_ref_v", ",", "None", ",", "sec", "=", "self", ".", "soma", ")", "nc", ".", "threshold", "="...
created netcon to record spikes
[ "created", "netcon", "to", "record", "spikes" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L42-L46
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
HHCellClass.createSections
def createSections(self): """Create the sections of the cell.""" self.soma = h.Section(name='soma', cell=self) self.dend = h.Section(name='dend', cell=self)
python
def createSections(self): """Create the sections of the cell.""" self.soma = h.Section(name='soma', cell=self) self.dend = h.Section(name='dend', cell=self)
[ "def", "createSections", "(", "self", ")", ":", "self", ".", "soma", "=", "h", ".", "Section", "(", "name", "=", "'soma'", ",", "cell", "=", "self", ")", "self", ".", "dend", "=", "h", ".", "Section", "(", "name", "=", "'dend'", ",", "cell", "=",...
Create the sections of the cell.
[ "Create", "the", "sections", "of", "the", "cell", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L51-L54
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
HHCellClass.defineGeometry
def defineGeometry(self): """Set the 3D geometry of the cell.""" self.soma.L = 18.8 self.soma.diam = 18.8 self.soma.Ra = 123.0 self.dend.L = 200.0 self.dend.diam = 1.0 self.dend.Ra = 100.0
python
def defineGeometry(self): """Set the 3D geometry of the cell.""" self.soma.L = 18.8 self.soma.diam = 18.8 self.soma.Ra = 123.0 self.dend.L = 200.0 self.dend.diam = 1.0 self.dend.Ra = 100.0
[ "def", "defineGeometry", "(", "self", ")", ":", "self", ".", "soma", ".", "L", "=", "18.8", "self", ".", "soma", ".", "diam", "=", "18.8", "self", ".", "soma", ".", "Ra", "=", "123.0", "self", ".", "dend", ".", "L", "=", "200.0", "self", ".", "...
Set the 3D geometry of the cell.
[ "Set", "the", "3D", "geometry", "of", "the", "cell", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L56-L64
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
HHCellClass.defineBiophysics
def defineBiophysics(self): """Assign the membrane properties across the cell.""" # Insert active Hodgkin-Huxley current in the soma self.soma.insert('hh') self.soma.gnabar_hh = 0.12 # Sodium conductance in S/cm2 self.soma.gkbar_hh = 0.036 # Potassium conductance in S/cm2 ...
python
def defineBiophysics(self): """Assign the membrane properties across the cell.""" # Insert active Hodgkin-Huxley current in the soma self.soma.insert('hh') self.soma.gnabar_hh = 0.12 # Sodium conductance in S/cm2 self.soma.gkbar_hh = 0.036 # Potassium conductance in S/cm2 ...
[ "def", "defineBiophysics", "(", "self", ")", ":", "# Insert active Hodgkin-Huxley current in the soma", "self", ".", "soma", ".", "insert", "(", "'hh'", ")", "self", ".", "soma", ".", "gnabar_hh", "=", "0.12", "# Sodium conductance in S/cm2", "self", ".", "soma", ...
Assign the membrane properties across the cell.
[ "Assign", "the", "membrane", "properties", "across", "the", "cell", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L66-L78
Neurosim-lab/netpyne
netpyne/sim/utils.py
_mat2dict
def _mat2dict(obj): ''' A recursive function which constructs from matobjects nested dictionaries Enforce lists for conns, synMechs and stims even if 1 element (matlab converts to dict otherwise) ''' import scipy.io as spio import numpy as np if isinstance(obj, dict): out = {} ...
python
def _mat2dict(obj): ''' A recursive function which constructs from matobjects nested dictionaries Enforce lists for conns, synMechs and stims even if 1 element (matlab converts to dict otherwise) ''' import scipy.io as spio import numpy as np if isinstance(obj, dict): out = {} ...
[ "def", "_mat2dict", "(", "obj", ")", ":", "import", "scipy", ".", "io", "as", "spio", "import", "numpy", "as", "np", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "out", "=", "{", "}", "for", "key", "in", "obj", ":", "if", "isinstance", ...
A recursive function which constructs from matobjects nested dictionaries Enforce lists for conns, synMechs and stims even if 1 element (matlab converts to dict otherwise)
[ "A", "recursive", "function", "which", "constructs", "from", "matobjects", "nested", "dictionaries", "Enforce", "lists", "for", "conns", "synMechs", "and", "stims", "even", "if", "1", "element", "(", "matlab", "converts", "to", "dict", "otherwise", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/utils.py#L432-L478
Neurosim-lab/netpyne
netpyne/support/morphology.py
load
def load(filename, fileformat=None, cell=None, use_axon=True, xshift=0, yshift=0, zshift=0): """ Load an SWC from filename and instantiate inside cell. Code kindly provided by @ramcdougal. Args: filename = .swc file containing morphology cell = Cell() object. (Default: None, creates new...
python
def load(filename, fileformat=None, cell=None, use_axon=True, xshift=0, yshift=0, zshift=0): """ Load an SWC from filename and instantiate inside cell. Code kindly provided by @ramcdougal. Args: filename = .swc file containing morphology cell = Cell() object. (Default: None, creates new...
[ "def", "load", "(", "filename", ",", "fileformat", "=", "None", ",", "cell", "=", "None", ",", "use_axon", "=", "True", ",", "xshift", "=", "0", ",", "yshift", "=", "0", ",", "zshift", "=", "0", ")", ":", "if", "cell", "is", "None", ":", "cell", ...
Load an SWC from filename and instantiate inside cell. Code kindly provided by @ramcdougal. Args: filename = .swc file containing morphology cell = Cell() object. (Default: None, creates new object) filename = the filename of the SWC file use_axon = include the axon? Default: Tr...
[ "Load", "an", "SWC", "from", "filename", "and", "instantiate", "inside", "cell", ".", "Code", "kindly", "provided", "by", "@ramcdougal", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L43-L147
Neurosim-lab/netpyne
netpyne/support/morphology.py
sequential_spherical
def sequential_spherical(xyz): """ Converts sequence of cartesian coordinates into a sequence of line segments defined by spherical coordinates. Args: xyz = 2d numpy array, each row specifies a point in cartesian coordinates (x,y,z) tracing out a path in 3D space...
python
def sequential_spherical(xyz): """ Converts sequence of cartesian coordinates into a sequence of line segments defined by spherical coordinates. Args: xyz = 2d numpy array, each row specifies a point in cartesian coordinates (x,y,z) tracing out a path in 3D space...
[ "def", "sequential_spherical", "(", "xyz", ")", ":", "d_xyz", "=", "np", ".", "diff", "(", "xyz", ",", "axis", "=", "0", ")", "r", "=", "np", ".", "linalg", ".", "norm", "(", "d_xyz", ",", "axis", "=", "1", ")", "theta", "=", "np", ".", "arctan...
Converts sequence of cartesian coordinates into a sequence of line segments defined by spherical coordinates. Args: xyz = 2d numpy array, each row specifies a point in cartesian coordinates (x,y,z) tracing out a path in 3D space. Returns: r = lengths of ...
[ "Converts", "sequence", "of", "cartesian", "coordinates", "into", "a", "sequence", "of", "line", "segments", "defined", "by", "spherical", "coordinates", ".", "Args", ":", "xyz", "=", "2d", "numpy", "array", "each", "row", "specifies", "a", "point", "in", "c...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L149-L171
Neurosim-lab/netpyne
netpyne/support/morphology.py
spherical_to_cartesian
def spherical_to_cartesian(r,theta,phi): """ Simple conversion of spherical to cartesian coordinates Args: r,theta,phi = scalar spherical coordinates Returns: x,y,z = scalar cartesian coordinates """ x = r * np.sin(phi) * np.cos(theta) y = r * np.sin(phi) * np.sin(t...
python
def spherical_to_cartesian(r,theta,phi): """ Simple conversion of spherical to cartesian coordinates Args: r,theta,phi = scalar spherical coordinates Returns: x,y,z = scalar cartesian coordinates """ x = r * np.sin(phi) * np.cos(theta) y = r * np.sin(phi) * np.sin(t...
[ "def", "spherical_to_cartesian", "(", "r", ",", "theta", ",", "phi", ")", ":", "x", "=", "r", "*", "np", ".", "sin", "(", "phi", ")", "*", "np", ".", "cos", "(", "theta", ")", "y", "=", "r", "*", "np", ".", "sin", "(", "phi", ")", "*", "np"...
Simple conversion of spherical to cartesian coordinates Args: r,theta,phi = scalar spherical coordinates Returns: x,y,z = scalar cartesian coordinates
[ "Simple", "conversion", "of", "spherical", "to", "cartesian", "coordinates", "Args", ":", "r", "theta", "phi", "=", "scalar", "spherical", "coordinates", "Returns", ":", "x", "y", "z", "=", "scalar", "cartesian", "coordinates" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L173-L186
Neurosim-lab/netpyne
netpyne/support/morphology.py
find_coord
def find_coord(targ_length,xyz,rcum,theta,phi): """ Find (x,y,z) ending coordinate of segment path along section path. Args: targ_length = scalar specifying length of segment path, starting from the begining of the section path xyz = coordinates specifying the sect...
python
def find_coord(targ_length,xyz,rcum,theta,phi): """ Find (x,y,z) ending coordinate of segment path along section path. Args: targ_length = scalar specifying length of segment path, starting from the begining of the section path xyz = coordinates specifying the sect...
[ "def", "find_coord", "(", "targ_length", ",", "xyz", ",", "rcum", ",", "theta", ",", "phi", ")", ":", "# [1] Find spherical coordinates for the line segment containing", "# the endpoint.", "# [2] Find endpoint in spherical coords and convert to cartesian", "i", "=",...
Find (x,y,z) ending coordinate of segment path along section path. Args: targ_length = scalar specifying length of segment path, starting from the begining of the section path xyz = coordinates specifying the section path rcum = cumulative sum of section path lengt...
[ "Find", "(", "x", "y", "z", ")", "ending", "coordinate", "of", "segment", "path", "along", "section", "path", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L188-L209
Neurosim-lab/netpyne
netpyne/support/morphology.py
interpolate_jagged
def interpolate_jagged(xyz,nseg): """ Interpolates along a jagged path in 3D Args: xyz = section path specified in cartesian coordinates nseg = number of segment paths in section path Returns: interp_xyz = interpolated path """ # Spherical coordinates s...
python
def interpolate_jagged(xyz,nseg): """ Interpolates along a jagged path in 3D Args: xyz = section path specified in cartesian coordinates nseg = number of segment paths in section path Returns: interp_xyz = interpolated path """ # Spherical coordinates s...
[ "def", "interpolate_jagged", "(", "xyz", ",", "nseg", ")", ":", "# Spherical coordinates specifying the angles of all line", "# segments that make up the section path", "(", "r", ",", "theta", ",", "phi", ")", "=", "sequential_spherical", "(", "xyz", ")", "# cumulative le...
Interpolates along a jagged path in 3D Args: xyz = section path specified in cartesian coordinates nseg = number of segment paths in section path Returns: interp_xyz = interpolated path
[ "Interpolates", "along", "a", "jagged", "path", "in", "3D", "Args", ":", "xyz", "=", "section", "path", "specified", "in", "cartesian", "coordinates", "nseg", "=", "number", "of", "segment", "paths", "in", "section", "path", "Returns", ":", "interp_xyz", "="...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L211-L262
Neurosim-lab/netpyne
netpyne/support/morphology.py
shapeplot
def shapeplot(h,ax,sections=None,order='pre',cvals=None,\ clim=None,cmap=cm.YlOrBr_r, legend=True, **kwargs): # meanLineWidth=1.0, maxLineWidth=10.0, """ Plots a 3D shapeplot Args: h = hocObject to interface with neuron ax = matplotlib axis for plotting sections = li...
python
def shapeplot(h,ax,sections=None,order='pre',cvals=None,\ clim=None,cmap=cm.YlOrBr_r, legend=True, **kwargs): # meanLineWidth=1.0, maxLineWidth=10.0, """ Plots a 3D shapeplot Args: h = hocObject to interface with neuron ax = matplotlib axis for plotting sections = li...
[ "def", "shapeplot", "(", "h", ",", "ax", ",", "sections", "=", "None", ",", "order", "=", "'pre'", ",", "cvals", "=", "None", ",", "clim", "=", "None", ",", "cmap", "=", "cm", ".", "YlOrBr_r", ",", "legend", "=", "True", ",", "*", "*", "kwargs", ...
Plots a 3D shapeplot Args: h = hocObject to interface with neuron ax = matplotlib axis for plotting sections = list of h.Section() objects to be plotted order = { None= use h.allsec() to get sections 'pre'= pre-order traversal of morphology } cvals = list/a...
[ "Plots", "a", "3D", "shapeplot" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L279-L346
Neurosim-lab/netpyne
netpyne/support/morphology.py
shapeplot_animate
def shapeplot_animate(v,lines,nframes=None,tscale='linear',\ clim=[-80,50],cmap=cm.YlOrBr_r): """ Returns animate function which updates color of shapeplot """ if nframes is None: nframes = v.shape[0] if tscale == 'linear': def animate(i): i_t = int((i/nfram...
python
def shapeplot_animate(v,lines,nframes=None,tscale='linear',\ clim=[-80,50],cmap=cm.YlOrBr_r): """ Returns animate function which updates color of shapeplot """ if nframes is None: nframes = v.shape[0] if tscale == 'linear': def animate(i): i_t = int((i/nfram...
[ "def", "shapeplot_animate", "(", "v", ",", "lines", ",", "nframes", "=", "None", ",", "tscale", "=", "'linear'", ",", "clim", "=", "[", "-", "80", ",", "50", "]", ",", "cmap", "=", "cm", ".", "YlOrBr_r", ")", ":", "if", "nframes", "is", "None", "...
Returns animate function which updates color of shapeplot
[ "Returns", "animate", "function", "which", "updates", "color", "of", "shapeplot" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L348-L368
Neurosim-lab/netpyne
netpyne/support/morphology.py
mark_locations
def mark_locations(h,section,locs,markspec='or',**kwargs): """ Marks one or more locations on along a section. Could be used to mark the location of a recording or electrical stimulation. Args: h = hocObject to interface with neuron section = reference to section locs = float be...
python
def mark_locations(h,section,locs,markspec='or',**kwargs): """ Marks one or more locations on along a section. Could be used to mark the location of a recording or electrical stimulation. Args: h = hocObject to interface with neuron section = reference to section locs = float be...
[ "def", "mark_locations", "(", "h", ",", "section", ",", "locs", ",", "markspec", "=", "'or'", ",", "*", "*", "kwargs", ")", ":", "# get list of cartesian coordinates specifying section path", "xyz", "=", "get_section_path", "(", "h", ",", "section", ")", "(", ...
Marks one or more locations on along a section. Could be used to mark the location of a recording or electrical stimulation. Args: h = hocObject to interface with neuron section = reference to section locs = float between 0 and 1, or array of floats optional arguments specify de...
[ "Marks", "one", "or", "more", "locations", "on", "along", "a", "section", ".", "Could", "be", "used", "to", "mark", "the", "location", "of", "a", "recording", "or", "electrical", "stimulation", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L370-L406
Neurosim-lab/netpyne
netpyne/support/morphology.py
root_sections
def root_sections(h): """ Returns a list of all sections that have no parent. """ roots = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: roots.append(section) return roots
python
def root_sections(h): """ Returns a list of all sections that have no parent. """ roots = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: roots.append(section) return roots
[ "def", "root_sections", "(", "h", ")", ":", "roots", "=", "[", "]", "for", "section", "in", "h", ".", "allsec", "(", ")", ":", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ")", "# has_parent returns a float... cast to bool", "if", "sr...
Returns a list of all sections that have no parent.
[ "Returns", "a", "list", "of", "all", "sections", "that", "have", "no", "parent", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L408-L418
Neurosim-lab/netpyne
netpyne/support/morphology.py
leaf_sections
def leaf_sections(h): """ Returns a list of all sections that have no children. """ leaves = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # nchild returns a float... cast to bool if sref.nchild() < 0.9: leaves.append(section) return leaves
python
def leaf_sections(h): """ Returns a list of all sections that have no children. """ leaves = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # nchild returns a float... cast to bool if sref.nchild() < 0.9: leaves.append(section) return leaves
[ "def", "leaf_sections", "(", "h", ")", ":", "leaves", "=", "[", "]", "for", "section", "in", "h", ".", "allsec", "(", ")", ":", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ")", "# nchild returns a float... cast to bool", "if", "sref"...
Returns a list of all sections that have no children.
[ "Returns", "a", "list", "of", "all", "sections", "that", "have", "no", "children", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L420-L430
Neurosim-lab/netpyne
netpyne/support/morphology.py
root_indices
def root_indices(sec_list): """ Returns the index of all sections without a parent. """ roots = [] for i,section in enumerate(sec_list): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: roots.append(i) r...
python
def root_indices(sec_list): """ Returns the index of all sections without a parent. """ roots = [] for i,section in enumerate(sec_list): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: roots.append(i) r...
[ "def", "root_indices", "(", "sec_list", ")", ":", "roots", "=", "[", "]", "for", "i", ",", "section", "in", "enumerate", "(", "sec_list", ")", ":", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ")", "# has_parent returns a float... cast ...
Returns the index of all sections without a parent.
[ "Returns", "the", "index", "of", "all", "sections", "without", "a", "parent", "." ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L432-L442
Neurosim-lab/netpyne
netpyne/support/morphology.py
allsec_preorder
def allsec_preorder(h): """ Alternative to using h.allsec(). This returns all sections in order from the root. Traverses the topology each neuron in "pre-order" """ #Iterate over all sections, find roots roots = root_sections(h) # Build list of all sections sec_list = [] for r in ro...
python
def allsec_preorder(h): """ Alternative to using h.allsec(). This returns all sections in order from the root. Traverses the topology each neuron in "pre-order" """ #Iterate over all sections, find roots roots = root_sections(h) # Build list of all sections sec_list = [] for r in ro...
[ "def", "allsec_preorder", "(", "h", ")", ":", "#Iterate over all sections, find roots", "roots", "=", "root_sections", "(", "h", ")", "# Build list of all sections", "sec_list", "=", "[", "]", "for", "r", "in", "roots", ":", "add_pre", "(", "h", ",", "sec_list",...
Alternative to using h.allsec(). This returns all sections in order from the root. Traverses the topology each neuron in "pre-order"
[ "Alternative", "to", "using", "h", ".", "allsec", "()", ".", "This", "returns", "all", "sections", "in", "order", "from", "the", "root", ".", "Traverses", "the", "topology", "each", "neuron", "in", "pre", "-", "order" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L444-L456
Neurosim-lab/netpyne
netpyne/support/morphology.py
add_pre
def add_pre(h,sec_list,section,order_list=None,branch_order=None): """ A helper function that traverses a neuron's morphology (or a sub-tree) of the morphology in pre-order. This is usually not necessary for the user to import. """ sec_list.append(section) sref = h.SectionRef(sec=section) ...
python
def add_pre(h,sec_list,section,order_list=None,branch_order=None): """ A helper function that traverses a neuron's morphology (or a sub-tree) of the morphology in pre-order. This is usually not necessary for the user to import. """ sec_list.append(section) sref = h.SectionRef(sec=section) ...
[ "def", "add_pre", "(", "h", ",", "sec_list", ",", "section", ",", "order_list", "=", "None", ",", "branch_order", "=", "None", ")", ":", "sec_list", ".", "append", "(", "section", ")", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ...
A helper function that traverses a neuron's morphology (or a sub-tree) of the morphology in pre-order. This is usually not necessary for the user to import.
[ "A", "helper", "function", "that", "traverses", "a", "neuron", "s", "morphology", "(", "or", "a", "sub", "-", "tree", ")", "of", "the", "morphology", "in", "pre", "-", "order", ".", "This", "is", "usually", "not", "necessary", "for", "the", "user", "to...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L458-L474
Neurosim-lab/netpyne
netpyne/support/morphology.py
dist_between
def dist_between(h,seg1,seg2): """ Calculates the distance between two segments. I stole this function from a post by Michael Hines on the NEURON forum (www.neuron.yale.edu/phpbb/viewtopic.php?f=2&t=2114) """ h.distance(0, seg1.x, sec=seg1.sec) return h.distance(seg2.x, sec=seg2.sec)
python
def dist_between(h,seg1,seg2): """ Calculates the distance between two segments. I stole this function from a post by Michael Hines on the NEURON forum (www.neuron.yale.edu/phpbb/viewtopic.php?f=2&t=2114) """ h.distance(0, seg1.x, sec=seg1.sec) return h.distance(seg2.x, sec=seg2.sec)
[ "def", "dist_between", "(", "h", ",", "seg1", ",", "seg2", ")", ":", "h", ".", "distance", "(", "0", ",", "seg1", ".", "x", ",", "sec", "=", "seg1", ".", "sec", ")", "return", "h", ".", "distance", "(", "seg2", ".", "x", ",", "sec", "=", "seg...
Calculates the distance between two segments. I stole this function from a post by Michael Hines on the NEURON forum (www.neuron.yale.edu/phpbb/viewtopic.php?f=2&t=2114)
[ "Calculates", "the", "distance", "between", "two", "segments", ".", "I", "stole", "this", "function", "from", "a", "post", "by", "Michael", "Hines", "on", "the", "NEURON", "forum", "(", "www", ".", "neuron", ".", "yale", ".", "edu", "/", "phpbb", "/", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L476-L483
Neurosim-lab/netpyne
netpyne/support/morphology.py
all_branch_orders
def all_branch_orders(h): """ Produces a list branch orders for each section (following pre-order tree traversal) """ #Iterate over all sections, find roots roots = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool ...
python
def all_branch_orders(h): """ Produces a list branch orders for each section (following pre-order tree traversal) """ #Iterate over all sections, find roots roots = [] for section in h.allsec(): sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool ...
[ "def", "all_branch_orders", "(", "h", ")", ":", "#Iterate over all sections, find roots", "roots", "=", "[", "]", "for", "section", "in", "h", ".", "allsec", "(", ")", ":", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ")", "# has_parent...
Produces a list branch orders for each section (following pre-order tree traversal)
[ "Produces", "a", "list", "branch", "orders", "for", "each", "section", "(", "following", "pre", "-", "order", "tree", "traversal", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L485-L502
Neurosim-lab/netpyne
netpyne/support/morphology.py
branch_order
def branch_order(h,section, path=[]): """ Returns the branch order of a section """ path.append(section) sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: return 0 # section is a root else: nchild = len(list(h.Sectio...
python
def branch_order(h,section, path=[]): """ Returns the branch order of a section """ path.append(section) sref = h.SectionRef(sec=section) # has_parent returns a float... cast to bool if sref.has_parent() < 0.9: return 0 # section is a root else: nchild = len(list(h.Sectio...
[ "def", "branch_order", "(", "h", ",", "section", ",", "path", "=", "[", "]", ")", ":", "path", ".", "append", "(", "section", ")", "sref", "=", "h", ".", "SectionRef", "(", "sec", "=", "section", ")", "# has_parent returns a float... cast to bool", "if", ...
Returns the branch order of a section
[ "Returns", "the", "branch", "order", "of", "a", "section" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L504-L518
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.createCells
def createCells(self): '''Function to instantiate Cell objects based on the characteristics of this population''' # add individual cells if 'cellsList' in self.tags: cells = self.createCellsList() # create cells based on fixed number of cells elif 'numCells' in self....
python
def createCells(self): '''Function to instantiate Cell objects based on the characteristics of this population''' # add individual cells if 'cellsList' in self.tags: cells = self.createCellsList() # create cells based on fixed number of cells elif 'numCells' in self....
[ "def", "createCells", "(", "self", ")", ":", "# add individual cells", "if", "'cellsList'", "in", "self", ".", "tags", ":", "cells", "=", "self", ".", "createCellsList", "(", ")", "# create cells based on fixed number of cells", "elif", "'numCells'", "in", "self", ...
Function to instantiate Cell objects based on the characteristics of this population
[ "Function", "to", "instantiate", "Cell", "objects", "based", "on", "the", "characteristics", "of", "this", "population" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L64-L88
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.createCellsFixedNum
def createCellsFixedNum (self): ''' Create population cells based on fixed number of cells''' from .. import sim cells = [] self.rand.Random123(self.tags['numCells'], sim.net.lastGid, sim.cfg.seeds['loc']) self.rand.uniform(0, 1) vec = h.Vector(self.tags['numCells']*3) ...
python
def createCellsFixedNum (self): ''' Create population cells based on fixed number of cells''' from .. import sim cells = [] self.rand.Random123(self.tags['numCells'], sim.net.lastGid, sim.cfg.seeds['loc']) self.rand.uniform(0, 1) vec = h.Vector(self.tags['numCells']*3) ...
[ "def", "createCellsFixedNum", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "cells", "=", "[", "]", "self", ".", "rand", ".", "Random123", "(", "self", ".", "tags", "[", "'numCells'", "]", ",", "sim", ".", "net", ".", "lastGid", ",", "s...
Create population cells based on fixed number of cells
[ "Create", "population", "cells", "based", "on", "fixed", "number", "of", "cells" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L91-L156
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.createCellsDensity
def createCellsDensity (self): ''' Create population cells based on density''' from .. import sim cells = [] shape = sim.net.params.shape sizeX = sim.net.params.sizeX sizeY = sim.net.params.sizeY sizeZ = sim.net.params.sizeZ # calculate volume ...
python
def createCellsDensity (self): ''' Create population cells based on density''' from .. import sim cells = [] shape = sim.net.params.shape sizeX = sim.net.params.sizeX sizeY = sim.net.params.sizeY sizeZ = sim.net.params.sizeZ # calculate volume ...
[ "def", "createCellsDensity", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "cells", "=", "[", "]", "shape", "=", "sim", ".", "net", ".", "params", ".", "shape", "sizeX", "=", "sim", ".", "net", ".", "params", ".", "sizeX", "sizeY", "=",...
Create population cells based on density
[ "Create", "population", "cells", "based", "on", "density" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L159-L272
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.createCellsList
def createCellsList (self): ''' Create population cells based on list of individual cells''' from .. import sim cells = [] self.tags['numCells'] = len(self.tags['cellsList']) for i in self._distributeCells(len(self.tags['cellsList']))[sim.rank]: #if 'cellMode...
python
def createCellsList (self): ''' Create population cells based on list of individual cells''' from .. import sim cells = [] self.tags['numCells'] = len(self.tags['cellsList']) for i in self._distributeCells(len(self.tags['cellsList']))[sim.rank]: #if 'cellMode...
[ "def", "createCellsList", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "cells", "=", "[", "]", "self", ".", "tags", "[", "'numCells'", "]", "=", "len", "(", "self", ".", "tags", "[", "'cellsList'", "]", ")", "for", "i", "in", "self", ...
Create population cells based on list of individual cells
[ "Create", "population", "cells", "based", "on", "list", "of", "individual", "cells" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L275-L301
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.createCellsGrid
def createCellsGrid (self): ''' Create population cells based on fixed number of cells''' from .. import sim cells = [] rangeLocs = [[0, getattr(sim.net.params, 'size'+coord)] for coord in ['X','Y','Z']] for icoord, coord in enumerate(['x', 'y', 'z']): # con...
python
def createCellsGrid (self): ''' Create population cells based on fixed number of cells''' from .. import sim cells = [] rangeLocs = [[0, getattr(sim.net.params, 'size'+coord)] for coord in ['X','Y','Z']] for icoord, coord in enumerate(['x', 'y', 'z']): # con...
[ "def", "createCellsGrid", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "cells", "=", "[", "]", "rangeLocs", "=", "[", "[", "0", ",", "getattr", "(", "sim", ".", "net", ".", "params", ",", "'size'", "+", "coord", ")", "]", "for", "coo...
Create population cells based on fixed number of cells
[ "Create", "population", "cells", "based", "on", "fixed", "number", "of", "cells" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L304-L342
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop._setCellClass
def _setCellClass (self): ''' Set cell class (CompartCell, PointCell, etc)''' from .. import sim # Check whether it's a NeuroML2 based cell if 'originalFormat' in self.tags: if self.tags['originalFormat'] == 'NeuroML2': self.cellModelClass = sim.NML2C...
python
def _setCellClass (self): ''' Set cell class (CompartCell, PointCell, etc)''' from .. import sim # Check whether it's a NeuroML2 based cell if 'originalFormat' in self.tags: if self.tags['originalFormat'] == 'NeuroML2': self.cellModelClass = sim.NML2C...
[ "def", "_setCellClass", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "# Check whether it's a NeuroML2 based cell", "if", "'originalFormat'", "in", "self", ".", "tags", ":", "if", "self", ".", "tags", "[", "'originalFormat'", "]", "==", "'NeuroML2'",...
Set cell class (CompartCell, PointCell, etc)
[ "Set", "cell", "class", "(", "CompartCell", "PointCell", "etc", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L345-L371
Neurosim-lab/netpyne
netpyne/network/pop.py
Pop.calcRelativeSegCoords
def calcRelativeSegCoords(self): """Calculate segment coordinates from 3d point coordinates Used for LFP calc (one per population cell; assumes same morphology)""" from .. import sim localPopGids = list(set(sim.net.gid2lid.keys()).intersection(set(self.cellGids))) if localPo...
python
def calcRelativeSegCoords(self): """Calculate segment coordinates from 3d point coordinates Used for LFP calc (one per population cell; assumes same morphology)""" from .. import sim localPopGids = list(set(sim.net.gid2lid.keys()).intersection(set(self.cellGids))) if localPo...
[ "def", "calcRelativeSegCoords", "(", "self", ")", ":", "from", ".", ".", "import", "sim", "localPopGids", "=", "list", "(", "set", "(", "sim", ".", "net", ".", "gid2lid", ".", "keys", "(", ")", ")", ".", "intersection", "(", "set", "(", "self", ".", ...
Calculate segment coordinates from 3d point coordinates Used for LFP calc (one per population cell; assumes same morphology)
[ "Calculate", "segment", "coordinates", "from", "3d", "point", "coordinates", "Used", "for", "LFP", "calc", "(", "one", "per", "population", "cell", ";", "assumes", "same", "morphology", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/pop.py#L374-L441
Neurosim-lab/netpyne
netpyne/support/morlet.py
Morlet
def Morlet (sampr, freq, width=7.0): """ Morlet's wavelet for frequency f and time t Wavelet normalized so total energy is 1 freq: specific frequency (Hz) width: number of cycles for the Morlet wavelet output returned: final units are 1/s """ dt = 1. / sampr sf = freq / width # sf in Hz ...
python
def Morlet (sampr, freq, width=7.0): """ Morlet's wavelet for frequency f and time t Wavelet normalized so total energy is 1 freq: specific frequency (Hz) width: number of cycles for the Morlet wavelet output returned: final units are 1/s """ dt = 1. / sampr sf = freq / width # sf in Hz ...
[ "def", "Morlet", "(", "sampr", ",", "freq", ",", "width", "=", "7.0", ")", ":", "dt", "=", "1.", "/", "sampr", "sf", "=", "freq", "/", "width", "# sf in Hz", "st", "=", "1.", "/", "(", "2.", "*", "np", ".", "pi", "*", "sf", ")", "# st in s", ...
Morlet's wavelet for frequency f and time t Wavelet normalized so total energy is 1 freq: specific frequency (Hz) width: number of cycles for the Morlet wavelet output returned: final units are 1/s
[ "Morlet", "s", "wavelet", "for", "frequency", "f", "and", "time", "t", "Wavelet", "normalized", "so", "total", "energy", "is", "1", "freq", ":", "specific", "frequency", "(", "Hz", ")", "width", ":", "number", "of", "cycles", "for", "the", "Morlet", "wav...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morlet.py#L25-L38
Neurosim-lab/netpyne
netpyne/support/morlet.py
MorletVec
def MorletVec (sig, sampr, freq, width, m=None, getphase=False): """ Final units of y: signal units squared. For instance, a signal of Am would have Am^2 The energy is calculated using Morlet's wavelets; also returns phase when getphase==True sig: input signal sampr: sampling rate (Hz) freq: frequency m: Mo...
python
def MorletVec (sig, sampr, freq, width, m=None, getphase=False): """ Final units of y: signal units squared. For instance, a signal of Am would have Am^2 The energy is calculated using Morlet's wavelets; also returns phase when getphase==True sig: input signal sampr: sampling rate (Hz) freq: frequency m: Mo...
[ "def", "MorletVec", "(", "sig", ",", "sampr", ",", "freq", ",", "width", ",", "m", "=", "None", ",", "getphase", "=", "False", ")", ":", "# calculate the morlet wavelet for this frequency", "# units of m are 1/s", "if", "m", "is", "None", ":", "m", "=", "Mor...
Final units of y: signal units squared. For instance, a signal of Am would have Am^2 The energy is calculated using Morlet's wavelets; also returns phase when getphase==True sig: input signal sampr: sampling rate (Hz) freq: frequency m: Morlet wavelet width: number of cycles of Morlet wavelet
[ "Final", "units", "of", "y", ":", "signal", "units", "squared", ".", "For", "instance", "a", "signal", "of", "Am", "would", "have", "Am^2", "The", "energy", "is", "calculated", "using", "Morlet", "s", "wavelets", ";", "also", "returns", "phase", "when", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morlet.py#L41-L61
Neurosim-lab/netpyne
netpyne/analysis/lfp.py
plotLFP
def plotLFP (electrodes = ['avg', 'all'], plots = ['timeSeries', 'PSD', 'spectrogram', 'locations'], timeRange=None, NFFT=256, noverlap=128, nperseg=256, minFreq=1, maxFreq=100, stepFreq=1, smooth=0, separation=1.0, includeAxon=True, logx=False, logy=False, norm=False, dpi=200, overlay=False, filtFreq = False, fil...
python
def plotLFP (electrodes = ['avg', 'all'], plots = ['timeSeries', 'PSD', 'spectrogram', 'locations'], timeRange=None, NFFT=256, noverlap=128, nperseg=256, minFreq=1, maxFreq=100, stepFreq=1, smooth=0, separation=1.0, includeAxon=True, logx=False, logy=False, norm=False, dpi=200, overlay=False, filtFreq = False, fil...
[ "def", "plotLFP", "(", "electrodes", "=", "[", "'avg'", ",", "'all'", "]", ",", "plots", "=", "[", "'timeSeries'", ",", "'PSD'", ",", "'spectrogram'", ",", "'locations'", "]", ",", "timeRange", "=", "None", ",", "NFFT", "=", "256", ",", "noverlap", "="...
Plot LFP - electrodes (list): List of electrodes to include; 'avg'=avg of all electrodes; 'all'=each electrode separately (default: ['avg', 'all']) - plots (list): list of plot types to show (default: ['timeSeries', 'PSD', 'timeFreq', 'locations']) - timeRange ([start:stop]): Time range of spik...
[ "Plot", "LFP", "-", "electrodes", "(", "list", ")", ":", "List", "of", "electrodes", "to", "include", ";", "avg", "=", "avg", "of", "all", "electrodes", ";", "all", "=", "each", "electrode", "separately", "(", "default", ":", "[", "avg", "all", "]", ...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/lfp.py#L37-L405
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
create
def create (netParams=None, simConfig=None, output=False): ''' Sequence of commands to create network ''' from .. import sim import __main__ as top if not netParams: netParams = top.netParams if not simConfig: simConfig = top.simConfig sim.initialize(netParams, simConfig) # create network obje...
python
def create (netParams=None, simConfig=None, output=False): ''' Sequence of commands to create network ''' from .. import sim import __main__ as top if not netParams: netParams = top.netParams if not simConfig: simConfig = top.simConfig sim.initialize(netParams, simConfig) # create network obje...
[ "def", "create", "(", "netParams", "=", "None", ",", "simConfig", "=", "None", ",", "output", "=", "False", ")", ":", "from", ".", ".", "import", "sim", "import", "__main__", "as", "top", "if", "not", "netParams", ":", "netParams", "=", "top", ".", "...
Sequence of commands to create network
[ "Sequence", "of", "commands", "to", "create", "network" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L19-L34
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
intervalSimulate
def intervalSimulate (interval): ''' Sequence of commands to simulate network ''' from .. import sim sim.runSimWithIntervalFunc(interval, sim.intervalSave) # run parallel Neuron simulation #this gather is justa merging of files sim.fileGather()
python
def intervalSimulate (interval): ''' Sequence of commands to simulate network ''' from .. import sim sim.runSimWithIntervalFunc(interval, sim.intervalSave) # run parallel Neuron simulation #this gather is justa merging of files sim.fileGather()
[ "def", "intervalSimulate", "(", "interval", ")", ":", "from", ".", ".", "import", "sim", "sim", ".", "runSimWithIntervalFunc", "(", "interval", ",", "sim", ".", "intervalSave", ")", "# run parallel Neuron simulation ", "#this gather is justa merging of files", "sim", ...
Sequence of commands to simulate network
[ "Sequence", "of", "commands", "to", "simulate", "network" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L49-L54
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
createSimulate
def createSimulate (netParams=None, simConfig=None, output=False): ''' Sequence of commands create, simulate and analyse network ''' from .. import sim (pops, cells, conns, stims, rxd, simData) = sim.create(netParams, simConfig, output=True) sim.simulate() if output: return (pops, cells, conns, st...
python
def createSimulate (netParams=None, simConfig=None, output=False): ''' Sequence of commands create, simulate and analyse network ''' from .. import sim (pops, cells, conns, stims, rxd, simData) = sim.create(netParams, simConfig, output=True) sim.simulate() if output: return (pops, cells, conns, st...
[ "def", "createSimulate", "(", "netParams", "=", "None", ",", "simConfig", "=", "None", ",", "output", "=", "False", ")", ":", "from", ".", ".", "import", "sim", "(", "pops", ",", "cells", ",", "conns", ",", "stims", ",", "rxd", ",", "simData", ")", ...
Sequence of commands create, simulate and analyse network
[ "Sequence", "of", "commands", "create", "simulate", "and", "analyse", "network" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L69-L75
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
intervalCreateSimulateAnalyze
def intervalCreateSimulateAnalyze (netParams=None, simConfig=None, output=False, interval=None): ''' Sequence of commands create, simulate and analyse network ''' import os from .. import sim (pops, cells, conns, stims, rxd, simData) = sim.create(netParams, simConfig, output=True) try: if si...
python
def intervalCreateSimulateAnalyze (netParams=None, simConfig=None, output=False, interval=None): ''' Sequence of commands create, simulate and analyse network ''' import os from .. import sim (pops, cells, conns, stims, rxd, simData) = sim.create(netParams, simConfig, output=True) try: if si...
[ "def", "intervalCreateSimulateAnalyze", "(", "netParams", "=", "None", ",", "simConfig", "=", "None", ",", "output", "=", "False", ",", "interval", "=", "None", ")", ":", "import", "os", "from", ".", ".", "import", "sim", "(", "pops", ",", "cells", ",", ...
Sequence of commands create, simulate and analyse network
[ "Sequence", "of", "commands", "create", "simulate", "and", "analyse", "network" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L92-L110
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
load
def load (filename, simConfig=None, output=False, instantiate=True, createNEURONObj=True): ''' Sequence of commands load, simulate and analyse network ''' from .. import sim sim.initialize() # create network object and set cfg and net params sim.cfg.createNEURONObj = createNEURONObj sim.loadAll(fil...
python
def load (filename, simConfig=None, output=False, instantiate=True, createNEURONObj=True): ''' Sequence of commands load, simulate and analyse network ''' from .. import sim sim.initialize() # create network object and set cfg and net params sim.cfg.createNEURONObj = createNEURONObj sim.loadAll(fil...
[ "def", "load", "(", "filename", ",", "simConfig", "=", "None", ",", "output", "=", "False", ",", "instantiate", "=", "True", ",", "createNEURONObj", "=", "True", ")", ":", "from", ".", ".", "import", "sim", "sim", ".", "initialize", "(", ")", "# create...
Sequence of commands load, simulate and analyse network
[ "Sequence", "of", "commands", "load", "simulate", "and", "analyse", "network" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L116-L136
Neurosim-lab/netpyne
netpyne/sim/wrappers.py
createExportNeuroML2
def createExportNeuroML2 (netParams=None, simConfig=None, reference=None, connections=True, stimulations=True, output=False, format='xml'): ''' Sequence of commands to create and export network to NeuroML2 ''' from .. import sim import __main__ as top if not netParams: netParams = top.netParams if n...
python
def createExportNeuroML2 (netParams=None, simConfig=None, reference=None, connections=True, stimulations=True, output=False, format='xml'): ''' Sequence of commands to create and export network to NeuroML2 ''' from .. import sim import __main__ as top if not netParams: netParams = top.netParams if n...
[ "def", "createExportNeuroML2", "(", "netParams", "=", "None", ",", "simConfig", "=", "None", ",", "reference", "=", "None", ",", "connections", "=", "True", ",", "stimulations", "=", "True", ",", "output", "=", "False", ",", "format", "=", "'xml'", ")", ...
Sequence of commands to create and export network to NeuroML2
[ "Sequence", "of", "commands", "to", "create", "and", "export", "network", "to", "NeuroML2" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/sim/wrappers.py#L164-L180
Neurosim-lab/netpyne
netpyne/analysis/utils.py
exception
def exception(function): """ A decorator that wraps the passed in function and prints exception should one occur """ @functools.wraps(function) def wrapper(*args, **kwargs): try: return function(*args, **kwargs) except Exception as e: # print err ...
python
def exception(function): """ A decorator that wraps the passed in function and prints exception should one occur """ @functools.wraps(function) def wrapper(*args, **kwargs): try: return function(*args, **kwargs) except Exception as e: # print err ...
[ "def", "exception", "(", "function", ")", ":", "@", "functools", ".", "wraps", "(", "function", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "function", "(", "*", "args", ",", "*", "*", "kwargs",...
A decorator that wraps the passed in function and prints exception should one occur
[ "A", "decorator", "that", "wraps", "the", "passed", "in", "function", "and", "prints", "exception", "should", "one", "occur" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/utils.py#L54-L68
Neurosim-lab/netpyne
netpyne/analysis/utils.py
invertDictMapping
def invertDictMapping(d): """ Invert mapping of dictionary (i.e. map values to list of keys) """ inv_map = {} for k, v in d.items(): inv_map[v] = inv_map.get(v, []) inv_map[v].append(k) return inv_map
python
def invertDictMapping(d): """ Invert mapping of dictionary (i.e. map values to list of keys) """ inv_map = {} for k, v in d.items(): inv_map[v] = inv_map.get(v, []) inv_map[v].append(k) return inv_map
[ "def", "invertDictMapping", "(", "d", ")", ":", "inv_map", "=", "{", "}", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "inv_map", "[", "v", "]", "=", "inv_map", ".", "get", "(", "v", ",", "[", "]", ")", "inv_map", "[", "v", ...
Invert mapping of dictionary (i.e. map values to list of keys)
[ "Invert", "mapping", "of", "dictionary", "(", "i", ".", "e", ".", "map", "values", "to", "list", "of", "keys", ")" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/utils.py#L309-L315
Neurosim-lab/netpyne
netpyne/analysis/utils.py
getSpktSpkid
def getSpktSpkid(cellGids=[], timeRange=None, allCells=False): '''return spike ids and times; with allCells=True just need to identify slice of time so can omit cellGids''' from .. import sim import pandas as pd try: # Pandas 0.24 and later from pandas import _lib as pandaslib except: #...
python
def getSpktSpkid(cellGids=[], timeRange=None, allCells=False): '''return spike ids and times; with allCells=True just need to identify slice of time so can omit cellGids''' from .. import sim import pandas as pd try: # Pandas 0.24 and later from pandas import _lib as pandaslib except: #...
[ "def", "getSpktSpkid", "(", "cellGids", "=", "[", "]", ",", "timeRange", "=", "None", ",", "allCells", "=", "False", ")", ":", "from", ".", ".", "import", "sim", "import", "pandas", "as", "pd", "try", ":", "# Pandas 0.24 and later", "from", "pandas", "im...
return spike ids and times; with allCells=True just need to identify slice of time so can omit cellGids
[ "return", "spike", "ids", "and", "times", ";", "with", "allCells", "=", "True", "just", "need", "to", "identify", "slice", "of", "time", "so", "can", "omit", "cellGids" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/utils.py#L321-L341
Neurosim-lab/netpyne
netpyne/support/recxelectrode.py
RecXElectrode.calcTransferResistance
def calcTransferResistance(self, gid, seg_coords): """Precompute mapping from segment to electrode locations""" sigma = 0.3 # mS/mm # Value used in NEURON extracellular recording example ("extracellular_stim_and_rec") # rho = 35.4 # ohm cm, squid axon cytoplasm = 2.8249e-2 S/cm = 0.0...
python
def calcTransferResistance(self, gid, seg_coords): """Precompute mapping from segment to electrode locations""" sigma = 0.3 # mS/mm # Value used in NEURON extracellular recording example ("extracellular_stim_and_rec") # rho = 35.4 # ohm cm, squid axon cytoplasm = 2.8249e-2 S/cm = 0.0...
[ "def", "calcTransferResistance", "(", "self", ",", "gid", ",", "seg_coords", ")", ":", "sigma", "=", "0.3", "# mS/mm ", "# Value used in NEURON extracellular recording example (\"extracellular_stim_and_rec\")", "# rho = 35.4 # ohm cm, squid axon cytoplasm = 2.8249e-2 S/cm = 0.028 S/cm...
Precompute mapping from segment to electrode locations
[ "Precompute", "mapping", "from", "segment", "to", "electrode", "locations" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/recxelectrode.py#L67-L105
Neurosim-lab/netpyne
netpyne/analysis/info.py
nTE
def nTE(cells1 = [], cells2 = [], spks1 = None, spks2 = None, timeRange = None, binSize = 20, numShuffle = 30): ''' Calculate normalized transfer entropy - cells1 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells from which to obtain spike train 1 (default: [...
python
def nTE(cells1 = [], cells2 = [], spks1 = None, spks2 = None, timeRange = None, binSize = 20, numShuffle = 30): ''' Calculate normalized transfer entropy - cells1 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells from which to obtain spike train 1 (default: [...
[ "def", "nTE", "(", "cells1", "=", "[", "]", ",", "cells2", "=", "[", "]", ",", "spks1", "=", "None", ",", "spks2", "=", "None", ",", "timeRange", "=", "None", ",", "binSize", "=", "20", ",", "numShuffle", "=", "30", ")", ":", "from", "neuron", ...
Calculate normalized transfer entropy - cells1 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells from which to obtain spike train 1 (default: []) - cells2 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells from which ...
[ "Calculate", "normalized", "transfer", "entropy", "-", "cells1", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Subset", "of", "cell...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/info.py#L33-L136
Neurosim-lab/netpyne
netpyne/analysis/info.py
granger
def granger(cells1 = [], cells2 = [], spks1 = None, spks2 = None, label1 = 'spkTrain1', label2 = 'spkTrain2', timeRange = None, binSize=5, plotFig = True, saveData = None, saveFig = None, showFig = True): ''' Calculate and optionally plot Granger Causality - cells1 (['all',|'allCells','allNetStim...
python
def granger(cells1 = [], cells2 = [], spks1 = None, spks2 = None, label1 = 'spkTrain1', label2 = 'spkTrain2', timeRange = None, binSize=5, plotFig = True, saveData = None, saveFig = None, showFig = True): ''' Calculate and optionally plot Granger Causality - cells1 (['all',|'allCells','allNetStim...
[ "def", "granger", "(", "cells1", "=", "[", "]", ",", "cells2", "=", "[", "]", ",", "spks1", "=", "None", ",", "spks2", "=", "None", ",", "label1", "=", "'spkTrain1'", ",", "label2", "=", "'spkTrain2'", ",", "timeRange", "=", "None", ",", "binSize", ...
Calculate and optionally plot Granger Causality - cells1 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells from which to obtain spike train 1 (default: []) - cells2 (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Subset of cells ...
[ "Calculate", "and", "optionally", "plot", "Granger", "Causality", "-", "cells1", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Subs...
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/info.py#L143-L272
Neurosim-lab/netpyne
netpyne/conversion/excel.py
importConnFromExcel
def importConnFromExcel (fileName, sheetName): ''' Import connectivity rules from Excel sheet''' import openpyxl as xl # set columns colPreTags = 0 # 'A' colPostTags = 1 # 'B' colConnFunc = 2 # 'C' colSyn = 3 # 'D' colProb = 5 # 'F' colWeight = 6 # 'G' colAnnot = 8 # 'I' o...
python
def importConnFromExcel (fileName, sheetName): ''' Import connectivity rules from Excel sheet''' import openpyxl as xl # set columns colPreTags = 0 # 'A' colPostTags = 1 # 'B' colConnFunc = 2 # 'C' colSyn = 3 # 'D' colProb = 5 # 'F' colWeight = 6 # 'G' colAnnot = 8 # 'I' o...
[ "def", "importConnFromExcel", "(", "fileName", ",", "sheetName", ")", ":", "import", "openpyxl", "as", "xl", "# set columns", "colPreTags", "=", "0", "# 'A'", "colPostTags", "=", "1", "# 'B'", "colConnFunc", "=", "2", "# 'C'", "colSyn", "=", "3", "# 'D'", "c...
Import connectivity rules from Excel sheet
[ "Import", "connectivity", "rules", "from", "Excel", "sheet" ]
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/excel.py#L19-L75
vmware/nsxramlclient
nsxramlclient/client.py
NsxClient.read
def read(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to read a resource using the GET HTTP Method :param searched_resource: A valid display name in the RAML file matching the reso...
python
def read(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to read a resource using the GET HTTP Method :param searched_resource: A valid display name in the RAML file matching the reso...
[ "def", "read", "(", "self", ",", "searched_resource", ",", "uri_parameters", "=", "None", ",", "request_body_dict", "=", "None", ",", "query_parameters_dict", "=", "None", ",", "additional_headers", "=", "None", ")", ":", "return", "self", ".", "_request", "("...
This method is used to read a resource using the GET HTTP Method :param searched_resource: A valid display name in the RAML file matching the resource :param uri_parameters: A dictionary with the URI Parameters expected by the resource :param request_body_dict: A dictionary containing the body p...
[ "This", "method", "is", "used", "to", "read", "a", "resource", "using", "the", "GET", "HTTP", "Method", ":", "param", "searched_resource", ":", "A", "valid", "display", "name", "in", "the", "RAML", "file", "matching", "the", "resource", ":", "param", "uri_...
train
https://github.com/vmware/nsxramlclient/blob/2ff892f9fb6c6bad411df2258e3a98475d0d5091/nsxramlclient/client.py#L71-L85
vmware/nsxramlclient
nsxramlclient/client.py
NsxClient.create
def create(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to create a resource using the POST HTTP Method :param searched_resource: A valid display name in the RAML file matching t...
python
def create(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to create a resource using the POST HTTP Method :param searched_resource: A valid display name in the RAML file matching t...
[ "def", "create", "(", "self", ",", "searched_resource", ",", "uri_parameters", "=", "None", ",", "request_body_dict", "=", "None", ",", "query_parameters_dict", "=", "None", ",", "additional_headers", "=", "None", ")", ":", "return", "self", ".", "_request", "...
This method is used to create a resource using the POST HTTP Method :param searched_resource: A valid display name in the RAML file matching the resource :param uri_parameters: A dictionary with the URI Parameters expected by the resource :param request_body_dict: A dictionary containing the bod...
[ "This", "method", "is", "used", "to", "create", "a", "resource", "using", "the", "POST", "HTTP", "Method", ":", "param", "searched_resource", ":", "A", "valid", "display", "name", "in", "the", "RAML", "file", "matching", "the", "resource", ":", "param", "u...
train
https://github.com/vmware/nsxramlclient/blob/2ff892f9fb6c6bad411df2258e3a98475d0d5091/nsxramlclient/client.py#L87-L102
vmware/nsxramlclient
nsxramlclient/client.py
NsxClient.update
def update(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to update a resource using the PUT HTTP Method :param searched_resource: A valid display name in the RAML file matching th...
python
def update(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to update a resource using the PUT HTTP Method :param searched_resource: A valid display name in the RAML file matching th...
[ "def", "update", "(", "self", ",", "searched_resource", ",", "uri_parameters", "=", "None", ",", "request_body_dict", "=", "None", ",", "query_parameters_dict", "=", "None", ",", "additional_headers", "=", "None", ")", ":", "return", "self", ".", "_request", "...
This method is used to update a resource using the PUT HTTP Method :param searched_resource: A valid display name in the RAML file matching the resource :param uri_parameters: A dictionary with the URI Parameters expected by the resource :param request_body_dict: A dictionary containing the body...
[ "This", "method", "is", "used", "to", "update", "a", "resource", "using", "the", "PUT", "HTTP", "Method", ":", "param", "searched_resource", ":", "A", "valid", "display", "name", "in", "the", "RAML", "file", "matching", "the", "resource", ":", "param", "ur...
train
https://github.com/vmware/nsxramlclient/blob/2ff892f9fb6c6bad411df2258e3a98475d0d5091/nsxramlclient/client.py#L104-L119
vmware/nsxramlclient
nsxramlclient/client.py
NsxClient.delete
def delete(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to delete a resource using the DELETE HTTP Method :param searched_resource: A valid display name in the RAML file matching...
python
def delete(self, searched_resource, uri_parameters=None, request_body_dict=None, query_parameters_dict=None, additional_headers=None): """ This method is used to delete a resource using the DELETE HTTP Method :param searched_resource: A valid display name in the RAML file matching...
[ "def", "delete", "(", "self", ",", "searched_resource", ",", "uri_parameters", "=", "None", ",", "request_body_dict", "=", "None", ",", "query_parameters_dict", "=", "None", ",", "additional_headers", "=", "None", ")", ":", "return", "self", ".", "_request", "...
This method is used to delete a resource using the DELETE HTTP Method :param searched_resource: A valid display name in the RAML file matching the resource :param uri_parameters: A dictionary with the URI Parameters expected by the resource :param request_body_dict: A dictionary containing the b...
[ "This", "method", "is", "used", "to", "delete", "a", "resource", "using", "the", "DELETE", "HTTP", "Method", ":", "param", "searched_resource", ":", "A", "valid", "display", "name", "in", "the", "RAML", "file", "matching", "the", "resource", ":", "param", ...
train
https://github.com/vmware/nsxramlclient/blob/2ff892f9fb6c6bad411df2258e3a98475d0d5091/nsxramlclient/client.py#L121-L136
vmware/nsxramlclient
nsxramlclient/http_session.py
Session.do_request
def do_request(self, method, url, data=None, headers=None, params=None): """ Handle API requests / responses transport :param method: HTTP method to use as string :param data: Any data as PyDict (will be converted to XML string) :param headers: Any data as PyDict :return...
python
def do_request(self, method, url, data=None, headers=None, params=None): """ Handle API requests / responses transport :param method: HTTP method to use as string :param data: Any data as PyDict (will be converted to XML string) :param headers: Any data as PyDict :return...
[ "def", "do_request", "(", "self", ",", "method", ",", "url", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "params", "=", "None", ")", ":", "response_content", "=", "None", "if", "data", ":", "if", "headers", ":", "headers", ".", "updat...
Handle API requests / responses transport :param method: HTTP method to use as string :param data: Any data as PyDict (will be converted to XML string) :param headers: Any data as PyDict :return: If response is XML then an xml.etree.ElementTree else the raw content :raise: Any u...
[ "Handle", "API", "requests", "/", "responses", "transport" ]
train
https://github.com/vmware/nsxramlclient/blob/2ff892f9fb6c6bad411df2258e3a98475d0d5091/nsxramlclient/http_session.py#L78-L127
zerwes/hiyapyco
hiyapyco/odyldo.py
safe_dump
def safe_dump(data, stream=None, **kwds): """implementation of safe dumper using Ordered Dict Yaml Dumper""" return yaml.dump(data, stream=stream, Dumper=ODYD, **kwds)
python
def safe_dump(data, stream=None, **kwds): """implementation of safe dumper using Ordered Dict Yaml Dumper""" return yaml.dump(data, stream=stream, Dumper=ODYD, **kwds)
[ "def", "safe_dump", "(", "data", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "yaml", ".", "dump", "(", "data", ",", "stream", "=", "stream", ",", "Dumper", "=", "ODYD", ",", "*", "*", "kwds", ")" ]
implementation of safe dumper using Ordered Dict Yaml Dumper
[ "implementation", "of", "safe", "dumper", "using", "Ordered", "Dict", "Yaml", "Dumper" ]
train
https://github.com/zerwes/hiyapyco/blob/b0b42724cc13b1412f5bb5d92fd4c637d6615edb/hiyapyco/odyldo.py#L76-L78
zerwes/hiyapyco
hiyapyco/__init__.py
dump
def dump(data, **kwds): """dump the data as YAML""" if _usedefaultyamlloader: return yaml.safe_dump(data, **kwds) else: return odyldo.safe_dump(data, **kwds)
python
def dump(data, **kwds): """dump the data as YAML""" if _usedefaultyamlloader: return yaml.safe_dump(data, **kwds) else: return odyldo.safe_dump(data, **kwds)
[ "def", "dump", "(", "data", ",", "*", "*", "kwds", ")", ":", "if", "_usedefaultyamlloader", ":", "return", "yaml", ".", "safe_dump", "(", "data", ",", "*", "*", "kwds", ")", "else", ":", "return", "odyldo", ".", "safe_dump", "(", "data", ",", "*", ...
dump the data as YAML
[ "dump", "the", "data", "as", "YAML" ]
train
https://github.com/zerwes/hiyapyco/blob/b0b42724cc13b1412f5bb5d92fd4c637d6615edb/hiyapyco/__init__.py#L413-L418
andycasey/ads
ads/export.py
ExportQuery.execute
def execute(self): """ Execute the http request to the export service :return ads-classic formatted export string """ url = os.path.join(self.HTTP_ENDPOINT, self.format) self.response = ExportResponse.load_http_response( self.session.post(url, data=self.json_p...
python
def execute(self): """ Execute the http request to the export service :return ads-classic formatted export string """ url = os.path.join(self.HTTP_ENDPOINT, self.format) self.response = ExportResponse.load_http_response( self.session.post(url, data=self.json_p...
[ "def", "execute", "(", "self", ")", ":", "url", "=", "os", ".", "path", ".", "join", "(", "self", ".", "HTTP_ENDPOINT", ",", "self", ".", "format", ")", "self", ".", "response", "=", "ExportResponse", ".", "load_http_response", "(", "self", ".", "sessi...
Execute the http request to the export service :return ads-classic formatted export string
[ "Execute", "the", "http", "request", "to", "the", "export", "service", ":", "return", "ads", "-", "classic", "formatted", "export", "string" ]
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/export.py#L56-L65
andycasey/ads
ads/search.py
Article._get_field
def _get_field(self, field): """ Queries the api for a single field for the record by `id`. This method should only be called indirectly by cached properties. :param field: name of the record field to load """ if not hasattr(self, "id") or self.id is None: rai...
python
def _get_field(self, field): """ Queries the api for a single field for the record by `id`. This method should only be called indirectly by cached properties. :param field: name of the record field to load """ if not hasattr(self, "id") or self.id is None: rai...
[ "def", "_get_field", "(", "self", ",", "field", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"id\"", ")", "or", "self", ".", "id", "is", "None", ":", "raise", "APIResponseError", "(", "\"Cannot query an article without an id\"", ")", "sq", "=", "n...
Queries the api for a single field for the record by `id`. This method should only be called indirectly by cached properties. :param field: name of the record field to load
[ "Queries", "the", "api", "for", "a", "single", "field", "for", "the", "record", "by", "id", ".", "This", "method", "should", "only", "be", "called", "indirectly", "by", "cached", "properties", ".", ":", "param", "field", ":", "name", "of", "the", "record...
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/search.py#L111-L132
andycasey/ads
ads/search.py
Article.bibtex
def bibtex(self): """Return a BiBTeX entry for the current article.""" warnings.warn("bibtex should be queried with ads.ExportQuery(); You will " "hit API ratelimits very quickly otherwise.", UserWarning) return ExportQuery(bibcodes=self.bibcode, format="bibtex").execute()
python
def bibtex(self): """Return a BiBTeX entry for the current article.""" warnings.warn("bibtex should be queried with ads.ExportQuery(); You will " "hit API ratelimits very quickly otherwise.", UserWarning) return ExportQuery(bibcodes=self.bibcode, format="bibtex").execute()
[ "def", "bibtex", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"bibtex should be queried with ads.ExportQuery(); You will \"", "\"hit API ratelimits very quickly otherwise.\"", ",", "UserWarning", ")", "return", "ExportQuery", "(", "bibcodes", "=", "self", ".", "...
Return a BiBTeX entry for the current article.
[ "Return", "a", "BiBTeX", "entry", "for", "the", "current", "article", "." ]
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/search.py#L292-L296
andycasey/ads
ads/search.py
SolrResponse.articles
def articles(self): """ articles getter """ if self._articles is None: self._articles = [] for doc in self.docs: # ensure all fields in the "fl" are in the doc to address # issue #38 for k in set(self.fl).difference(...
python
def articles(self): """ articles getter """ if self._articles is None: self._articles = [] for doc in self.docs: # ensure all fields in the "fl" are in the doc to address # issue #38 for k in set(self.fl).difference(...
[ "def", "articles", "(", "self", ")", ":", "if", "self", ".", "_articles", "is", "None", ":", "self", ".", "_articles", "=", "[", "]", "for", "doc", "in", "self", ".", "docs", ":", "# ensure all fields in the \"fl\" are in the doc to address", "# issue #38", "f...
articles getter
[ "articles", "getter" ]
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/search.py#L326-L338
andycasey/ads
ads/search.py
SearchQuery.progress
def progress(self): """ Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found """ if self.response is None: return "Query has not been executed" ...
python
def progress(self): """ Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found """ if self.response is None: return "Query has not been executed" ...
[ "def", "progress", "(", "self", ")", ":", "if", "self", ".", "response", "is", "None", ":", "return", "\"Query has not been executed\"", "return", "\"{}/{}\"", ".", "format", "(", "len", "(", "self", ".", "articles", ")", ",", "self", ".", "response", ".",...
Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found
[ "Returns", "a", "string", "representation", "of", "the", "progress", "of", "the", "search", "such", "as", "1234", "/", "5000", "which", "refers", "to", "the", "number", "of", "results", "retrived", "/", "the", "total", "number", "of", "results", "found" ]
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/search.py#L461-L469
andycasey/ads
ads/search.py
SearchQuery.execute
def execute(self): """ Sends the http request implied by the self.query In addition, set up the request such that we can call next() to provide the next page of results """ self.response = SolrResponse.load_http_response( self.session.get(self.HTTP_ENDPOINT, p...
python
def execute(self): """ Sends the http request implied by the self.query In addition, set up the request such that we can call next() to provide the next page of results """ self.response = SolrResponse.load_http_response( self.session.get(self.HTTP_ENDPOINT, p...
[ "def", "execute", "(", "self", ")", ":", "self", ".", "response", "=", "SolrResponse", ".", "load_http_response", "(", "self", ".", "session", ".", "get", "(", "self", ".", "HTTP_ENDPOINT", ",", "params", "=", "self", ".", "query", ")", ")", "# ADS will ...
Sends the http request implied by the self.query In addition, set up the request such that we can call next() to provide the next page of results
[ "Sends", "the", "http", "request", "implied", "by", "the", "self", ".", "query", "In", "addition", "set", "up", "the", "request", "such", "that", "we", "can", "call", "next", "()", "to", "provide", "the", "next", "page", "of", "results" ]
train
https://github.com/andycasey/ads/blob/928415e202db80658cd8532fa4c3a00d0296b5c5/ads/search.py#L526-L552