Subsections

User interface

When starting SciCraft the user will be presented with something similar to the window seen in Figure 2.1. The items seen in the Figure are the following:

Workspace:
The workspace is the working area where you are able to add and connect nodes to generate a data flow.
Nodes:
These are the main building blocks in SciCraft. Nodes represent some kind of data methods or operators. E.g. the OctaveFileReader seen on the picture is responsible for reading data into the module diagram, the PCA node is an Octave function running a principal components analysis and so on.
Link:
A link represent a connection between two nodes. Please note that the link seen on the workspace is only graphical. As explained later in this section, the nodes can contain several in and output ports. These can been seen and connected by double clicking on the link on the workspace.
NodeTree:
The node tree shows all the nodes that can be added to the current diagram.
Progress bar:
This bar shows the current status when running a module diagram. It will display the progress when running a diagram, when the diagram is done and also indicate if someone went wrong during execution.

Figure 2.1: The main window in SciCraft

How to add a node

Start by choosing the particular node you want to add from the node tree and then double click on the name. The chosen node will then appear in the leftmost corner of the current workspace. When adding several nodes, they will be placed next to each other horizontally. If a node in a row is moved, new nodes will be placed at the first free place. An alternative to double click on the node is drag `n` drop. This is easily done by choosing a node from the nodetree and then drag it to the desired location on the the workspace while holding down the left mousebutton. The node is dropped where the left mousebutton is released.


How to connect nodes

Before you decide to connect nodes, you have to choose the linking tool from the main menu bar, as shown in Figure 2.2 where the link button is toggled (shortcut: Ctrl+L). This tool is used for connecting nodes ONLY. The button left to the linking button is used to move and mark collections of nodes, the pointing tool (shortcut: Ctrl+P). This tool is also used when editing nodes and links.

It is also possible to create links between nodes when using the pointingtool. By clicking on the right mousebutton on a node a small menu will appear, as illustrated in Figure 2.3. 'Create link' enables you to make a connection between the chosen node and any node in the workspace. I addition to this, it is possible to choose from the menu to remove and view the current node.

Figure 2.2: Pointing and linking tool

Figure 2.3: Creating links when using the pointing tool

When connecting nodes you start at the FROM node, left click on this node and then left click on the TO node. A line will now be drawn between these two nodes and they are linked together, as illustrated in Figure 2.4. If you look closer on the nodes you will notice that most node images has one or more slots on the edge of the node icons. When you left click on the nodes, the line will start (or end) at the slot closest to where you just clicked.

Figure 2.4: Connecting nodes

After connecting two nodes in the GUI you are now ready to set the input and output to and from the nodes. This means that you have to switch to pointing tool. A node is capable of having several input and output ports. These ports have a name and often a type and description. When connecting two node ports you have to know which port in the FROM node that should be connected to a specific port in the TO node. If you double click on the link you just created you will see a window similar to Figure 2.5. Specify which ports you want to connect by clicking one output and one input port and then click on Connect. A similar operation is repeated when disconnecting ports, select ports and click Disconnect.

Figure 2.5: Connecting ports

So just using a link to connect two nodes does not specify any flow of data between the nodes, you have to double click on a newly created link and specify the port connections in order to define the flow of data between the nodes. An exception to this rule occurs when you connect two nodes with only one output and one input port. In these cases, the ports are automatically connected when the node link is created.

The difference between node connections (links) and port connections is illustrated in Figure 2.6. The node connections are specified by drawing links between nodes as described above. Port connections are defined by double clicking on links and connecting ports as in Figure 2.5.

Figure 2.6: Node links and port connections

How to add a comment and modify comment settings

To add a comment, select the tool icon represented by a post-it note in the toolbar - shown in figure 2.7 - and then click the desired position in the workspace. A comment now appears in the workspace where the mouse was clicked. To change the settings of this comment, simply doubleclick it and a settings window will pop up, as shown in figure 2.8. This window gives you the opportunity to modify the following:

Comment Text:
This may be modified by changing the text field just below the heading Comment text.
Comment Font type:
This may be modified by clicking the leftmost button in the toolbar. This button has an icon with Abc displayed on it. See figure 2.9. If this button is clicked a standard window for modifying font will appear.
Comment Font colour:
This may be modified by clicking the second button from the left in the toolbar. This button has an icon with two different coloured T's displayed on it. See figure 2.9. If this button is clicked a standard window for modifying colour will appear.
Comment Background colour:
This may be modified by clicking the rightmost button in the toolbar. This button has an icon with three different coloured folders displayed on it. See figure 2.9. If this button is clicked a standard window for modifying colour will appear.

As you change the comment attributes a preview field below the heading Comment preview will be updated for convenience. However, changes are not applied to the actual comment until the Ok-button is clicked. The Cancel-button may also be clicked if it is desired to cancel all changes done to the comment's attributes.

Also comments may be selected and moved around by using the pointing tool. Selected comments may also be removed by using the delete-key on the keyboard.

Figure 2.7: Comment tool

Figure 2.8: Comment settings

Figure 2.9: Comment settings toolbar

How to select and move collection of nodes

First of all, to be able to mark a collection of nodes, or even one node, you have to choose the pointing tool, as illustrated in Figure 2.2. Nodes placed in the workspace, linked or not, can be moved, one by one or as a collection of several nodes. Begin by setting the mousepointer on the desired starting point and hold down the left mousebutton. Now a dotted rectangle will appear on the workspace. You are now free to drag the dotted rectagle over the nodes you want to move. When the nodes you want to mark are covered by the rectangle, release the left mousebutton, see Figure 2.10 for illustration. The colour of the selected nodes labels will change, as an indication of the selection. Set the mousepointer on one of the selected nodes, hold down the left mousebutton, and move the selected nodes wherever you want in the workspace.

Figure 2.10: Selection of nodes

How to get input and output data

In most cases you need to import some kind of dataset into the module diagram. This could for instance be a matrix from a Matlab file or data from an R-object. To be able to import this data into the diagrams you need an input node. This node is a specialised reader node that is able to read different kinds of dataformats. Create an input node, which is a subnode of filehandlers, and double click on it to get the node dialog, as illustrated in Figure 2.11. Continue by choosing the desired input file. If the chosen file is supported by Scicraft, the corresponding file type and file type description will we shown. For output you repeat this process with a file writer node.

Figure 2.11: Getting input from files.

How to run a module diagram

Running a diagram is done by clicking the Play button on the toolbar, or by clicking Run via the Actions menu.

When running a diagram, SciCraft will first validate the diagram. If the diagram fails the validation, a pop-up with information about errors will appear. The most common error when validating is missing connections on an input port.

Figure 2.12: Running a module diagram.


How to run a single node

Running a single node is accomplished by right-clicking the node and selecting Collect & Run. As opposed to regular diagram running, where nodes send data to next connected node, this collects data from all nodes providing data and then runs the node.

The Collect & Run functionality depends on all nodes providing data keep the output from their last run. This setting must be enabled manually on all nodes providing data to the single node. To enable this setting, select Keep output after right-clicking the node.

Using Keep Output and Collect & Run it is possible to build a single node, enable Keep output, then run it with Collect & Run, then create a second node, connect it to the first, enable Keep output and then run it with Collect & Run. By creating a series of nodes, and running them as you go along, you can inspect return values along links, change parameters, and interactively create an entire diagram without having to run all nodes several times.

This is particularely useful when dealing with nodes that use an extended amount of time for calculations.

The reason that the Keep Output setting of each node is not enabled by default is that keeping output data of all nodes readily available might require alot of memory or disk on a system, depending on your data sets. Keeping all data might deplete your systems resources.

How to stop a running diagram

After you have started a diagram by clicking the Play button on the toolbar, or by clicking Run via the Actions menu, you may stop the diagram while it is running. This is for example quite useful if you by a mistake started a diagram that takes a long time to run, with, say, the wrong parameters set in a node. Stopping the diagram may be done either by pressing the Stop button on the toolbar, or by clicking Stop via the Actions menu. The Play and Stop buttons are shown in Figure 2.12.

Figure 2.13: Stopping a module diagram and the status of the nodes after the stop button has been pressed.

When the Stop button has been pushed the dialog box in Figure 2.13 appears on the screen. At the same time the text in the progress bar at the bottom of the SciCraft window turns red and shows the text Interrupted and the Stop button is disabled. This is when the running nodes are stopping themselves. Some nodes may use longer time than others to stop. As the running nodes finish running, they change their State in the dialog box from Running to Interrupted. When all the running nodes have finished running, the text in the progress bar changes to Done and the text inside the dialog box says that it is done interrupting the nodes. Now the Play button is enabled again.

What happens when you press the stop button during a diagram run, is that the nodes that are not yet started at the time when the button was pressed are not started at all. Those nodes that are possible to stop are stopped in a nice way, those that are not are allowed to finish. The nodes that were finished before the button was pressed are finished and will contain valid data.

During a diagram run, it is possible to switch to another window within SciCraft and work on another diagram, or even run it, whatever state the first diagram is in. One could also press the OK button in the dialog at any time, but it will not be possible to run the diagram again until all running nodes are safely stopped.


How to inspect data flow in links

.

After the module diagram has been run it is possible to inspect the data flowing through the different links. This option is located in the links context menu (see figure 2.14). This menu is reached by right clicking on links.

Figure 2.14: Link context menu

The View data sub-menu lists the variables that flows through the higlighted link. Each item in the list is on the format variable-name - info where info can be one of, or a combination of, the following (see figure 2.14 for an example):

By clicking on one of the variables in the View data sub-menu, you will find a dialog box with a spreadsheet popping up. The data in the spreadsheet is the data that flows through the link, in the variable you clicked on. An example of such a dialog box is shown in figure 2.15.

Figure 2.15: Inspection of link data

SciCraft enables you to save the data that is in a spreadsheet, such as the one shown in figure 2.15. By selecting the File menu's Save data... option, you may save the data in the spreadsheet, using all the formats that SciCraft supports for output (see table 3.1 for a list of the formats that SciCraft supports).

How to inspect data in a node

The data available in a node can be inspected in the node context menu, which is accessed by right-cliking the node. The menu item 'Inspect data' is located at the bottom of the node context menu. If there are no data available in the node, the menu item will be disabled (greyed out).

If there are data available in the node, a menu with the items 'Input ports' and 'Output ports' is displayed when you activate the 'Inspect data' item. If one of them is disabled, there are no ports of the specified type with data on them. By activating one of the items, a list of ports will be displayed. Beside the port name, the type and/or size of the data is shown. By clicking on a port item, a spreadsheet displaying the port data will be opened. It is possible to save the data in the spreadsheet to file, refer to section 2.2.9 for more info on saving data.


How to inspect output from a function node

When a module diagram has been run, it is possible to inspect what the function has printed during the last execution of the diagram. This is useful when developing new functions for SciCraft (see section 2.4.1 for details on how to write functions for SciCraft). E.g., some find it useful to print summaries of objects to the screen, when developing and using functions written in R. This output will not be printed to the console when running it under SciCraft. Instead the output is available by right-clicking on a function node (as shown in figure 2.16) and selecting the Show function output option. Then the output that would normally have been printed to the console during the last execution will be shown in a dialog box, as shown in figure 2.16.

Figure 2.16: Showing the output of a function node.

The output shown in the dialog box in figure 2.16, was generated by inserting the following into a R script (in this case the HCA.R file):

print(summary(an_object))

How to open a plot window

Plot windows are opened by double clicking on the node. If you have not executed the diagram, the plot will be empty. For more on plotting, refer to section [*].

How to export diagrams to Encapsulated PostScript format

The Python Pyx package must be installed for this option to work. On a Windows platform this may be bundeled with SciCraft, depending on which SciCraft package is chosen for download. Choose File in the main menu bar and then Export diagram to EPS from the file menu. From the save file dialog, you can choose to save it as an image in black and white or with colours. The current diagram will then be saved in the Encapsualted PostScript (*.eps) format.



SciCraft Development Team