JCMsuite Python interface is implemented as a module named
jcmwave, which you find in the sub-folder
ThirdPartySupport/Python relative to the
JCMsuite installation directory (here called JCMROOT).
To start the Python interpreter delivered with
JCMsuite, run the executable
python placed in the sub-folder
jcmwave module can be imported since the python module search path has been configured accordingly. Use the command
info from the jcmwave module to check your installation
import jcmwave jcmwave.info()
This will give details on the status of your
JCMsuite installation, e.g., the
JCMsuite version in use, license information and system properties such as the number of available CPU cores.
The entire Python interface consists of the following routines:
- edit.py: Opens files in JCMsuite’s editor
- geo.py: Wraps JCMsuite’s command line tool
- info.py: Prints installation and system details.
- jcmt2jcm.py: Tool for Embedded Scripting support.
- loadcartesianfields.py: Loads cartesian fieldbag in
- loadtable.py: Loads table in
- set_memory_limit.py: Sets the maximum amount of RAM used by the JCMsolve.
- set_num_threads.py: Sets number of used CPU cores.
- set_ooc_drive.py: Sets swapping directory for out-of-core computation.
- resultbag.py: Stores computational results.
- solve.py: Wraps JCMsuite’s command line tool
- startup.py: Initialize the matlab interface.
- view.py: Wraps JCMsuite’s fieldbag viewer.
- Daemon Command Reference: This bunch of python routines helps to parallelize jobs on a computer cluster.
- Analysis and Optimization Toolkit/Python Command Reference: These python routines help to perform analyses and optimizations of parametrized setups.
All routines provide detailed online help, e.g., use
to obtain help on
Using your own Python interpreter
When you wish to use your own Python interpreter, make sure that the package NumPy is available. The tutorial examples in the next sections use the Matplotlib package when plotting the results.
To use the
JCMsuite Python interface module
jcmwave it is required to add the path
ThirdPartySupport/Python to the python search path. This can be done by setting the environment variable PYTHONPATH accordingly before starting the interpreter. Alternatively, the python search path can be updated within Python before importing the module
import sys import os jcm_root = <JCMROOT> # -> set your JCMROOT installation directory sys.path.append(os.path.join(jcm_root, 'ThirdPartySupport', 'Python'))
Or, when the environmental variable
JCMROOT is set, e.g., on Windows:
import sys import os sys.path.append(os.path.join(os.getenv('JCMROOT'), 'ThirdPartySupport', 'Python'))
Use the command
info to check that the Python interface is now properly available:
import sys import os jcm_root = <JCMROOT> # -> set your JCMROOT installation directory # now import jcmwave import jcmwave # call jcmwave.info to check the JCMsuite installation jcmwave.info()
|||NumPy is the fundamental package needed for scientific computing with Python. SciPy is open-source software for mathematics, science, and engineering. NumPy and Scipy are licensed under the BSD license. (http://scipy.org/) For license details see also Legal information (search for Matplotlib).|
|||Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. http://matplotlib.sourceforge.net. The license of Matplotlib is based on the PSF license, see http://matplotlib.sourceforge.net/users/license.html. Matplotlib is linked against the antigrain C++ rendering engine (version 2.4), the Olson tz database in Python (pytz), and the dateutil library. For license details see also Legal information (search for Matplotlib).|