Search is not available for this dataset
text stringlengths 75 104k |
|---|
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 _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 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_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_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 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 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 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 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 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 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 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 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 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 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 _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 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 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 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 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 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 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_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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 _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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 dump(data, **kwds):
"""dump the data as YAML"""
if _usedefaultyamlloader:
return yaml.safe_dump(data, **kwds)
else:
return odyldo.safe_dump(data, **kwds) |
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 _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 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 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 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 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.