M11 MD++ Powered by Python: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
| Line 15: | Line 15: | ||
0 if success |
0 if success |
||
''' |
''' |
||
</pre> |
|||
<pre> |
|||
mdpp.get(varname) |
mdpp.get(varname) |
||
'''Obtain the value of a variable in MD++ object |
'''Obtain the value of a variable in MD++ object |
||
| Line 27: | Line 28: | ||
depends on the type of the variable |
depends on the type of the variable |
||
''' |
''' |
||
</pre> |
|||
<pre> |
|||
mdpp.get_array(array_name, istart, iend, iskip=0) |
mdpp.get_array(array_name, istart, iend, iskip=0) |
||
'''Obtain an array from MD++ object to a python list |
'''Obtain an array from MD++ object to a python list |
||
| Line 41: | Line 43: | ||
flattened list of requested array in MD++ object |
flattened list of requested array in MD++ object |
||
''' |
''' |
||
</pre> |
|||
<pre> |
|||
mdpp.set_array(input_list, array_name, istart, iskip=0) |
mdpp.set_array(input_list, array_name, istart, iskip=0) |
||
'''Obtain an array from MD++ object to a python list |
'''Obtain an array from MD++ object to a python list |
||
Latest revision as of 03:37, 12 October 2019
MD++ with Python scripting language (Python)
commands
mdpp.cmd(command_string)
'''Execute one command or multiple commands in MD++
Parameters
----------
command_string : string
a string that follows MD++ script command format
Returns
-------
exit_code : int
0 if success
'''
mdpp.get(varname)
'''Obtain the value of a variable in MD++ object
Parameters
----------
varname : string
variable name to obtain from the MD++ object
Returns
-------
value : int, long, double, or string
depends on the type of the variable
'''
mdpp.get_array(array_name, istart, iend, iskip=0)
'''Obtain an array from MD++ object to a python list
Parameters
----------
array_name : string
array name to obtain from the MD++ object
istart,iend,iskip : int
the starting position, end position, and number of elements to skip
Returns
-------
array : list
flattened list of requested array in MD++ object
'''
mdpp.set_array(input_list, array_name, istart, iskip=0)
'''Obtain an array from MD++ object to a python list
Parameters
----------
input_list : list
1D python list of flattened array values to be inserted.
array_name : string
array name to set in the MD++ object
istart,iskip : int
the starting position, and number of elements to skip
Returns
-------
exit_code : int
0 if success
'''
example scripts