Calling custom pythonmodule in IDL
idl8.3 New Font-family:times new Roman ">python Module to implement in idl Tasks that are not easy to complete. If you use some development packages, but this development package does not support idl , after all, use The number of idl is still relatively small. Therefore, hybrid programming is a solution. The following describes the idl (32 bit , 32 IDL8.3 ) calls a custom pythonmodule operation steps.
1) download Span style= "Font-family:times new Roman" >slither (the IDL Topython Bridge ). http://research.jacquette.com/slithertm-product-information/. current support PYTHON26/27/33 The version.
2) unzip the slither, select the corresponding Python file in the home DLL and the dlm file, copy it to the IDL installation path. ----exelis\idl83\bin\bin.x86. You can complete the installation of slither .
3) open IDL8.3if numpyis installed in Python . You can perform preliminary tests. The test code is as follows:
Idl>rand=pyimport ("random")
Idl>rand.randint (0,5)
4) After completing the installation of the slither , you will now start writing a custom Python Module. Select a directory to create a folder. Create two . py files in the folder, respectively. One for setup.py, the other to be named according to need, this article takes clonesvm.py as an example.
5) as shown in code 1 in the setup.py file. Where the name value and the py_modules value must be the same as their own py file.
Figure 1 setup.py file code
6) clonesvm.py is the real custom pythonmodule. Its code is shown in 2 :
Figure 2 Module Code
7) Make sure your code is correct and run setup.py. In the cmd Command window, enter the following command successively.
Python setup.py sdist
Python setup.py Install
This completes the release and installation of the custom Module . 3 The green box shows:
8) as in step 3 , use pyimport to import your own modules. At this point, you can invoke the Python module in IDL .
Invoking a custom Python Module in IDL