File tree Expand file tree Collapse file tree 8 files changed +94
-20
lines changed Expand file tree Collapse file tree 8 files changed +94
-20
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Some description...
23
23
<table >
24
24
<tr >
25
25
<td><b>networks</b></td>
26
- <td><a href="#network">Network </a></td>
26
+ <td><a href="#list">List </a></td>
27
27
<td><i>The networks present</i></td>
28
28
</tr >
29
29
@@ -48,7 +48,7 @@ Some description...
48
48
<table >
49
49
<tr >
50
50
<td><b>populations</b></td>
51
- <td><a href="#population">Population </a></td>
51
+ <td><a href="#list">List </a></td>
52
52
<td><i>the pops in the net</i></td>
53
53
</tr >
54
54
Original file line number Diff line number Diff line change @@ -14,11 +14,11 @@ Allowed field Data Type Description
14
14
15
15
**Allowed children **
16
16
17
- =============== ====================== ====================
18
- Allowed child Data Type Description
19
- =============== ====================== ====================
20
- **networks ** `Network <#network >`__ The networks present
21
- =============== ====================== ====================
17
+ =============== ================ ====================
18
+ Allowed child Data Type Description
19
+ =============== ================ ====================
20
+ **networks ** `List <#list >`__ The networks present
21
+ =============== ================ ====================
22
22
23
23
=======
24
24
Network
@@ -35,11 +35,11 @@ Allowed field Data Type Description
35
35
36
36
**Allowed children **
37
37
38
- =============== ============================ ===================
39
- Allowed child Data Type Description
40
- =============== ============================ ===================
41
- **populations ** `Population <#population >`__ the pops in the net
42
- =============== ============================ ===================
38
+ =============== ================ ===================
39
+ Allowed child Data Type Description
40
+ =============== ================ ===================
41
+ **populations ** `List <#list >`__ the pops in the net
42
+ =============== ================ ===================
43
43
44
44
==========
45
45
Population
Original file line number Diff line number Diff line change 13
13
},
14
14
"allowed_children" : {
15
15
"networks" : {
16
- "type" : " Network " ,
16
+ "type" : " List " ,
17
17
"description" : " The networks present"
18
18
}
19
19
}
28
28
},
29
29
"allowed_children" : {
30
30
"populations" : {
31
- "type" : " Population " ,
31
+ "type" : " List " ,
32
32
"description" : " the pops in the net"
33
33
}
34
34
}
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <root >
3
+ <NeuroML >
4
+ <definition >Some description...</definition >
5
+ <allowed_parameters >
6
+ <id >
7
+ <type >str</type >
8
+ <description >The id of the NeuroML 2 document</description >
9
+ </id >
10
+ <version >
11
+ <type >str</type >
12
+ <description >NeuroML version used</description >
13
+ </version >
14
+ </allowed_parameters >
15
+ <allowed_children >
16
+ <networks >
17
+ <type >List</type >
18
+ <description >The networks present</description >
19
+ </networks >
20
+ </allowed_children >
21
+ </NeuroML >
22
+ <Network >
23
+ <definition >Some description...</definition >
24
+ <allowed_parameters >
25
+ <id >
26
+ <type >str</type >
27
+ <description >The id of the network</description >
28
+ </id >
29
+ </allowed_parameters >
30
+ <allowed_children >
31
+ <populations >
32
+ <type >List</type >
33
+ <description >the pops in the net</description >
34
+ </populations >
35
+ </allowed_children >
36
+ </Network >
37
+ <Population >
38
+ <definition >Some description...</definition >
39
+ <allowed_parameters >
40
+ <id >
41
+ <type >str</type >
42
+ <description >The id of the population</description >
43
+ </id >
44
+ <component >
45
+ <type >str</type >
46
+ <description >the component to use in the population</description >
47
+ </component >
48
+ <size >
49
+ <type >int</type >
50
+ <description >the size of the population</description >
51
+ </size >
52
+ </allowed_parameters >
53
+ </Population >
54
+ </root >
Original file line number Diff line number Diff line change 9
9
description : NeuroML version used
10
10
allowed_children :
11
11
networks :
12
- type : Network
12
+ type : List
13
13
description : The networks present
14
14
Network :
15
15
definition : Some description...
@@ -19,7 +19,7 @@ Network:
19
19
description : The id of the network
20
20
allowed_children :
21
21
populations :
22
- type : Population
22
+ type : List
23
23
description : the pops in the net
24
24
Population :
25
25
definition : Some description...
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <modelspec >
3
+ <TestNeuroML >
4
+ <version >NeuroML_v2.3</version >
5
+ <networks >
6
+ <net0 >
7
+ <populations >
8
+ <pop0 >
9
+ <component >izh2007RS0</component >
10
+ <size >1</size >
11
+ </pop0 >
12
+ </populations >
13
+ </net0 >
14
+ </networks >
15
+ </TestNeuroML >
16
+ </modelspec >
Original file line number Diff line number Diff line change 2
2
from modelspec import field , instance_of , optional
3
3
from modelspec .base_types import Base
4
4
from typing import List
5
+ from modelspec .utils import save_to_xml_file
5
6
6
7
# Example showing ...
7
8
@@ -68,11 +69,12 @@ class NeuroML(Base):
68
69
nml_doc .to_json_file ("%s.json" % nml_doc .id )
69
70
nml_doc .to_yaml_file ("%s.yaml" % nml_doc .id )
70
71
nml_doc .to_bson_file ("%s.bson" % nml_doc .id )
71
- # nml_doc.to_xml_file("%s.xml"% nml_doc.id)
72
+ nml_doc .to_xml_file ("%s.xml" % nml_doc .id )
72
73
73
74
print (" >> Full document details in YAML format:\n " )
74
75
75
76
print (nml_doc .to_yaml ())
77
+ print (nml_doc .to_xml ())
76
78
77
79
doc_md = nml_doc .generate_documentation (format = "markdown" )
78
80
@@ -99,3 +101,5 @@ class NeuroML(Base):
99
101
yy = yaml .dump (doc_dict , indent = 4 , sort_keys = False )
100
102
print (yy )
101
103
d .write (yy )
104
+
105
+ save_to_xml_file (doc_dict , "NeuroML2.specification.xml" )
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ def to_xml(self) -> str:
121
121
"""
122
122
from modelspec .utils import build_xml_element
123
123
124
- root = ET .Element ("root " )
124
+ root = ET .Element ("modelspec " )
125
125
build_xml_element (root , self .to_dict ())
126
126
127
127
xml_string = ET .tostring (
@@ -265,14 +265,14 @@ def to_xml_file(
265
265
self ,
266
266
filename : Optional [str ] = None ,
267
267
include_metadata : bool = True ,
268
- root = "modelspec" ,
268
+ root_name = "modelspec" ,
269
269
) -> str :
270
270
from modelspec .utils import build_xml_element
271
271
272
272
if filename is None :
273
273
filename = f"{ self .id } .xml"
274
274
275
- root = ET .Element (root )
275
+ root = ET .Element (root_name )
276
276
277
277
build_xml_element (root , self .to_dict ())
278
278
You can’t perform that action at this time.
0 commit comments