Compose Notebook

The Compose Notebook is a web-based implementation of Compose’s OpenMatrix Language (OML) into a Jupyter Notebook. Notebooks (see www.jupyter.org) are a powerful way to execute and demonstrate scripted languages.

Features

The main features of the Compose Notebook are:
  • Starts as web page in your Internet browser.
  • Runs OML from the current Compose installation.
  • Requires a valid Compose license.
  • Supports most of the OML language commands.
  • Supports the rich editing capabilities (such as Markdown cells) offered by Jupyter Notebook.
  • Supports access to OML help commands (very much like the Compose OML Console mode).
  • Support for many OML plot commands, using the popular Plotly plotting toolkit.
  • Save notebooks as regular .ipynb files.
  • Supported on Windows and Linux platforms.
The Compose Notebook is built upon the following:
  • The Jupyter Notebook infrastructure, based on Python.
  • A customized Jupyter front page.
  • An OML kernel for Jupyter.
  • The full OML interpreter and OML libraries, including license management.

Start the Compose Notebook

Windows

  1. From the Start menu, select Altair 2023.1 > Compose Jupyter Notebook.
    Your default Internet browser opens and a new, empty OML Notebook page is displayed.

    A console (MS-DOS window) is also created by the Jupyter process.

  2. Alternatively, Compose Notebook can be launched by executing the following script: <install dir>/Compose_Jupyter.bat.

Linux

  1. Launch the Compose Notebook by executing this script: <install dir>/scripts/Compose_Jupyter.

Licensing

Compose Notebook relies on the same licensing mechanism as Compose. Please use Compose (GUI mode) to define and select your preferred licensing mode. The settings defined in Compose will be used in the Compose Notebook.

Note: Closing a notebook tab does not stop the OML engine. Only closing the OML engine returns the licenses (see below).

Closing the Notebook

When you close your Notebook (web page), the Notebook console window is not closed; you must close it separately. This stops the Notebook kernel and the licensing. In practice:
Closing the OML session using File > Exit
Closes the OML session and checks in the license. The Notebook console is still active; you must close the console to exit the notebook completely.
Closing the tab in your browser
Does not end the OML session; the license is still in use. The advantage to this method is re-opening the same .ipynb file connects you to the previous OML session. The Notebook console is still active; you must close the console to exit the notebook completely.

Menus

The Compose Notebook is a customized Jupyter notebook page as shown below:



Figure 1.

Menu Types

File
To open and save notebooks (.ipynb files):
  • File > Open opens the selected .ipynb file in a new tab.
  • .ipynb files must be located in the ComposeNotebooks folder only.
  • File > New opens a new notebook in a new tab of the browser.
Edit
Contains options to move, cut, and edit cells.
Cell
Change the cell types (see below).
Execute
Execute the cells (selection, all above, all below).
Notebook Management
Interrupt or restart the OML kernel.
Important: The notebooks are stored in a dedicated ComposeNotebooks folder, located inside the <user> folder:
  • On Windows: <user>/MyDocuments/ComposeNotebooks
  • On Linux: If <userHOME>/Documents exists, then the notebooks are stored in <userHOME>/Documents/ComposeNotebooks; otherwise, they are stored in <userHOME>/ComposeNotebooks
  • The File > Open command in the Compose Notebook is only available to load files stored in the ComposeNotebooks folder.

Create and Execute a Compose Notebook

Like other notebooks, a Compose OML Notebook is based on creating and executing cells.

By default, an OML notebook cell is set to receive an OML statement.

In a new, empty cell, you can enter one or many OML lines.
  • Press Ctrl+Enter to execute the cell.
  • If you press Alt+Enter, the cell is not executed and a new cell is created below.

OML Notebook cells can also be used to enter other formatted content using the Markdown format. This allows for entering rich text (such as titles, bold face, and so on) and scientific text (using LateX).

The cell type can be changed from the Cells menu.

Note: This section is intended to be a high-level introduction to using notebooks. Please refer to the abundant documentation available at www.jupyter.org to learn more about the possibilities Jupyter Notebooks offer.

OML Commands in the Compose Notebook

Most of the OML commands are supported by the Compose Notebook.
  • In a new Compose Notebook, when a plot command is executed for the first time, it may take some time to load the required underlying modules.
  • Within the OML plot commands, the following commands are not supported:
    • dock
    • drawnow
    • ellipse
    • imagesc
    • polar
    • rectangle
    • saveas
    • uiwait
    • undock
  • Within the supported OML plot commands, the following properties are not supported:
    Units
    Not supported in any of the commands.
    Figure
    position, visible
    Axes
    position
    xminorgrid
    yminorgrid
    zminorgrid
    Surface
    color
    Area
    basevalue
    Bar
    bargroup
    barlayout
    barwidth
  • OML commands related to GUI creation are not supported in this release. The only exception is the creation of sliders to act on plots.
    Example
    sliderHandle = uicontrol(f1,'style', 'slider', 'min', 2, 'max', 10, 'callback',@OnSliderValueChange);


    Figure 2.
  • To save the current state of the Notebook (including the plots) the Save button or File->Save action should be used. When a plot is saved, an external .html file is created in the ComposeNotebooks folder. To remove outdated plot .html files from the ComposeNotebooks folder, use the action File->’Delete all plot .html files’.
  • The CAE readers supported by OML are supported by the Compose Notebook, except for readvectorbuilder().