ctioga2’s functions

ctioga2 provides functions that can be used from command-files (but not from command-line, unless you choose to run command-file code from command-line using the --eval command). They can be used to evaluate Ruby code, to modify strings or compute values, or to gain access to information from datasets.

This page describes all the functions known to ctioga2. It is generated automatically from the inline documentation of ctioga2.

eval - Evaluate Ruby code

Evaluate its argument as Ruby code

a := $(eval 2 + 2)
# a is now 4

Keep in mind that variables in ctioga2 work by plain text replacement. They have no type. In particular, while this will work:

a := 3
b := $(eval $(a) * 3)
# b is now 9

However, you need to use quotes if you must call functions:

b := $(eval sqrt(2))

Doing the same kind of things with text will be somewhat not satisfying:

a := "two words"
b := $(eval $(a).split(/ /).first)

Running this will give the following syntax error:

[FATAL] (eval):1: syntax error, unexpected $end, expecting ')'
two words.split(/ /
                   ^ while processing line 2 in file 'c.ct2'

Doing it right would require the use of a decent amount of quotes.

point - Get dataset point information

Returns the requested information about the given point in a dataset. Run this way:

$(point x @234)

The first argument, here x tells what we want to know about the given point: its x value (passing x), its y value (passing y), its index (by passing index or idx) both its x and y ready to be used as coordinates for drawing commands using xy. For instance, to draw a circle marker right in the middle of the last dataset plotted, just run

draw-marker $(point xy 0.5) Circle

The second argument specifies a dataset point, just like for data-point.

An optional third argument specifies the dataset from which one wants the point information. Note that the dataset can also be specified within the second argument, but it may be more readable to do it as an optional third. It is parsed as stored-dataset

xavg - Gets the avg of the x column

This is replaced by the the value of 'avg' from the column 'x', applied to the dataset given.

xmax - Gets the max of the x column

This is replaced by the the value of 'max' from the column 'x', applied to the dataset given.

xmin - Gets the min of the x column

This is replaced by the the value of 'min' from the column 'x', applied to the dataset given.

xrange - Gets the range of the x column

This is replaced by the the value of 'range' from the column 'x', applied to the dataset given.

yavg - Gets the avg of the y column

This is replaced by the the value of 'avg' from the column 'y', applied to the dataset given.

ymax - Gets the max of the y column

This is replaced by the the value of 'max' from the column 'y', applied to the dataset given.

ymin - Gets the min of the y column

This is replaced by the the value of 'min' from the column 'y', applied to the dataset given.

yrange - Gets the range of the y column

This is replaced by the the value of 'range' from the column 'y', applied to the dataset given.

zavg - Gets the avg of the z column

This is replaced by the the value of 'avg' from the column 'z', applied to the dataset given.

zmax - Gets the max of the z column

This is replaced by the the value of 'max' from the column 'z', applied to the dataset given.

zmin - Gets the min of the z column

This is replaced by the the value of 'min' from the column 'z', applied to the dataset given.

zrange - Gets the range of the z column

This is replaced by the the value of 'range' from the column 'z', applied to the dataset given.

Generated for ctioga2 version: 0.14.1

Latest news

ctioga2 version 0.14.1 is out

Release 0.14.1 of ctioga2 fixes a crash at startup with Ruby 2.3