Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection rule #2

Open
wants to merge 55 commits into
base: connection_rule
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
773408c
removed main blocks
Apr 16, 2015
8736186
tracking down stray "ComponentClass" references
Apr 16, 2015
fb7713b
renamed 'componentclass' to 'component_class' to match naming
Apr 16, 2015
7259b69
removed user layer Dynamics, ConnectionRule, RandomDistribution
Apr 17, 2015
3150ddf
renamed *Class to * (e.g. DynamicsClass to Dynamics)
Apr 17, 2015
45d7592
added xml to gitignore within sample_components directory
Apr 17, 2015
620f2c3
cleaned up missing references to DynamicsClass
Apr 17, 2015
a6c5b99
updated iaf example with correct dimensions
Apr 17, 2015
0893416
fixed bugs with renaming source and destination to pre and post
Apr 17, 2015
49d73d4
starting to refactor port connections
Apr 17, 2015
947c33b
refactored projection syntax to match version 2 syntax
Apr 18, 2015
796928f
debugging projection refactor
Apr 19, 2015
91ff027
Unit-tests pass after refactoring of projection syntax
Apr 19, 2015
5a2e6a6
fixed typo in ComponentRequiredDefinitions method declaration
May 7, 2015
eb001b7
added num_* properties to container objects to determine the number of
May 12, 2015
8881deb
added more convenience methods for accessing members of containers
May 19, 2015
36b2a5c
added *Properties objects
May 19, 2015
db753b2
cleaned up normalise_parameter_as_list so that it can handle generators
May 25, 2015
a3195ff
removed old write method from Component and added check for dictionaries
May 25, 2015
0ea5234
added conversion of abs->fabs when writing c strings
May 26, 2015
27cb5c4
cleaned bugs so that unit-tests work
May 26, 2015
67f49f6
added strip when writing to xml to remove c code not supported
May 26, 2015
07ef173
Renamed Component to DynamicsProperties
May 28, 2015
416e4c4
changed directory structure of visitors and validators
May 28, 2015
4664169
restructured validators directories
May 28, 2015
af156c2
updated import paths
May 28, 2015
5ac1da1
removing redundant visitors
May 28, 2015
ca0de3b
remove more redundant code
May 28, 2015
b79a0f6
more refactoring of visitors
May 28, 2015
8c9bbd1
added all_expressions properties to all component classes
May 28, 2015
f5d2a75
added unit test (and debugged) all_expressions
May 28, 2015
db7fa7b
converted constant and reference to use attributes instead of body
May 29, 2015
e593ad6
added symbol property to ExpressionSymbol class
May 28, 2015
698fc30
added luminous intensity dimension and made sympy symbols real valued
Jun 3, 2015
b6400a9
made "name" an attribute of Definition and Reference (in example xml
Jun 3, 2015
11f09ed
deleted old test directory
Jun 3, 2015
905d0e3
fixed errors introduced by refactoring of reference and constants to use
Jun 3, 2015
22dee3f
added comment
Jun 3, 2015
04b098c
added subs method to Expressions and allowed elements passed to index_of
Jun 3, 2015
3f479a9
renamed validator.namingconflicts to just validator.names
Jun 3, 2015
5970e0d
added exception handling for missing XML attributes
Jun 11, 2015
43e5b32
added in bug-fixes with dimensionality validator from piecewise branch
Jun 11, 2015
5e219fe
fixed up test xml documents so they provide regime names and dimensions
Jun 11, 2015
f8fa99b
fixes to expression parser and dimension checker
Jun 11, 2015
d84738f
added random variables to transitions
Apr 17, 2015
7a99d43
added check for valid random distribution names
Apr 17, 2015
b68d760
added selection rule elements
Apr 22, 2015
1d2b199
renamed levels attribute to 'stages'
Apr 22, 2015
ca6a355
implementing visitors for connection rule syntax
Apr 23, 2015
fc28207
Expanded XML Reader, and Writer
RussellJarvis May 19, 2015
9fdcbd5
started implementing connection rule xml reader/writer
RussellJarvis May 22, 2015
1260b1e
updated syntax of connection rule
May 22, 2015
2d7fb5b
Committed everything.
RussellJarvis Jun 20, 2015
528d7ef
Made some progress with testing connection rule.
RussellJarvis Jun 25, 2015
53a2949
Created the begining of a meaningful connectionrule test, for the tar…
RussellJarvis Jun 26, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ cover
*.project
*.pydevproject
*.settings
/examples/Brunel2000/nineml_mechanisms/
*.pdf
*.synctex.gz
.9build
.swp
*.swp
*~
*.egg-info
*.dvi
Expand All @@ -30,3 +31,4 @@ cover
.sass-cache
/_site
.texlipse
/build
1 change: 1 addition & 0 deletions examples/AL/sample_components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.xml
2 changes: 1 addition & 1 deletion examples/AL/sample_components/coba_synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def get_component():
coba = al.dynamics.DynamicsClass(
coba = al.dynamics.Dynamics(
name="CobaSyn",
aliases=["I:=g*(vrev-V)", ],
regimes=[
Expand Down
27 changes: 0 additions & 27 deletions examples/AL/sample_components/exp_g.xml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/AL/sample_components/iaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def get_component():
iaf = al.dynamics.DynamicsClass(
iaf = al.dynamics.Dynamics(
name="iaf",
regimes=[
al.Regime(
Expand Down
42 changes: 0 additions & 42 deletions examples/AL/sample_components/leaky_iaf.xml

This file was deleted.

4 changes: 1 addition & 3 deletions examples/Brunel2000/AllToAll.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<NineML xmlns="http://nineml.net/9ML/1.0">
<ComponentClass name="AllToAll">
<ConnectionRule standardLibrary="AllToAll" />
</ComponentClass>
<ConnectionRule name="AllToAll"/>
</NineML>
48 changes: 23 additions & 25 deletions examples/Brunel2000/AlphaPSR.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<NineML xmlns="http://nineml.net/9ML/1.0">
<Dimension name="current" i="1" k="0" j="0" m="0" l="0" n="0" t="0"/>
<Dimension name="time" i="0" k="0" j="0" m="0" l="0" n="0" t="1"/>
<ComponentClass name="AlphaPSR">
<Dimension i="1" name="current"/>
<Dimension name="time" t="1"/>
<Dynamics name="AlphaPSR">
<AnalogSendPort dimension="current" name="A"/>
<AnalogSendPort dimension="current" name="Isyn"/>
<AnalogSendPort dimension="current" name="B"/>
<AnalogReceivePort dimension="current" name="q"/>
<EventReceivePort name="spike"/>
<Alias name="Isyn">
<MathInline>A</MathInline>
</Alias>
<AnalogReceivePort dimension="current" name="weight"/>
<Parameter dimension="time" name="tau_syn"/>
<Dynamics>
<StateVariable dimension="current" name="A"/>
<StateVariable dimension="current" name="B"/>
<Alias name="Isyn">
<MathInline>A</MathInline>
</Alias>
<Regime name="default">
<OnEvent target_regime="default" port="spike">
<StateAssignment variable="B">
<MathInline>B + q</MathInline>
</StateAssignment>
</OnEvent>
<TimeDerivative variable="A">
<MathInline>(-A + B)/tau_syn</MathInline>
</TimeDerivative>
<TimeDerivative variable="B">
<MathInline>-B/tau_syn</MathInline>
</TimeDerivative>
</Regime>
</Dynamics>
</ComponentClass>
<Regime name="default">
<TimeDerivative variable="A">
<MathInline>(-A + B)/tau_syn</MathInline>
</TimeDerivative>
<TimeDerivative variable="B">
<MathInline>-B/tau_syn</MathInline>
</TimeDerivative>
<OnEvent target_regime="default" port="spike">
<StateAssignment variable="B">
<MathInline>B + weight</MathInline>
</StateAssignment>
</OnEvent>
</Regime>
<StateVariable dimension="current" name="A"/>
<StateVariable dimension="current" name="B"/>
</Dynamics>
</NineML>
74 changes: 36 additions & 38 deletions examples/Brunel2000/BrunelIaF.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
<?xml version='1.0' encoding='UTF-8'?>
<NineML xmlns="http://nineml.net/9ML/1.0">
<Dimension name="current" i="1" k="0" j="0" m="0" l="0" n="0" t="0"/>
<ComponentClass name="BrunelIaF">
<AnalogSendPort dimension="time" name="t_rpend"/>
<AnalogSendPort dimension="voltage" name="V"/>
<AnalogReducePort operator="+" dimension="current" name="Isyn"/>
<EventSendPort name="spikeOutput"/>
<Dimension i="1" name="current"/>
<Dynamics name="BrunelIaF">
<StateVariable dimension="time" name="t_rpend"/>
<StateVariable dimension="voltage" name="V"/>
<Parameter dimension="voltage" name="Vreset"/>
<Parameter dimension="time" name="tau"/>
<Parameter dimension="resistance" name="R"/>
<Parameter dimension="time" name="tau_rp"/>
<Parameter dimension="voltage" name="theta"/>
<Dynamics>
<Regime name="refractoryRegime">
<OnCondition target_regime="subthresholdRegime">
<Trigger>
<MathInline>t &gt; t_rpend</MathInline>
</Trigger>
</OnCondition>
</Regime>
<Regime name="subthresholdRegime">
<OnCondition target_regime="refractoryRegime">
<Trigger>
<MathInline>V &gt; theta</MathInline>
</Trigger>
<OutputEvent port="spikeOutput"/>
<StateAssignment variable="V">
<MathInline>Vreset</MathInline>
</StateAssignment>
<StateAssignment variable="t_rpend">
<MathInline>t + tau_rp</MathInline>
</StateAssignment>
</OnCondition>
<TimeDerivative variable="V">
<MathInline>(Isyn*R - V)/tau</MathInline>
</TimeDerivative>
</Regime>
<StateVariable dimension="time" name="t_rpend"/>
<StateVariable dimension="voltage" name="V"/>
</Dynamics>
</ComponentClass>
<Dimension name="voltage" i="-1" k="0" j="0" m="1" l="2" n="0" t="-3"/>
<Dimension name="resistance" i="-2" k="0" j="0" m="1" l="2" n="0" t="-3"/>
<Dimension name="time" i="0" k="0" j="0" m="0" l="0" n="0" t="1"/>
<Regime name="refractoryRegime">
<OnCondition target_regime="subthresholdRegime">
<Trigger>
<MathInline>t &gt; t_rpend</MathInline>
</Trigger>
</OnCondition>
</Regime>
<Regime name="subthresholdRegime">
<OnCondition target_regime="refractoryRegime">
<Trigger>
<MathInline>V &gt; theta</MathInline>
</Trigger>
<StateAssignment variable="V">
<MathInline>Vreset</MathInline>
</StateAssignment>
<StateAssignment variable="t_rpend">
<MathInline>t + tau_rp</MathInline>
</StateAssignment>
<OutputEvent port="spikeOutput"/>
</OnCondition>
<TimeDerivative variable="V">
<MathInline>(Isyn*R - V)/tau</MathInline>
</TimeDerivative>
</Regime>
<AnalogReducePort operator="+" dimension="current" name="Isyn"/>
<EventSendPort name="spikeOutput"/>
<AnalogSendPort dimension="time" name="t_rpend"/>
<AnalogSendPort dimension="voltage" name="V"/>
</Dynamics>
<Dimension i="-1" l="2" m="1" t="-3" name="voltage"/>
<Dimension i="-2" l="2" m="1" t="-3" name="resistance"/>
<Dimension name="time" t="1"/>
</NineML>
4 changes: 1 addition & 3 deletions examples/Brunel2000/OneToOne.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<NineML xmlns="http://nineml.net/9ML/1.0">
<ComponentClass name="OneToOne">
<ConnectionRule standardLibrary="OneToOne" />
</ComponentClass>
<ConnectionRule name="OneToOne"/>
</NineML>
36 changes: 17 additions & 19 deletions examples/Brunel2000/Poisson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
<NineML xmlns="http://nineml.net/9ML/1.0">
<Dimension name="per_time" t="-1"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<ComponentClass name="Poisson">
<EventSendPort name="spikeOutput"/>
<Dynamics name="Poisson">
<Parameter dimension="per_time" name="rate"/>
<Dynamics>
<StateVariable dimension="time" name="t_next"/>
<Constant units="ms" name="one_ms">1.0</Constant>
<Constant units="ms" name="thousand_milliseconds">1000.0</Constant>
<Regime name="default">
<OnCondition target_regime="default">
<Trigger>
<MathInline>t &gt; t_next</MathInline>
</Trigger>
<OutputEvent port="spikeOutput"/>
<StateAssignment variable="t_next">
<MathInline>one_ms*random.exponential(rate*thousand_milliseconds) + t</MathInline>
</StateAssignment>
</OnCondition>
</Regime>
</Dynamics>
</ComponentClass>
<StateVariable dimension="time" name="t_next"/>
<EventSendPort name="spikeOutput"/>
<Regime name="default">
<OnCondition target_regime="default">
<Trigger>
<MathInline>t &gt; t_next</MathInline>
</Trigger>
<StateAssignment variable="t_next">
<MathInline>one_ms*random.exponential(rate*thousand_milliseconds) + t</MathInline>
</StateAssignment>
<OutputEvent port="spikeOutput"/>
</OnCondition>
</Regime>
<Constant units="ms" name="one_ms" value="1.0"/>
<Constant units="ms" name="thousand_milliseconds" value="1000.0"/>
</Dynamics>
<Dimension name="time" t="1"/>
</NineML>
5 changes: 2 additions & 3 deletions examples/Brunel2000/RandomFanIn.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<NineML xmlns="http://nineml.net/9ML/1.0">
<ComponentClass name="RandomFanIn">
<ConnectionRule name="RandomFanIn">
<Parameter name="number"/>
<ConnectionRule standardLibrary="RandomFanIn" />
</ComponentClass>
</ConnectionRule>
</NineML>
20 changes: 9 additions & 11 deletions examples/Brunel2000/StaticConnection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
<Unit symbol="A_per_s" dimension="current_per_time" power="0"/>
<Dimension name="current" i="1" k="0" j="0" m="0" l="0" n="0" t="0"/>
<Dimension name="current_per_time" i="1" k="0" j="0" m="0" l="0" n="0" t="-1"/>
<ComponentClass name="StaticConnection">
<Dynamics name="StaticConnection">
<AnalogSendPort dimension="current" name="weight"/>
<Dynamics>
<StateVariable dimension="current" name="weight"/>
<Regime name="default">
<TimeDerivative variable="weight">
<MathInline>zero</MathInline>
</TimeDerivative>
</Regime>
<Constant units="A_per_s" name="zero">0.0</Constant>
</Dynamics>
</ComponentClass>
<StateVariable dimension="current" name="weight"/>
<Regime name="default">
<TimeDerivative variable="weight">
<MathInline>zero</MathInline>
</TimeDerivative>
</Regime>
<Constant units="A_per_s" name="zero" value="0.0"/>
</Dynamics>
</NineML>
6 changes: 3 additions & 3 deletions examples/Brunel2000/alphaPSR.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import nineml.abstraction as al
from nineml.units import current, time

model = al.DynamicsClass(
model = al.Dynamics(
name="AlphaPSR",
aliases=["Isyn := A"],
regimes=[
Expand All @@ -11,7 +11,7 @@
"dA/dt = (B - A)/tau_syn", # TGC 4/15 changed from "B - A/tau_syn" as dimensions didn't add up @IgnorePep8
"dB/dt = -B/tau_syn"],
transitions=al.On('spike',
do=["B = B + q"]), # would be nice to allow constant quantities, so we could make q dimensionless @IgnorePep8
do=["B = B + weight"]),
)
],
state_variables=[
Expand All @@ -21,7 +21,7 @@
analog_ports=[al.AnalogSendPort("Isyn", dimension=current),
al.AnalogSendPort("A", dimension=current),
al.AnalogSendPort("B", dimension=current),
al.AnalogReceivePort("q", dimension=current)],
al.AnalogReceivePort("weight", dimension=current)],
parameters=[al.Parameter('tau_syn', dimension=time)]
)

Expand Down
2 changes: 1 addition & 1 deletion examples/Brunel2000/brunelIaF.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import nineml.abstraction as al
from nineml.units import voltage, time, resistance, current

model = al.DynamicsClass(
model = al.Dynamics(
name="BrunelIaF",
regimes=[
al.Regime(
Expand Down
Loading