Multi-line IDL Blocksīy default the IDL notebook executes each line within a cell as a single command. Note: You can also use the %%HTML magic command to include HTML. Here, we display an image using the BUFFER keyword to WRITE_PNG, and base-64 encoding using the IDL_BASE64 function: In : lam = Lambda(n,m: Reform( Congrid( 255* Randomu(seed,n,n),n*m,n*m), 1,n*m,n*m)) WRITE_PNG, '',, BUFFER=b img = IDL_BASE64(b) print, '' However, if your IDL output begins with the characters then the output for that line will be sent to the browser as HTML.įor example: In : s1 = 'Here is some BOLD and italic HTML.' s2 = 'Go to the IDL Documentation Center.' print, s1 s2 Any HTML commands or special escape characters will be ignored and displayed as just text. Normally, all IDL output will be sent to the browser as raw unformatted text. You can change this behavior by using the %inline and %window magic commands.įor example: In : % window In : p = PLOT( 'r',/TEST) display in a separate window In : %inline In : p = PLOT( 'g',/TEST) display inline in the browser HTML Output Controlling Graphics Outputīy default, any graphics created by IDL will be inline (embedded) within the IDL notebook. IDL widgets will appear in a separate window, not embedded in the notebook. This includes graphics generated by direct graphics, object graphics (using IDLgrBuffer), and function graphics. EDIT will not do anything.Īny graphics created by the notebook will appear inline by default. You can also enter any "executive" commands such as. Any text output from IDL (including error messages) will appear in the "output" cell below the command cell. If you enter multiple commands, the notebook will send each line to IDL as a separate command (although see the Multi-line section below). You can enter either single commands or multiple commands within a cell. To execute IDL commands, type the command into a notebook cell, then press Shift Enter. All code inside this notebook will be treated as IDL code. After the IDL kernel has started, you can begin entering IDL commands. Choose IDL to start a new IDL notebook.Ī new web browser window or tab appears, containing the IDL notebook. This starts your default web browser and loads the main notebook web page, called the "dashboard." Under the New drop-down button, are menu items Python and IDL. Start the IPython (Jupyter) notebook interface using the following command from a command shell: jupyter notebook Once installed, a type of notebook will be available called IDL. Where should be changed to your IDL installation directory. Instead of copying the kernel.json file, you can define an environment variable: JUPYTER_PATH = /lib/bridges Note: For all platforms, be sure to create a directory named kernels with a subdirectory named IDL and copy the kernel.json file into that directory. To install for all users: %PROGRAMDATA%\jupyter\kernels\IDL To install for a single user on Macos: ~/Library/Jupyter/kernels/IDL Windows To install for a single user on linux: ~/.local/share/jupyter/kernels/IDL To install for all users: /usr/share/jupyter/kernels/IDL The IDL kernel can be found in: /lib/bridges/kernels/IDL/kernel.jsonĭepending upon your platform, this file should be installed into one of the following directories. Once IPython (Jupyter) has been installed, you need to install the IDL kernel. įor example, if you are using the Miniconda python package, you can install IPython using the following commands: conda update conda conda install jupyter Then install IPython using the instructions for your platform. If you encounter errors, see Python Bridge for troubleshooting. You can test this using the following Python command: > from idl_kernel import * Make sure that /lib/bridges is on the Python path so that Python can find the idl_kernel.py script. Installationįirst, install IDL and set up the Python Bridge. The IDL IPython Kernel provides the necessary hooks for an IPython (Jupyter) notebook to run IDL code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |