Skip to content

Commit d65bc18

Browse files
committed
Minimal working sbml example
Update a number of print statements
1 parent 18ea90b commit d65bc18

17 files changed

+158
-120
lines changed

docs/sphinx/source/api/examples/document.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?xml version="1.0" ?>
2-
<Document id="MyBook" title="My life in Python" ISBN="None">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Document id="MyBook" title="My life in Python">
33
<Section id="Abstract">
44
<Paragraph contents="Blah blah blah"/>
55
<Paragraph contents="Blah2"/>

examples/document.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?xml version="1.0" ?>
2-
<Document id="MyBook" title="My life in Python" ISBN="None">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Document id="MyBook" title="My life in Python">
33
<Section id="Abstract">
44
<Paragraph contents="Blah blah blah"/>
55
<Paragraph contents="Blah2"/>

examples/neuroml2/TestNeuroML.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" ?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="TestNeuroML" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd">
33
<izhikevich2007Cell id="izh2007RS0" C="100pF" v0="-60mV" k="0.7nS_per_mV" vr="-60mV" vt="-40mV" vpeak="35mV" a="0.03per_ms" b="-2nS" c="-50.0mV" d="100pA"/>
44
<pulseGenerator id="pulseGen_0" delay="100ms" duration="800ms" amplitude="0.07 nA"/>

examples/neuroml2/neuroml2_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class neuroml(Base):
197197

198198
with open("NeuroML2.specification.yaml", "w") as d:
199199
yy = yaml.dump(doc_dict, indent=4, sort_keys=False)
200-
print(yy)
200+
# print(yy)
201201
d.write(yy)
202202

203203
from modelspec.utils import load_xml

examples/sbml/regenerateAndTest.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
python test_sbml3.py
5+
6+
python sbml_validators.py example_sbml_minimal.xml
7+
python sbml_validators.py test_minimal_example.xml
Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
{
2-
"model": {
3-
"substanceUnits": "mole",
4-
"timeUnits": "second",
5-
"extentUnits": "mole",
6-
"listOfUnitDefinitions": [
7-
{
8-
"sid": "per_second",
9-
"listOfUnits": [
10-
{
11-
"kind": "second",
12-
"exponent": -1.0
13-
}
14-
]
15-
}
16-
]
2+
"test_minimal_example": {
3+
"level": "3",
4+
"version": "2",
5+
"model": {
6+
"substanceUnits": "mole",
7+
"timeUnits": "second",
8+
"extentUnits": "mole"
9+
}
1710
}
1811
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" id="test_minimal_example" level="3" version="2">
3+
<model substanceUnits="mole" timeUnits="second" extentUnits="mole"/>
4+
</sbml>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test_minimal_example:
2+
level: '3'
3+
version: '2'
4+
model:
5+
substanceUnits: mole
6+
timeUnits: second
7+
extentUnits: mole

examples/sbml/test_sbml3.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,27 @@
1515
def test_example_sbml_minimal():
1616
"aiming to match the xml file example_sbml_minimal.xml"
1717

18-
path = "test_minimal_example"
18+
name = "test_minimal_example"
1919

20-
sbml_doc = SBML()
20+
sbml_doc = sbml(id=name, version="2", level="3")
2121
# open(f"{path}.docs.json", "w").write(json.dumps(sbml_doc.generate_documentation(format="dict"), indent=4))
2222

2323
model = Model(substanceUnits="mole", timeUnits="second", extentUnits="mole")
2424
sbml_doc.model = model
2525

26-
unit_def = UnitDefinition(sid="per_second")
26+
unit_def = unitDefinition(sid="per_second")
27+
"""
2728
model.listOfUnitDefinitions.append(unit_def)
28-
2929
unit = Unit(kind="second", exponent=-1.0)
30-
unit_def.listOfUnits.append(unit)
30+
unit_def.listOfUnits.append(unit)"""
31+
32+
print("------------------------------------------------")
33+
print(sbml_doc)
34+
print("------------------------------------------------")
3135

32-
sbml_doc.to_json_file(f"{path}.json")
33-
sbml_doc.to_xml_file(f"{path}.xml")
36+
sbml_doc.to_json_file(f"{name}.json")
37+
sbml_doc.to_yaml_file(f"{name}.yaml")
38+
sbml_doc.to_xml_file(f"{name}.xml")
3439

3540

3641
if __name__ == "__main__":

examples/test/test.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ A model....
1212

1313
<tr>
1414
<td><b>float_like_req</b></td>
15-
<td>int</td>
15+
<td>float</td>
1616
<td><i>name says it all...</i></td>
1717
</tr>
1818

1919

2020
<tr>
2121
<td><b>float_like_optional</b></td>
22-
<td>int</td>
22+
<td>float</td>
2323
<td><i>name also says it all...</i></td>
2424
</tr>
2525

2626

2727
<tr>
28-
<td><b>float_like_optional2</b></td>
28+
<td><b>int_like_optional</b></td>
2929
<td>int</td>
3030
<td><i>name also says it all...</i></td>
3131
</tr>
@@ -54,7 +54,7 @@ A model....
5454

5555
<tr>
5656
<td><b>str_val</b></td>
57-
<td>int</td>
57+
<td>str</td>
5858
<td><i>name says it all...</i></td>
5959
</tr>
6060

0 commit comments

Comments
 (0)