File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -206,4 +206,21 @@ def has_pulse_generator(self, tree=None):
206206 def temp_dir (self ):
207207 if not hasattr (self , '_temp_dir' ):
208208 self ._temp_dir = TemporaryDirectory ()
209- return self ._temp_dir
209+ return self ._temp_dir
210+
211+ def get_state_variables (self ):
212+ """
213+ Parses LEMS xml file and gets simulation's state variables from
214+ OutputFile element.
215+
216+ Returns:
217+ Dict of type "string: string" with the format "id: quantity"
218+
219+ """
220+ lems_tree = etree .parse (self .lems_file_path )
221+ state_variables = {'t' : 't' }
222+ for output_column in lems_tree .iter ('OutputColumn' ):
223+ id = output_column .attrib ['id' ]
224+ quantity = output_column .attrib ['quantity' ]
225+ state_variables [id ] = quantity
226+ return state_variables
You can’t perform that action at this time.
0 commit comments