Subsections
EditNode
The edit node can be used to manipulate data before sending it on into the
next node(s) in the module diagram. As of today, it is only possible to execute
one command on a single EditNode. See section 3.3.1 for
more details.
WARNING: With the current implementation, all the commands below can only handle
matrices with numbers or single chars. Text in a matrix will make the operations fail.
TECHNICAL: The reason for this, is that the package Numpy/Numeric is used to perform
(parts) of the computations. The way we are using the package, does not support such
matrices. How ever, the advantage is that the package is very fast. |
Available commands
Currently, there are seven commands available (including the passThrough
command that does nothing) in the EditNode. As mentioned before, it is as of today
only possible to execute one command on a single EditNode. To perform several
operations, you must use multiple EditNodes in your module diagram. We will make
it possible to execute multiple commands on a single EditNode in a later version
of SciCraft. For help on how to execute a command, see
section 3.3.2.
In this section, commands are written in italics, arguments to commands are
written with enclosing single quotes and mandatory arguments are presented in
bold face.
joinMatrices takes a number of matrices and joins them into one. The
matrices given as input must have the same dimensions, except along the join
axis. The join axis is specified with the argument `axis'.
- Number of mandatory arguments: 1
- Total number of arguments: 1
- Valid input: inputs - matrices.
- Output: 1 output port with a single matrix. If operation fails, nothing is
put on the output port.
- Arguments:
- `axis' - Must be an integer of value 0 or 1. If `axis' is 0, the
matrices are joined vertically, and if it is 1 the matrices are joined
horizontally.
You can join a matrix with a matrix horizontally
(`axis' = 1) and get a matrix, but you cannot join them
vertically, as they do not have the same number of columns.
passThrough simply passes the data it reveices on unchanged. You want
to use this if you want to be able to do picking in a plot and save the new
dataset to a file or make use of it in another way in the module diagram.
- Number of mandatory arguments: 0
- Total number of arguments: 0
- Valid input: 1 input - anything
- Output: 1 output port, equals the data received on the input port.
- Arguments:
None
removeColumns removes the specified columns from a dataset. The first
column in the dataset is column number 1.
- Number of mandatory arguments: 1
- Total number of arguments: 2
- Valid input: 1 input - list, matrix
- Output: 1 output port with a list or matrix, depending on input. If all
columns are removed, a empty list or matrix is returned.
- Arguments:
- `columns' - A list with the columns to remove, specified by
column index. The first column is column 1.
- `dimension' - The number of columns in the dataset to operate on. If
there is a mismatch between the dataset on the input port and this argument,
the command will not be executed. Must be specified as an integer.
removeRows removes the specified rows from a dataset. The first row in
the dataset is row number 1.
- Number of mandatory arguments: 1
- Total number of arguments: 2
- Valid input: 1 input - list, matrix
- Output: 1 output port with a list or matrix, depending on input. If all
rows are removed, a empty list or matrix is returned.
- Arguments:
- `rows' - A list with the rows to remove, specified by row
index. The first row is row 1.
- `dimension' - The number of rows in the dataset to operate on. If there
is a mismatch between the dataset on the input port and this argument, the
command will not be executed. Must be specified as an integer.
subset takes a list or a matrix as input, and returns a subset as
specified by the arguments `upperLeft' and `lowerRight'. To understand which
values are extracted, think of a rectangle with corners as specified by the
coordinates. The coordinates are inclusive; if you specify the element
as the upper left coordinate, this element will be included in the subset.
NOTE!
With lists, it is possible to wrap around. For example, if you have list with
10 elements, you can specify `upperLeft' as 8 and `lowerRight' as 5. You will
then get a list with the elements 8, 9, 10, 1, 2, 3, 4 and 5. This will not
work with matrices. |
- Number of mandatory arguments: 2
- Total number of arguments: 3
- Valid input: 1 input - list, matrix
- Output: 1 output port with a subset of the input as specified.
- Arguments:
- `upperLeft' - The upper left coordinate for the subset. Must be
specified as a tuple.
- `lowerRight' - The lower right coordinate for the subset. Must
be specified as a tuple.
- `dimension' - The dimensions of the dataset to reduce. If the dimensions
do not match, the command is not executed.
transpose transposes a dataset, i.e. swaps the axis specified. If the
argument `axis' is ommitted, the commands flips the order of all axis.
If a matrix (rank 2) is supplied, the rows will become columns (and vice versa).
If the rank of the dataset is 3 or higher, ie. a cube, you can use the `axis'
argument to specify the new axis order.
For instance, (1,0,2) would swap axis 0 and 1 of a cubic, but leave axis 2 as
it was.
NOTE!
transpose is currently only supported for datasets of rank 2 or
lower. |
- Number of mandatory arguments: 0
- Total number of arguments: 1
- Valid input: 1 input - list, matrix
- Output: 1 output port with the transposed dataset.
- Arguments:
- `axis' - A tuple specifying the new axis order. If ommitted, the order of
all axis is flipped. This argument is of use only when the rank of the dataset
is 3 or higher.
vectorsToMatrix takes a number of vectors and transforms them into a
matrix. The vectors must be of equal length, and you must specify which axis
the vectors are to be joined along.
- Number of mandatory arguments: 1
- Total number of arguments: 1
- Valid input: inputs - list/vector
- Output: 1 output port with the input vectors transformed into a matrix.
- Arguments:
- `axis' - An integer specifying which axis to join along. 0
makes the vectors rows, 1 makes them columns.
Executing commands
To execute a command in the edit node, first double click on the edit node in
the module diagram to open the configuration window. A window like the one in
figure 3.2 will appear.
Figure 3.2:
Editnode configuration.
|
In the window shown, there are two main areas you need to interact with to configure the
edit node. The first one is the list of tabs and the other one is the content of the tab.
The first thing to do, is to choose what command you want to execute. This is done by
selecting the command in the spinbox under the tab ``Commands''. After this is done, you
set the parameters that the command need in order to run, unless it does not need
any. To do this you select the tab(s) that correspond with the command you selected. For
instance, if you want to remove rows from a dataset, you first choose the command ``Remove
rows'' in the spinbox under the tab ``Commands''. Then you select the tab ``Remove rows''
and input the row number(s) for the row(s) you want to remove. Note that some commands do not
need any parameters, and there will not be any tabs for these.
Please note that if selecting a parameter that needs two input data sets, like
``joinMatrices'', you need to add a second input port, see
.
SciCraft Development Team