util¶
-
dympy.util.
dict2list
(data, order=None)[source]¶ Converts a dictionary to a list of keys and a list of values
Parameters: data : dict
dictionary with name, value pairs
order : list
list of keys representing the order of the data in the saved file
Examples
>>> dict2list({'time':[0,43200,86400],'u':[1000,5000,2000]})
-
dympy.util.
get_children
(res, key)[source]¶ Returns a list with all keys in res starting with key
Parameters: res : dict
results dictionary
key : string
a search key
Returns: keys : list
list of keys that start with key
Examples
>>> get_keys_with({'time':[0,43200,86400],'A.B':[1000,5000,2000],'A.C':[2000,8000,3000]},'A')
-
dympy.util.
get_value_array
(res, key)[source]¶ Creates and array of result keys with the same name but differtent indices
Parameters: res : dict
results dictionary
key : string
variable name
Returns: val : numpy.ndarray
nd array with values
Examples
>>> get_value_array({'time':[0,43200,86400],'u[1]':[1000,5000,2000],'u[2]':[2000,8000,3000]},'u')
-
dympy.util.
savemat
(filename, data, order=None)[source]¶ Writes a binary file which can be loaded by dymola
Parameters: data : dict
dictionary with name, value pairs
order : list
list of keys representing the order of the data in the saved file
Examples
>>> savemat({'time':[0,43200,86400],'u':[1000,5000,2000]})