Trees | Index | Help |
|
---|
Module brain :: Class BRAIN |
|
Method Summary | |
---|---|
Create a BRAIN object for modeling. | |
Convert a BRAIN to its string representation, an NCS .in file. | |
Add an area of the indicated dimensions to the BRAIN. | |
Put COLUMN object col into the BRAIN> | |
Add a BRAIN-level connect from col frm to col to. | |
Put a REPORT in the BRAIN section of the .in file for report r. | |
This is an easier interface to use than AddReport. | |
Add a stim to the BRAIN. | |
Adds a CURRENT pulse STIMULUS block to force a spike at each time in spikelist (given in secs). | |
Create a stimulus file that applies a current spike at the times in spikelist and arrange for that file to be applied. | |
Create stimulus into addr at the times (in sec) given in spikelist. | |
Puts a STIMULUS_INJECT param in the BRAIN for given stimulus. | |
(DEPRECATED) Add a BRAIN level connect from cols c1 to c2. | |
(EXPERIMENTAL) Connect two areas together. | |
Return an independently modifiable copy of supplied element named 'fromtype' into name 'newtype' in container. | |
NCS requires a COLUMN_SHELL for each col. | |
EmitLayerShell(self,
cn,
u,
l)
| |
(EXPERIMENTAL) Create an enumerated column. | |
Return the BRAIN's JOB parm value. | |
Return a list of the port numbers this BRAIN is configured to use for port (network) based reporting. | |
Return a list of the port numbers this BRAIN is configured to use for port (network) based stimulus input. | |
Return an ordered list of integer *strengths* of all synapses in the brain. | |
Return explicit address of the possibly only partially specified brain address in 'to'. | |
Pick a sensible input layer, cell, cmp | |
Pick a sensible output layer, cell, cmp. | |
Use netplot to plot a 3D representation of the BRAIN. | |
Simulate the BRAIN with NCS. | |
Allow user to set the current component library from the set of defined libs. | |
Set synapses strengths in the brain to values in newstr[]. | |
SingleCellColumn(self,
colname,
synapseprefix,
w,
h,
xloc,
yloc,
lays,
cells,
syns)
| |
Standard1CellColumn(self,
colname,
loc)
| |
Standard1LayerColumn(self,
colname,
synapseprefix,
w,
h,
xloc,
yloc,
lays,
cells,
syns,
comptypes)
| |
NOTE that for this column we add the layers to lays here rather than in the StandardLayer routine above. | |
Standard6LayerColumn(self,
colname,
synapseprefix,
w,
h,
xloc,
yloc,
lays,
cells,
syns,
comptypes)
| |
Add to cells hash a standard cell named 'name' containing one standard SOMA1 compartment. | |
StandardCells(self,
comptypes)
| |
StandardChannels(self)
| |
StandardCompartments(self,
spks,
chans)
| |
make an Enumerated column with three layers of standard sizes of exc and inh cells | |
StandardLayers(self,
syns,
cells,
syncols)
| |
StandardPSGs(self,
epsc,
ipsc)
| |
StandardSFDs(self)
| |
StandardSLs(self)
| |
StandardSpikes(self)
| |
Return a set of standard channel types, spikes, compartment types, ... | |
Creates multiple instances of base synapse type with different USE levels for different strengths of connection. | |
Add all the referenced substructures from the synapse to the appropriate lists in the brain so that they can be conveniently printed. | |
Returns BRAIN class version string. |
Class Variable Summary | |
---|---|
str |
__version__ = '5.0'
|
dict |
areas = {}
|
int |
autocolnum = 0 |
int |
autostiminjnum = 0 |
int |
autostimnum = 0 |
classobj |
CELL = brain.CELL |
classobj |
CHANNEL = brain.CHANNEL |
classobj |
COLUMN = brain.COLUMN |
classobj |
COMPARTMENT = brain.COMPARTMENT |
dict |
defaultparms = {'DISTANCE': 'YES', 'OUTPUT_CONNECT_MAP':...
|
classobj |
EnumeratedArea = brain.EnumeratedArea |
classobj |
LAYER = brain.LAYER |
dict |
libs = {}
|
dict |
parms = {}
|
list |
pt = ['TYPE', 'FSV', 'JOB', 'PORT', 'SERVER', 'SERVER_PO...
|
classobj |
REPORT = brain.REPORT |
list |
reportports = []
|
classobj |
SPIKESHAPE = brain.SPIKESHAPE |
list |
stimports = []
|
classobj |
STIMULUS = brain.STIMULUS |
classobj |
STIMULUS_INJECT = brain.STIMULUS_INJECT |
classobj |
SYN_FACIL_DEPRESS = brain.SYN_FACIL_DEPRESS |
classobj |
SYN_LEARNING = brain.SYN_LEARNING |
classobj |
SYN_PSG = brain.SYN_PSG |
classobj |
SYNAPSE = brain.SYNAPSE |
NoneType |
syns = None |
Method Details |
---|
__init__(self,
parms={},
epsc=None,
ipsc=None)
|
__repr__(self)
Convert a BRAIN to its string representation, an NCS .in file.
|
AddArea(self, areaname, hx, hy, mx, my, w, h, xloc, yloc, colfunc, lays, cells, syns, comptypes)Add an area of the indicated dimensions to the BRAIN. (EXPERIMENTAL) This worked in earlier releases but hasn't been tested lately. Areas have no direct counterpart in the NCS .in file; we expand this request to a corresponding set of columns, and keep a record in the brain of the areas added. Note that since we need to create custom columns, with our area-name prefix and using requested synapses, we pass a column creator function (colfunc) in to AddArea rather than passing in a column name. If we passed in a column name we could perhaps clone that column, and modify the name, but that's ugly. (Actually, it might not be that bad to allow either one.) hx, hy: hypercolumn x and y dimensions mx, my: x andy dims in minicols within each hypercol |
AddColumn(self, col)Put COLUMN object col into the BRAIN> Should this really be AddColumnType()? Maybe, but NCS calls them COLUMN_TYPES in the BRAIN section even though there really isn't any "type-of" abstraction; each COLUMN_TYPE must reference a COLUMN block below. First, they probably shouldn't be called COLUMN_TYPES in the BRAIN section; they should be called COLUMN. And the COLUMN..END_COLUMN blocks should be called COLUMN_TYPE. Similarly, LAYER_TYPES are specified in COLUMN..END_COLUMN blocks, but they should be LAYER. Hmm. The TYPE name of the column may not be defined when the COLUMN is initially created; in this case it will be generated automatically when the COLUMN is added to the BRAIN. |
AddConnect(self, frm, to, synapse=None, prob=0.10000000000000001, speed=10.0)Add a BRAIN-level connect from col frm to col to. Uses new style arguments, addressing with GuessConnect(). NOTE that frmcol, frmlay, etc. can be text names OR variables that point to objects! we try to be smart and accept the minimum amount of information the minimum required is frmcol and tocol, and from that we may be able to figure everything else out (if, for example, there is only one layer in the column or if one layer is designated as the _INPUT or _OUTPUT layer) |
AddReport(self, r)Put a REPORT in the BRAIN section of the .in file for report r. |
AddSimpleReport(self, repname, addr, reptype='v', freq=1, port=None, ip='134.197.40.155', prob=1.0, dur=(0.0, 1.0), synname=None, format='ascii')This is an easier interface to use than AddReport. It doesn't require any knowledge of NCS .in file syntax and keywords. Arguments can be either variables that contain the object you are reporting on, or string names of those items. (CHECK THIS) Uses the unified column addressing scheme (GuessConnect). reptype is report type, 'v' for voltage, 'c' for current, 'a' for SYNAPSE_USE, 'r' for SYNAPSE_RSE (add more later). filename for report will be brainname-repname.txt (NCS itself prepends brainname to reports.) |
AddSimpleStim(self, stimname, col, stimtype, freqrows=None, cellsperfreq=None, timefreqinc=None, ampstart=None, ampend=None, width=None, freqstart=None, dur=(0.0, 1.0), dynrange=(0, 200), port=None, ip=None, filename=None, pattern='LINEAR')Add a stim to the BRAIN. Changed to use new tuple addressing. |
AddSpikeStim(self, addr, spikelist, stimname=None)Adds a CURRENT pulse STIMULUS block to force a spike at each time in spikelist (given in secs). |
AddSpikeTrainFileStim(self, stimname, area, layer, cellgrp, spikelist)Create a stimulus file that applies a current spike at the times in spikelist and arrange for that file to be applied. The file will contain a probability 1.0, at the indicated time, for the application of a CURRENT spike sufficient to cause any reasonable cell to fire. Because of the NCS FIREWIND (firewindos) limitation, we force the TIME_FREQ_INCREMENT to be the smallest usable value, .0025 seconds, which limits the resolution of the spike applications. Another way of doing this would be to create a separate PULSE stim for each pulse in the list. The .in file could end up with thousands of PULSE STIMULUS blocks. Probably impractical but the timing would be more precise. AddSpikeTrainPulseStim will do things this way. FIXME: change to use new GuessInput tuple addressing. FIXME: currently CELLS_PER_FREQ hardcoded to 1 . . . NOTE: a TIME_FREQ_INCREMENT of less than .0025 (the FIREWIND firewindow value) does not work. It is as if the stimulus is not applied |
AddSpikeTrainPulseStim(self, stimname, area, layer, cellgrp, spikelist, cmp=None)Create stimulus into addr at the times (in sec) given in spikelist. NOTE: This is an older interface. Recommend use of AddSpikeStim() instead, since that takes the new uniform addressing approach. area is an area or column name or variable where to apply the stim. A separate STIMULUS mode PULSE block will be defined for each spike in spikelist. This will take up more space in the .in file than using a FileStim (see AddSpikeTrainFileStim) but does not require a separate file to contain the stim, and allows Assumes compartment to apply stim is named "SOMA1_name". FIXME Requires target area (really col), layer, cellgrp to be strings not vars. |
AddStimInject(self, s)Puts a STIMULUS_INJECT param in the BRAIN for given stimulus. s should be the *variable* that contains the actual stimulus of the requested type |
ColumnConnect(self, c1, c2, lays, cells, syn, prob, speed)(DEPRECATED) Add a BRAIN level connect from cols c1 to c2. Use AddConnect() instead. This is kept around since it was working with enumerated columns too. Move that feature from here to AddColumn() at some point. columns may either be enumerated or not (Enumerated cols have not been tested recently.) Four possibilities: src enum, dst enum src enum, dst not src not, dst enum src not, dst not ( "normal" NCS) if we do things right, the number of connections for each type will end up the same on average for each approach so if src is not enum, and dest is enum, we'll get the size of the src cell group and for each cell in there, do a probability check for each cell in enumerated dest cell group. ISSUE: a prob 1 connect from a cellgroup of, say, size 16 to a cell group of size 1 causes 16 connects. setting prob to e.g. 1/16 fixes that problem, but be aware that there won't necessarily even be one connection made and might be more than one! As long as one is made on average that should be OK. This only applies to connections made from one enumerated to non-enumerated area, not enum to enum. |
ConnectAreas(self, a1, a2, connecttype, syn, prob, speed, lays, cells)(EXPERIMENTAL) Connect two areas together. (Needs to be retested.) connect patterns: 'all' 'corresponding': source and dest areas must have same dims. x,y in src -> x,y in dest 'random': 'neighbors-same-minicol': 'neighbors-other-minicols': Pass in two probabilities? 1: prob. that we will make a column to column connect here this determines how many USE values we keep 2: prob. passed to NCS .in file to be used for cell group to cell group connections the actual USE value (initial strength of connection) is determined by the synapse value passed in All routines should work whether src, dst, or both are enumerated or 'normal' NCS cols |
Copy(self, container, fromtype, newtype)Return an independently modifiable copy of supplied element named 'fromtype' into name 'newtype' in container. This makes it easy to create a base type of something (like a cell) and then make variants of that base type. Usually after making a copy, the caller will then add the element to the appropriate containter for that object type, e.g.: cn=newb.Copy(comptypes["SOMA1"]) comptypes[compname]=cn We don't actually want to do a deepcopy since that can create multiple variable instances of referenced objects with the same underlying TYPE names and cause both instances to be emitted during brain print, leading to duplicate symbol errors. Not really necessary, anyway. We DO also need to make a copy of the parms dict though, but not the individual elements in the parms array. If we don't copy the parms array then it will be shared, which is obviously bad. |
EmitColumnShell(self, cn, w, h, x, y)NCS requires a COLUMN_SHELL for each col. This emits it for column named cn. Basically it just holds spatial location for the column. However, since there is no type-of abstraction for a column, this information might as well be in the column itself. Or change NCS to have a type-of abstraction for the column. |
EnumeratedColumn(self, colname, synapseprefix, w, h, xloc, yloc, lays, cells, syns, comptypes, makelays, laycons)(EXPERIMENTAL) Create an enumerated column. makelays is a list of (e, i) excitatory, inhibitory cell pairs these will be added to lays layer list new: also inter and intralayer connection patterns, input and output layers by default no connections are made between cell groups in a layer nor between cell groups in different layers |
GetBrainJob(self)Return the BRAIN's JOB parm value. |
GetReportPorts(self)Return a list of the port numbers this BRAIN is configured to use for port (network) based reporting. |
GetStimulusPorts(self)Return a list of the port numbers this BRAIN is configured to use for port (network) based stimulus input. |
GetSynapses(self)Return an ordered list of integer *strengths* of all synapses in the brain. If the synapse stored there did not have a strength associated with it (it was a base synapse, and does not end in __<int>, then that element will be set to None. Otherwise, that element will be set to <int>. The order of this list will depend on the order in which the brain is constructed. Therefore once you start caring about the order of synapses, you should not change how the brain is built, otherwise USE connections will be moved about. FIXME: maxcond is a better indicator of synapse strength. The standard synapses should use that instead of USE. USE represents top of range in which short turm Facil and Depr adjust in; USE can be adjusted by Hebbian learning. |
GuessConnect(self, addr, inorout='out')Return explicit address of the possibly only partially specified brain address in 'to'. The addr can be a simple string or variable, in which case it is taken to refer to a column by name or by variable. Otherwise it is a tuple of (col, lay), (col, lay, cellgroup), or (col, lay, cellgroup, compartment). If partially specified, we guess the likely connection point (or only connection point) and fail if we can't guess. The addr might be specified using string names of connection points or variables or a mixture. Returns all items as vars (CONFIRM) except for compname which is a string. If inorout is 'out', try to pick likely output candidates from partially specified addresses. Otherwise, try to pick likely input candidates Maybe rework this to use named parms, then callers wouldn't spend so much time remapping args. |
GuessInput(self, tocol, tolay, tocell, tocmp)Pick a sensible input layer, cell, cmp If items are designated _INPUT, use that, or if there is only one candidate pick that. This general routine might be called for a layer-layer connect in a column so col might be None. That's OK, we just leave it as None. Conversion from string names to vars is assumed to have already taken place, e.g. in GuessConnect. |
GuessOutput(self, frmcol, frmlay, frmcell, frmcmp)Pick a sensible output layer, cell, cmp. If items are designated _OUTPUT, use that, of if there is only one candidate pick that This general routine might be called for a layer-layer connect in a column so col might be None. That's OK, we just leave it as None. Conversion from string names to vars is assumed to have already taken place, e.g. in GuessConnect. |
Plot3D(self)Use netplot to plot a 3D representation of the BRAIN. Change this from a BRAIN.method() to a brainlab function. |
Run(self, verbose=False, nprocs=1, clearreports=True, parms=None, procnum=None, showprogress=False)Simulate the BRAIN with NCS. parms allows some BRAIN parms to be overridden, if desired, for example, change the job name of an existing brain model after adjustment. Eventually change this from being a BRAIN.method to a brainlab function. |
SelectLib(self, libname)Allow user to set the current component library from the set of defined libs. |
SetSynapses(self, synstr, syns)Set synapses strengths in the brain to values in newstr[]. synstr should be same len as the set of syns we find when we enumerate them here; if not, fail with error. FIXME: maxcond is a better indicator of synapse strength. USE represents top of range in which short turm Facil and Depr adjust in; USE can be adjusted by Hebbian learning. |
Standard3LayerColumn(self, colname, synapseprefix, w, h, xloc, yloc, lays, cells, syns, comptypes)NOTE that for this column we add the layers to lays here rather than in the StandardLayer routine above. This seems like a good idea. A custom set of layers is created and added to lays for each column created. This is so that the layer connections can have CONNECTS with different synaptic USE strengths. (FIXME: make this an option that can be turned on or off.) NOTE that the referenced synapses do not have custom names; that's OK, it just means that the synapses must have the same properties for all such layers, but we can still use CONNECTS with different strengths of that class of synapse. |
StandardCell(self, name, cells, comptypes)Add to cells hash a standard cell named 'name' containing one standard SOMA1 compartment. If cell name already exists, won't add again and won't give error, just returns. |
StandardEnumeratedColumn(self, colname, synapseprefix, w, h, xloc, yloc, lays, cells, syns, comptypes)make an Enumerated column with three layers of standard sizes of exc and inh cells |
StandardStuff(self, maxcond=0.0023999999999999998, epsc=None, ipsc=None)Return a set of standard channel types, spikes, compartment types, ... Rename this. |
StandardSynapses(self, spsgs, sls, sfds, maxcond=0.0023999999999999998, syncols=[''], synlays=[''])Creates multiple instances of base synapse type with different USE levels for different strengths of connection. References to same synapse type of a particular USE will create *instances* of that type of synapse in the runtime, of course, which can then vary based on dynamics syncols and synlays are used to create multiple types of synapses with different prefixes (per column or layers). Pass them in as [""] if that is not desired. NOTE: maxcond does not apply to syncols and synlays versions, only base set. Actually, it applies to all now. FIXME: it makes more sense to have different inital MAXCOND values rather than ABSOLUTE_USE values if you are trying to vary the initial strength of synapses . . . |
TraverseSynapse(self, synapse, synapses, syn_psg, syn_learning, syn_facil_depress)Add all the referenced substructures from the synapse to the appropriate lists in the brain so that they can be conveniently printed. |
version(self)Returns BRAIN class version string. |
Class Variable Details |
---|
__version__
|
areas
|
autocolnum
|
autostiminjnum
|
autostimnum
|
libs
|
parms
|
pt
|
reportports
|
stimports
|
syns
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Apr 16 14:14:53 2005 | http://epydoc.sf.net |