M11 MD++ Powered by Python: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
MD++ with Python scripting language ([http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/PDF_Manuals/M11_MD++_v3.pdf Python]) |
MD++ with Python scripting language ([http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/PDF_Manuals/M11_MD++_v3.pdf Python]) |
||
commands |
|||
<pre> |
|||
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 |
|||
''' |
|||
</pre> |
|||
example scripts |
example scripts |
||
Revision as of 03:36, 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