Index: branches/extragear/kde3/graphics/doc/kst/script-chapter.docbook
===================================================================
--- branches/extragear/kde3/graphics/doc/kst/script-chapter.docbook (revision 794893)
+++ branches/extragear/kde3/graphics/doc/kst/script-chapter.docbook (revision 794894)
@@ -1,7801 +1,7801 @@
Working with KstScriptKstScript Classes:
Arrow
Axis
AxisLabel
AxisTickLabel
BinnedMap
BorderedViewObject
Box
Collection
ColorSequence
CrossPowerSpectrum
Curve
CurveCollection
DataMatrix
DataObject
DataObjectCollection
DataSource
DataSourceCollection
DataVector
Debug
DebugLog
DebugLogEntry
Document
Ellipse
ELOG
Equation
EquationCollection
Extension
ExtensionCollection
File
Group
Histogram
HistogramCollection
Image
Kst
Label
Legend
Line
Matrix
MatrixCollection
Object
ObjectCollection
Picture
Plot
PlotCollection
PlotLabel
Plugin
PluginCollection
PluginIO
PluginIOCollection
PluginManager
PluginModule
PluginModuleCollection
Point
PowerSpectrum
PowerSpectrumCollection
Scalar
ScalarCollection
Size
Spectrogram
SpectrogramCollection
String
StringCollection
TimeInterpretation
Vector
VectorCollection
VectorView
ViewObject
ViewObjectCollection
Window
WindowCollection
Class: Arrow
A customizable arrow graphic.
Inherits:
Line
Collection class:
ViewObjectCollection
Constructors:Arrow ( parent )Arrow ( window )Properties:
fromArrow
toArrow
fromArrowScaling
toArrowScaling
Arrow ( ViewObject parent )ViewObject parent -
The parent to place the new arrow in. May also
be a string containing the name of an existing
ViewObject.
Creates a new arrow and places it in the ViewObject parent.
Arrow ( Window window )Window window -
The window to place the new arrow in. May also be a
string containing the name of an existing Window.
Creates a new arrow and places it in the Window window.
boolean fromArrow
True if the arrow has an arrow at the start point.
boolean toArrow
True if the arrow has an arrow at the end point.
number fromArrowScaling
Scale size of the arrow at the start point.
number toArrowScaling
Scale size of the arrow at the end point.
Class: Axis
A class representing a plot axis.
Methods:scaleAuto ( )scaleAutoSpikeInsensitive ( )scaleExpression ( minExp, maxExp )scaleRange ( min, max )Properties:
log
suppressed
oppositeSuppressed
offsetMode
reversed
majorGridLines
minorGridLines
transformation
innerTicks
outerTicks
label
type
majorGridColor
minorGridColor
minorTickCount
majorTickDensity
scaleMode
interpretation
title
tickLabel
void scaleAuto ( )
Sets the scale mode to Auto.
void scaleAutoSpikeInsensitive ( )
Sets the scale mode to Auto Spike Insensitive.
void scaleExpression ( string minExp, string maxExp )string minExp -
The expression for the minimum of the scale.
string maxExp -
The expression for the maximum of the scale.
Sets the scale mode to Expression.
void scaleRange ( number min, number max )number min -
The value for the minimum of the scale.
number max -
The value for the maximum of the scale.
Sets the scale mode to Fixed and sets the range.
boolean log
True if the axis is in logarithm mode.
boolean suppressed
True if this axis is suppressed.
boolean oppositeSuppressed
True if the opposite axis is suppressed. (Right X or top Y)
boolean offsetMode
True if this axis is in base + offset mode.
boolean reversed
True if this axis is reversed.
boolean majorGridLines
True if this axis shows major grid lines.
boolean minorGridLines
True if this axis shows minor grid lines.
string transformation
The transformation expression for this axis.
boolean innerTicks
True if tick marks are displayed inside the plot.
boolean outerTicks
True if tick marks are displayed outside the plot.
string label
The label for this axis.
string type [Read-Only]
The type of axis - X or Y presently.
string majorGridColor
The color for the major grid lines.
string minorGridColor
The color for the minor grid lines.
number minorTickCount
The number of minor ticks between two major ticks. The
special value -1 forces Kst to determine this automatically.
number majorTickDensity
The density of major tick markers along this axis. Value
must be one of:
0 - Coarse1 - Default2 - Fine3 - Very Finenumber scaleMode [Read-Only]
The type of scaling done on the axis.
Value is one of:
0 - Auto1 - All Curves (By Midpoint)2 - Fixed3 - Auto Up (Only Scales Upward)4 - Auto (Spike Insensitive)5 - Auto (obsolete, same as 0)6 - Expression BasedTimeInterpretation interpretation [Read-Only]
The method with which the axis is interpreted and times are
displayed.
AxisLabel title
The label for this axis.
AxisTickLabel tickLabel
The tick label for this axis.
Class: AxisLabel
A class representing a plot axis label.
Properties:
text
font
fontSize
type
string text
Contains the text contents of the label. This may include
scalar references of the form [scalar_name] and some basic LaTeX.
string font
Used to set or get the current font used for the label.
number fontSize
Contains the size of the font used to draw the label.
string type [Read-Only]
The type of axis - X or Y presently.
Class: AxisTickLabel
A class representing a plot axis tick label.
Properties:
font
fontSize
rotation
type
string font
Used to set or get the current font used for the label.
number fontSize
Contains the size of the font used to draw the label.
number rotation
Contains the rotation angle of the label. Rotation is
clockwise from normal and is stored in degrees.
string type [Read-Only]
The type of axis - X or Y presently.
Class: BinnedMap
This class represents a binned map object in Kst.
Inherits:
DataObject
Methods:validate ( )Properties:
x
y
z
binnedMap
hitsMap
xFrom
xTo
yFrom
yTo
nX
nY
autobin
valid
void validate ( )
Validates the plugin.
Vector x
Contains the x vector.
Vector y
Contains the y vector.
Vector z
Contains the z vector.
string binnedMap
Contains the name of binned map matrix.
string hitsMap
Contains the name of the hits map matrix.
Scalar xFrom
Contains the from value of the x vector.
Scalar xTo
Contains the to value of the x vector.
Scalar yFrom
Contains the from value of the y vector.
Scalar yTo
Contains the to value of the y vector.
Scalar nX
Contains the number of x bins.
Scalar nY
Contains the number of y bins.
Scalar autobin
Contains the autobin setting. Zero for no auto-binning and non-zero for auto-binning.
boolean valid [Read-Only]
Returns true if all the inputs and outputs of the binned map have been set.
Class: BorderedViewObject
Represents some objects in a Kst window. This is an abstract
object and may not be instantiated directly. It has several
properties not in regular ViewObjects including margins,
padding, and a border.
Inherits:
ViewObject
Collection class:
ViewObjectCollection
Properties:
padding
margin
borderWidth
borderColor
number padding
The number of pixels between the border and the contents.
number margin
The number of pixels between the edge of the object and the
border.
number borderWidth
The width in pixels of the border.
string borderColor
The border color for this object.
Class: Box
A customizable box graphic.
Inherits:
ViewObject
Collection class:
ViewObjectCollection
Constructors:Box ( parent )Box ( window )Properties:
xRound
yRound
cornerStyle
borderWidth
borderColor
Box ( ViewObject parent )ViewObject parent -
The parent to place the new box in. May also
be a string containing the name of an existing
ViewObject.
Creates a new box and places it in the ViewObject parent.
Box ( Window window )Window window -
The window to place the new box in. May also be a
string containing the name of an existing Window.
Creates a new box and places it in the Window window.
number xRound
The roundness of the corners in the X dimension. Must be
an integer between 0 and 99.
number yRound
The roundness of the corners in the Y dimension. Must be
an integer between 0 and 99.
number cornerStyle
The style to draw the corners of the box.
0 - Miter (default)1 - Bevel2 - Roundnumber borderWidth
The width in pixels of the border.
string borderColor
The border color for this object.
Class: Collection
This is the generic collection class used by Kst to store lists
of objects. It behaves mostly like an array in JavaScript. At
this time indices are read-only. In addition, if a collection
is read-only, mutator methods will throw exceptions.
Iteration looks something like this:
Methods:append ( newObj )prepend ( newObj )remove ( n )remove ( obj )clear ( )Properties:
length
readOnly
void append ( Object newObj )Object newObj -
The new object to append to the collection.
Appends a new object to the end of the collection.
void prepend ( Object newObj )Object newObj -
The new object to prepend to the collection.
Prepends a new object to the start of the collection.
void remove ( number n )number n -
The index of the entry to remove.
Removes an entry from the collection.
void remove ( Object obj )Object obj -
The object to remove.
Removes an object from the collection.
void clear ( )
Clears the collection, removing all entries.
number length [Read-Only]
The number of items in the collection. Items are ordered
0..(length - 1) so it is easy to iterate.
boolean readOnly [Read-Only]
True if this is a read-only collection.
Class: ColorSequence
Provides access to the Kst color sequence used for coloring
curves.
Constructors:ColorSequence ( )Methods:next ( [previous] )tooClose ( firstColor, secondColor )ColorSequence ( )
Default constructor. Creates a new color sequence object.
string next ( [string previous] )string previous -
The previous color in the color sequence you are
following. Not necessary.
[OPTIONAL]
Returns the next color in the color sequence.
boolean tooClose ( string firstColor, string secondColor )string firstColor -
The first of two colors to compare.
string secondColor -
The second of two colors to compare.
Returns true if colors are too close.
Class: CrossPowerSpectrum
This class represents a cross power spectrum object in Kst.
Inherits:
DataObject
Methods:validate ( )Properties:
v1
v2
length
sample
real
imaginary
frequency
valid
void validate ( )
Validates the plugin.
Vector v1
Contains the first vector.
Vector v2
Contains the second vector.
Scalar length
Contains the base 2 logarithm of the length of the cross power spectrum.
Should be an integer >= 2.
Scalar sample
Contains the sample rate.
string real
Contains the name of the output vector holding the real part of the cross power spectrum.
string imaginary
Contains the name of the output vector holding the imaginary part of the cross power spectrum.
string frequency
Contains the name of the output vector holding the frequencies of the cross power spectrum.
boolean valid [Read-Only]
Returns true if all the inputs and outputs of the cross power spectrum have been set.
Class: Curve
Represents a curve formed from an X and a Y vector.
Inherits:
DataObject
Collection class:
CurveCollection
Constructors:Curve ( x, y [, xError [, yError [, xMinusError [, yMinusError]]]] )Curve ( hs )Methods:point ( index )xErrorPoint ( index )yErrorPoint ( index )xMinusErrorPoint ( index )yMinusErrorPoint ( index )Properties:
color
xVector
yVector
xErrorVector
yErrorVector
xMinusErrorVector
xMinusErrorVector
samplesPerFrame
ignoreAutoScale
hasPoints
hasLines
hasBars
lineWidth
pointStyle
lineStyle
barStyle
pointDensity
topLabel
xLabel
yLabel
Curve ( Vector x, Vector y [, Vector xError [, Vector yError [, Vector xMinusError [, Vector yMinusError]]]] )Vector x -
The X vector for the curve. Can be specified as a string
containing the tag name of an existing vector, or as a
vector object.
Vector y -
The Y vector for the curve. Can be specified as a string
containing the tag name of an existing vector, or as a
vector object.
Vector xError -
The X error bar vector for the curve. Can be
specified as a string containing the tag name of
an existing vector, or as a vector object.
[OPTIONAL]Vector yError -
The Y error bar vector for the curve. Can be
specified as a string containing the tag name of
an existing vector, or as a vector object.
[OPTIONAL]Vector xMinusError -
The X minus error bar vector for the curve.
Can be specified as a string containing the
tag name of an existing vector, or as a
vector object.
[OPTIONAL]Vector yMinusError -
The Y minus error bar vector for the curve.
Can be specified as a string containing the
tag name of an existing vector, or as a
vector object.
[OPTIONAL]
Main constructor for Curve class. Constructing a new
curve automatically adds it to the data collection of Kst.
Curve ( Histogram hs )Histogram hs -
Creates a curve from a histogram.
Constructor for Curve class. Allows a curve to be simply created from a Histogram class.
Point point ( number index )number index -
The index of the point to retrieve the coordinates
for. Starts at 0.
Retrieve the coordinates for a given point in the curve.
Returns an invalid point if that index does not exist.
Point xErrorPoint ( number index )number index -
The index of the point to retrieve the coordinates
for. Starts at 0.
Retrieve the coordinates for a given point in the X error
bars. Returns an invalid point if that index does not
exist.
Point yErrorPoint ( number index )number index -
The index of the point to retrieve the coordinates
for. Starts at 0.
Retrieve the coordinates for a given point in the Y error
bars. Returns an invalid point if that index does not
exist.
Point xMinusErrorPoint ( number index )number index -
The index of the point to retrieve the coordinates
for. Starts at 0.
Retrieve the coordinates for a given point in the X minus
error bars. Returns an invalid point if that index does
not exist.
Point yMinusErrorPoint ( number index )number index -
The index of the point to retrieve the coordinates
for. Starts at 0.
Retrieve the coordinates for a given point in the Y minus
error bars. Returns an invalid point if that index does
not exist.
string color
The color of the curve. Stored in the form "#RRGGBB" as
hex values. This property can also be set with English
strings such as "blue".
Vector xVector
The X axis vector for the curve.
Vector yVector
The Y axis vector for the curve.
Vector xErrorVector
The X axis error vector for the curve.
Vector yErrorVector
The Y axis error vector for the curve.
Vector xMinusErrorVector
The X axis negative error vector for the curve.
Vector xMinusErrorVector
The X axis negative error vector for the curve.
number samplesPerFrame [Read-Only]
The number of samples per frame for the curve.
boolean ignoreAutoScale
If true, this curve ignores auto scale.
boolean hasPoints
If true, points are plotted for this curve.
boolean hasLines
If true, lines are drawn for this curve.
boolean hasBars
If true, bars are drawn for this curve.
number lineWidth
Sets the line width for this curve when lines are drawn.
number pointStyle
Sets the point style for this curve when points are drawn.
0 - Cross1 - Hollow box2 - Hollow circle3 - Filled circle4 - Inverted hollow triangle5 - Hollow triangle6 - Filled box7 - Plus8 - Asterisk9 - Inverted filled triangle10 - Filled triangle11 - Hollow diamond12 - Filled diamond13 - Pointnumber lineStyle
Sets the line style for this curve when lines are drawn.
0 - Soild1 - Dash2 - Dot3 - Dash Dot4 - Dash Dot Dotnumber barStyle
Sets the bar style for this curve when bars are drawn.
0 - Lines1 - Solidnumber pointDensity
Sets the point density for this curve when points are plotted.
0 - Draw all points1 - High density2 - Medium density3 - Low densitystring topLabel [Read-Only]
The top label suggestion for this curve.
string xLabel [Read-Only]
The X-axis label suggestion for this curve.
string yLabel [Read-Only]
The Y-axis label suggestion for this curve.
Class: CurveCollection
An array of curves.
Inherits:
Collection
Class: DataMatrix
A matrix object loaded from a data source.
Inherits:
Matrix
Constructors:DataMatrix ( source, field [, xStart, yStart, xN, yN [, skip [, ave]]] )Methods:reload ( )changeFile ( source )change ( xStart, yStart, xCount, yCount [, skip [, ave]] )Properties:
valid
skip
boxcar
xReadToEnd
yReadToEnd
xCountFromEnd
yCountFromEnd
skipLength
field
dataSource
DataMatrix ( DataSource source, string field [, number xStart, number yStart, number xN, number yN [, number skip [, boolean ave]]] )DataSource source -
The DataSource to load data from. This may be
a string containing the url of the DataSource to
load. If so, it will attempt to reuse an
existing DataSource instance, or fall back to
a new DataSource object. It may also be
specified as a DataSource object.
string field -
The field to load from the source.
number xStart -
The x frame to start reading from.
[OPTIONAL]number yStart -
The y frame to start reading from.
number xN -
The number of x frames to read.
number yN -
The number of y frames to read.
number skip -
The number of samples to skip by.
[OPTIONAL]boolean ave -
Set to true to do boxcar filtering.
[OPTIONAL]void reload ( )void changeFile ( DataSource source )DataSource source -
The DataSource to switch to.
Switches this DataMatrix to a different DataSource.
void change ( number xStart, number yStart, number xCount, number yCount [, number skip [, boolean ave]] )number xStart -
The x starting frame.
number yStart -
The y starting frame.
number xCount -
The number of x frames to read.
number yCount -
The number of y frames to read.
number skip -
The number of frames to skip by.
[OPTIONAL]boolean ave -
True to boxcar filter.
[OPTIONAL]
Changes the sequence of data that is read in by this
matrix.
boolean valid [Read-Only]
True if the data matrix is valid.
boolean skip [Read-Only]
True if the matrix should skip by skipLength samples
while reading from the data source.
boolean boxcar [Read-Only]
True if the matrix should be boxcar filtered.
boolean xReadToEnd [Read-Only]
If true, the matrix is read to the end of the source in the
x dimension.
boolean yReadToEnd [Read-Only]
If true, the matrix is read to the end of the source in the
y dimension.
boolean xCountFromEnd [Read-Only]
If true, the matrix reads only a maximum number of samples
from the end of the source in the x dimension.
boolean yCountFromEnd [Read-Only]
If true, the matrix reads only a maximum number of samples
from the end of the source in the y dimension.
number skipLength [Read-Only]
The number of samples to skip by.
string field [Read-Only]
The field being read from the data source to create this
matrix.
DataSource dataSource [Read-Only]
The data source object used by this DataMatrix.
Class: DataObject
The abstract base class for all Kst data objects.
Inherits:
Object
Collection class:
DataObjectCollection
Methods:convertTo ( type )Properties:
type
DataObject convertTo ( string type )string type -
The type to attempt to convert this object to.
Attempts to convert this DataObject to a different type.
The object must be derived from this type at some level.
Null is returned if it is not possible to convert to the
requested type.
string type [Read-Only]
The type of data object this is.
Class: DataObjectCollection
An array of DataObjects.
Inherits:
Collection
Class: DataSource
An object that represents a data file that is understood by
Kst.
Inherits:
Object
Collection class:
DataSourceCollection
Constructors:DataSource ( url [, type] )Methods:isValidField ( )fieldList ( )reset ( )matrixList ( )samplesPerFrame ( field )frameCount ( [field] )setConfiguration ( setting, setting )configuration ( setting )Properties:
valid
empty
completeFieldList
fileName
fileType
source
metaData
DataSource ( string url [, string type] )string url -
The filename or URL to load.
string type -
The name of the data source plugin to use.
[OPTIONAL]
Creates a new DataSource object. If the url cannot be
opened and read, isValid will be false.
boolean isValidField ( )
Returns if the field is valid or not.
StringArray fieldList ( )
Generates a list of the fields available from this source.
void reset ( )
Resets the data source.
StringArray matrixList ( )
Generates a list of the matrices available from this source.
number samplesPerFrame ( string field )string field -
A field name to get the number of
samples per frame for. This is the same for every
field in some sources, but different in others.
The number of samples per frame for this field or source.
number frameCount ( [string field] )string field -
An optional field name to get the number of
frames for. This is the same for every
field in some sources, but different in others.
[OPTIONAL]
Gets the number of frames for the source, or the given
field if it is specified.
boolean setConfiguration ( string setting, string setting )string setting -
Gives the setting name to set the value of.
string setting -
Gives the value of the setting.
Sets a configuration setting of the data source.
string configuration ( string setting )string setting -
Gives the setting name to retrive the value of.
Gets a configuration setting of the data source.
boolean valid [Read-Only]
True if the data source is valid.
boolean empty [Read-Only]
True if the data source is empty.
boolean completeFieldList [Read-Only]
True if the field list is complete.
string fileName [Read-Only]
Name of the file.
string fileType [Read-Only]
The type (format) of the file, such as ASCII.
string source [Read-Only]
The name of the data source.
StringArray metaData [Read-Only]
Any metadata associated with the data source. This is an
associative array of form metaData["key"] = "value".
Class: DataSourceCollection
An array of DataSources.
Inherits:
Collection
Class: DataVector
A vector object loaded from a data source.
Inherits:
Vector
Constructors:DataVector ( source, field [, start [, n [, skip [, ave]]]] )Methods:reload ( )changeFile ( source )changeFrames ( start, count [, skip [, ave]] )Properties:
valid
skip
boxcar
readToEnd
countFromEnd
skipLength
startFrame
startFrameRequested
frames
framesRequested
samplesPerFrame
field
dataSource
DataVector ( DataSource source, string field [, number start [, number n [, number skip [, boolean ave]]]] )DataSource source -
The DataSource to load data from. This may be
a string containing the url of the DataSource to
load. If so, it will attempt to reuse an
existing DataSource instance, or fall back to
a new DataSource object. It may also be
specified as a DataSource object.
string field -
The field to load from the source.
number start -
The frame to start reading from.
[OPTIONAL]number n -
The number of frames to read.
[OPTIONAL]number skip -
The number of samples to skip by.
[OPTIONAL]boolean ave -
Set to true to do boxcar filtering.
[OPTIONAL]void reload ( )void changeFile ( DataSource source )DataSource source -
The DataSource to switch to.
Switches this DataVector to a different DataSource.
void changeFrames ( number start, number count [, number skip [, boolean ave]] )number start -
The starting frame.
number count -
The number of frames to read.
number skip -
The number of frames to skip by.
[OPTIONAL]boolean ave -
True to boxcar filter.
[OPTIONAL]
Changes the sequence of data that is read in by this
vector.
boolean valid [Read-Only]
True if the data vector is valid.
boolean skip [Read-Only]
True if the vector should skip by skipLength samples
while reading from the data source.
boolean boxcar [Read-Only]
True if the vector should be boxcar filtered.
boolean readToEnd [Read-Only]
If true, the vector is read to the end of the source.
boolean countFromEnd [Read-Only]
If true, the vector reads only a maximum number of samples
from the end of the source.
number skipLength [Read-Only]
The number of samples to skip by.
number startFrame [Read-Only]
The starting frame number.
number startFrameRequested [Read-Only]
The requested starting frame number. May not be the
actual startFrame.
number frames [Read-Only]
The number of frames read from the source.
number framesRequested [Read-Only]
The number of frames requested to be read from the source.
May not be the actual frames.
number samplesPerFrame [Read-Only]
The number of samples per frame for the associated data
source.
string field [Read-Only]
The field being read from the data source to create this
vector.
DataSource dataSource [Read-Only]
The data source object used by this DataVector.
Class: Debug
A reference to the debug and logging subsystem of Kst.
Methods:warning ( message )error ( message )notice ( message )debug ( message )clear ( )clearNewError ( )Properties:
log
newError
version
revision
void warning ( string message )string message -
Logs a warning message to the Kst log.
void error ( string message )string message -
Logs an error message to the Kst log.
void notice ( string message )string message -
Logs a notice to the Kst log.
void debug ( string message )string message -
Logs a debug message to the Kst log.
void clear ( )
Clears the Kst log.
void clearNewError ( )
Clears the new error flag.
DebugLog log [Read-Only]
Provides access to the Kst log contents.
boolean newError [Read-Only]
Return the value of the new error flag.
string version [Read-Only]
Return the version of Kst.
string revision [Read-Only]
Return the revision of Kst.
Class: DebugLog
A reference to the Kst debug log. This object is an array of
the entries in the debug log. It cannot be modified. The
length of the array is the number of entries, and each entry
is a DebugLogEntry object.
Constructors:DebugLog ( )Properties:
length
text
lengthNotices
textNotices
lengthWarnings
textWarnings
lengthErrors
textErrors
lengthDebugs
textDebugs
DebugLog ( )
Create a new DebugLog object which is a reference to the
Kst debug log.
number length [Read-Only]
The number of entries in the log.
string text [Read-Only]
The text contents of the log as a single large string with
carriage returns between entries.
number lengthNotices [Read-Only]
The number of notices in the log.
string textNotices [Read-Only]
The text contents of the log notices as a single large string with
carriage returns between entries.
number lengthWarnings [Read-Only]
The number of warnings in the log.
string textWarnings [Read-Only]
The text contents of the log warnings as a single large string with
carriage returns between entries.
number lengthErrors [Read-Only]
The number of errors in the log.
string textErrors [Read-Only]
The text contents of the log errors as a single large string with
carriage returns between entries.
number lengthDebugs [Read-Only]
The number of debug messages in the log.
string textDebugs [Read-Only]
The text contents of the log debug messages as a single large string with
carriage returns between entries.
Class: DebugLogEntry
An entry in the Kst debug log.
Properties:
text
date
level
string text [Read-Only]
Contains the text of this entry.
date date [Read-Only]
Contains the timestamp of this entry.
string level [Read-Only]
Contains the log level for this entry.
N - NoticeD - DebugW - WarningE - ErrorA single space ' ' indicates an unknown entry type.Class: Document
A pointer to a Kst document. Typically accessed via the global
Kst object via Kst.document.
Methods:save ( [filename] )newDocument ( )load ( filename )Properties:
text
name
modified
void save ( [string filename] )string filename -
An optional filename to save to. If not
provided, it will be saved to the current
filename or the user will be prompted.
[OPTIONAL]
Saves the current Kst session to disk.
void newDocument ( )
Clears the current Kst session and starts a new one.
boolean load ( string filename )string filename -
The filename for a Kst file to load.
Loads a new Kst file into Kst.
string text [Read-Only]
The XML text of the current session in Kst-file form.
string name
The filename for the current Kst session.
boolean modified
True if the document has been modified but not saved.
Class: Ellipse
A customizable ellipse graphic.
Inherits:
ViewObject
Collection class:
ViewObjectCollection
Constructors:Ellipse ( parent )Ellipse ( window )Properties:
borderWidth
borderColor
Ellipse ( ViewObject parent )ViewObject parent -
The parent to place the new ellipse in. May also
be a string containing the name of an existing
ViewObject.
Creates a new ellipse and places it in the ViewObject parent.
Ellipse ( Window window )Window window -
The window to place the new ellipse in. May also be a
string containing the name of an existing Window.
Creates a new ellipse and places it in the Window window.
number borderWidth
The width of the border of the ellipse.
string borderColor
The color of the border of the ellipse.
Class: ELOG
An object that represents the interface to an ELOG server.
Constructors:ELOG ( )Methods:submit ( )addAttachment ( attachment )clearAttachments ( )addAttribute ( attribute, attributeValue )removeAttribute ( attribute )clearAttributes ( )Properties:
hostname
port
logbook
username
password
writePassword
text
encodedHTML
suppressEmailNotification
includeCapture
captureWidth
captureHeight
includeConfiguration
includeDebugInfo
ELOG ( )
Interface to an ELOG server.
void submit ( )
Submits the ELOG entry.
void addAttachment ( string attachment )string attachment -
The name of the attachment.
Adds an attachment to the ELOG entry.
void clearAttachments ( )
Clears the list of attachments in the ELOG entry.
void addAttribute ( string attribute, string attributeValue )string attribute -
The name of the attribute to be added to the ELOG entry.
string attributeValue -
The value of the attribute to be added to the ELOG entry.
Adds an attribute to the ELOG entry.
void removeAttribute ( string attribute )string attribute -
The name of the attribute to be removed from the ELOG entry.
Removes an attribute from the ELOG entry.
void clearAttributes ( )
Clears the list of attributes in the ELOG entry.
string hostname
The hostname of the ELOG server.
number port
The port number of the ELOG server.
string logbook
A weblog made available by the ELOG server.
string username
Username.
string password
Password.
string writePassword
The write password.
string text
Text.
boolean encodedHTML
The message is HTML encoded.
boolean suppressEmailNotification
If true email notification is suppressed.
boolean includeCapture
If true an image capture of the Kst session is included in the ELOG entry.
number captureWidth
The width of the image capture to be included in the ELOG entry.
number captureHeight
The height of the image capture to be included in the ELOG entry.
boolean includeConfiguration
If true a capture of the Kst session is included in the ELOG entry.
boolean includeDebugInfo
If true a capture of the Kst debug information is included in the ELOG entry.
Class: Equation
This object represents an equation object in Kst. It is
interpreted using Kst's internal equation interpreter, and
not the JavaScript interpreter. It should be considerably
faster than the JavaScript interpreter.
Inherits:
DataObject
Collection class:
EquationCollection
Constructors:Equation ( equation, xVector [, interpolate] )Equation ( equation, x0, x1, n )Properties:
equation
valid
xVector
yVector
Equation ( string equation, Vector xVector [, boolean interpolate] )string equation -
The text of the equation to interpret.
Vector xVector -
The X axis (input) vector to use. The symbolic
variable x; represents the value at the
current index in this vector. A text string
representing the name of an existing vector may
also be used here.
boolean interpolate -
If true, the equation interpreter will
interoplate to the highest resolution
vector. This is the default behavior.
[OPTIONAL]
The default constructor to create an equation object.
Equation ( string equation, number x0, number x1, number n )string equation -
The text of the equation to interpret.
number x0 -
The first value of the generated X (input) vector.
number x1 -
The last value of the generate X (input) vector.
number n -
The number of values in the generated input vector.
A utility constructor which generates an X vector
implicitly.
string equation
The text of the equation. See the Kst documentation for
more information on what the internal equation interpreter
supports.
boolean valid [Read-Only]
True if the equation object is valid. If false, any
values obtained from the yVector should be considered
meaningless.
Vector xVector [Read-Only]
The X vector (input vector) for the equation.
Vector yVector [Read-Only]
The Y vector (output vector) for the equation.
Class: EquationCollection
An array of Equations.
Inherits:
Collection
Class: Extension
A class representing an extension in Kst.
Collection class:
ExtensionCollection
Methods:load ( )unload ( )Properties:
name
loaded
boolean load ( )
Loads this extension into Kst.
void unload ( )
Unloads this extension if it is loaded.
string name [Read-Only]
The name of this extension.
boolean loaded [Read-Only]
True if this extension is presently loaded.
Class: ExtensionCollection
An array of Kst Extension objects.
Inherits:
Collection
Class: File
An object that represents a file.
Constructors:File ( name )Methods:open ( )close ( )readLine ( [length] )Properties:
name
size
exists
File ( string name )string name -
Name of the file to be opened.
Constructs a file with the given name.
void open ( )
Opens the file.
void close ( )
Closes the file.
string readLine ( [number length] )number length -
Maximum length of string to return
[OPTIONAL]
Reads a line from the file.
string name
The name of the file.
Size size
The size of the file.
boolean exists
True if the underlying file exists.
Class: Group
A customizable group object.
Inherits:
ViewObject
Collection class:
ViewObjectCollection
Constructors:Group ( parent )Group ( window )Methods:append ( newObj )prepend ( newObj )ungroup ( )Group ( ViewObject parent )ViewObject parent -
The parent to place the new arrow in. May also
be a string containing the name of an existing
ViewObject.
Creates a new arrow and places it in the ViewObject parent.
Group ( Window window )Window window -
The window to place the new arrow in. May also be a
string containing the name of an existing Window.
Creates a new arrow and places it in the Window window.
void append ( Object newObj )Object newObj -
The new object to append to the collection.
Appends a new object to the end of the collection.
void prepend ( Object newObj )Object newObj -
The new object to prepend to the collection.
Prepends a new object to the start of the collection.
void ungroup ( )
Removes all objects from the collection.
Class: Histogram
A class representing a histogram object in Kst.
Inherits:
DataObject
Collection class:
HistogramCollection
Constructors:Histogram ( vector [, xMin [, xMax [, bins]]] )Methods:setVector ( vector )setRange ( from, to )Properties:
realTimeAutoBin
normalization
bins
xMin
xMax
xVector
yVector
Histogram ( Vector vector [, number xMin [, number xMax [, number bins]]] )Vector vector -
The input vector for the histogram. May also be
specified by the tagName for an existing vector.
number xMin -
The minimum X value. Default is -10.
[OPTIONAL]number xMax -
The maximum X value. Default is 10.
[OPTIONAL]number bins -
The number of bins to use. Default is 60.
[OPTIONAL]
Creates a new histogram with the defined properties.
void setVector ( Vector vector )Vector vector -
The vector for the histogram to operate on.
Sets the input vector for the histogram.
void setRange ( number from, number to )number from -
The starting X value.
number to -
The ending X value.
Sets the X range for the histogram.
boolean realTimeAutoBin
If true, the histogram automatically bins in real-time.
number normalization
Set the y-axis normalization.
0 - Number in bin1 - Percent in bin2 - Fraction in bin3 - Peak bin = 1.0number bins
The number of bins for the histogram.
number xMin [Read-Only]
The minimum X value for the histogram.
number xMax [Read-Only]
The maximum X value for the histogram.
Vector xVector [Read-Only]
The X-axis vector generated by the histogram.
Vector yVector [Read-Only]
The Y-axis vector generated by the histogram.
Class: HistogramCollection
An array of Histograms.
Inherits:
Collection
Class: Image
An image object created from a matrix.
Inherits:
DataObject
Constructors:Image ( matrix )Methods:minMaxThreshold ( )smartThreshold ( )Properties:
matrix
map
palette
lowerThreshold
upperThreshold
autoThreshold
numContours
contourWeight
color
Image ( Matrix matrix )Matrix matrix -
The matrix for the image. Can be specified as a string
containing the tag name of an existing matrix, or as a
matrix object.
Main constructor for Image class. Constructing a new
image automatically adds it to the data collection of Kst.
void minMaxThreshold ( )
Set the thresholding to the current minimum and maximum of the
associated matrix.
void smartThreshold ( )
Set the thresholding to automatically calculated smart values based
on the current values of the the associated matrix.
Matrix matrix
The matrix associated with the image.
number map
The map type of the image.
0 - Color map1 - Contour map2 - Color map and contour mapstring palette
The name of the palette associated with the image color map.
number lowerThreshold
The lower threshold associated with the map.
number upperThreshold
The upper threshold associated with the map.
boolean autoThreshold
If true, automatic thresholding is enabled.
number numContours
The number of contour levels if the contour map is enabled.
number contourWeight
The weight of the lines used to draw the contour map,
if the contour map is enabled. A value of -1 can be
used for a variable contour weight.
string color
The color of the contours. Stored in the form "#RRGGBB" as
hex values. This property can also be set with English
strings such as "blue".
Class: Kst
The global Kst object. Accessed as Kst, this cannot be
reinstantiated.
Methods:loadScript ( fileName )resetInterpreter ( )purge ( )Properties:
dataSources
scalars
strings
vectors
matrices
windows
objects
colors
extensions
document
pluginManager
gui
boolean loadScript ( string fileName )string fileName -
The file to load the script from.
Loads a script file from disk and runs it.
void resetInterpreter ( )
Resets the KstScript interpreter. All variables will be
lost.
void purge ( )
Purges unused objects in Kst. The has the same behavior as
the purge button in the data manager.
DataSourceCollection dataSources [Read-Only]
The list of all loaded data sources.
ScalarCollection scalars [Read-Only]
The list of all scalars in Kst.
StringCollection strings [Read-Only]
The list of all strings in Kst.
VectorCollection vectors [Read-Only]
The list of all vectors in Kst.
MatrixCollection matrices [Read-Only]
The list of all matrices in Kst.
WindowCollection windows [Read-Only]
The list of all Kst windows in this process.
DataObjectCollection objects [Read-Only]
The list of all data objects in Kst.
ColorSequence colors [Read-Only]
A reference to the Kst color sequence in its current state.
ExtensionCollection extensions [Read-Only]
The list of all extensions Kst can find installed on the
system.
Document document [Read-Only]
An object that provides access to the current Kst document
along with various utility functions.
PluginManager pluginManager [Read-Only]
A reference to the plugin management subsystem of Kst.
QWidget gui [Read-Only]
A reference to the Kst GUI. This is implemented using
KJSEmbed. The GUI is dynamic and may change between
releases or even while Kst is running.
Class: Label
A text label.
Inherits:
BorderedViewObject
Collection class:
ViewObjectCollection
Constructors:Label ( parent )Label ( window )Methods:adjustSizeForText ( )Properties:
text
font
fontSize
justification
rotation
dataPrecision
interpreted
scalarReplacement
autoResize [Obsolete]Label ( ViewObject parent )ViewObject parent -
The parent to place the new label in. May also
be a string containing the name of an existing
ViewObject.
Creates a new label and places it in the ViewObject parent.
Label ( Window window )Window window -
The window to place the new label in. May also be a
string containing the name of an existing Window.
Creates a new label and places it in the Window window.
void adjustSizeForText ( )
Adjusts the size of the label to fit the text.
string text
Contains the text contents of the label. This may include
carriage returns (\n), scalar references of the form
[scalar_name], and some basic LaTeX.
string font
Used to set or get the current font used for the label.
number fontSize
Contains the size of the font used to draw the label.
number justification
The justification for the label. This is a bit field with
two segments, one for horizontal and one for vertical
justification. The values are as follows:
0 - Justify None1 - Justify Left / Top2 - Justify Right / Bottom3 - Justify Center
Set the low order 8 bits to one of these values to
control horizontal justification. Set the next 8 bits
to one of these to control vertical justification.
Example:
number rotation
Contains the rotation angle of the label. Rotation is
clockwise from normal and is stored in degrees.
number dataPrecision
Contains the number of digits of precision to display data
values in the label. Restricted to a value between 0 and
16 inclusive.
boolean interpreted
Determines if the contents of the label should be
interpreted in order to substitute LaTeX-like
constructs. Default is true.
boolean scalarReplacement
Determines if the contents of the label should be
interpreted in order to substitute variable reference
constructs. Default is true.
boolean autoResize [Obsolete]
Automatically resizes the label to fit the text exactly.
May trigger a slight move of the label. It will not
automatically resize if the user resizes it manually via
the size property or layout mode.
Class: Legend
A plot legend.
Inherits:
BorderedViewObject
Collection class:
ViewObjectCollection
Constructors:Legend ( parent )Legend ( window )Methods:addCurve ( curve )removeCurve ( curve )Properties:
font
fontSize
textColor
vertical
curves
title
Legend ( ViewObject parent )ViewObject parent -
The parent to place the new legend in. May also
be a string containing the name of an existing
ViewObject.
Creates a new legend and places it in the ViewObject parent.
Legend ( Window window )Window window -
The window to place the new legend in. May also be a
string containing the name of an existing Window.
Creates a new legend and places it in the Window window.
void addCurve ( string curve )string curve -
The curve to be added. This can be either the name of the curve or a reference to the curve.
Adds the curve to the legend.
Throws: GeneralError -
Throws this exception if the curve could not be found.
void removeCurve ( string curve )string curve -
The curve to be removed. This can be either the name of the curve or a reference to the curve.
Removes the curve from the legend.
Throws: GeneralError -
Throws this exception if the curve could not be found.
string font
Used to set or get the current font used for the legend.
number fontSize
Contains the size of the font used to draw the legend.
string textColor
Contains the color of the text used to draw the legend.
boolean vertical
True if the legend entries are stacked vertically.
CurveCollection curves [Read-Only]
The list of curves shown in the legend.
string title
The title of the legend.
Class: Line
A customizable line graphic.
Inherits:
ViewObject
Collection class:
ViewObjectCollection
Constructors:Line ( parent )Line ( window )Properties:
from
to
width
capStyle
lineStyle
Line ( ViewObject parent )ViewObject parent -
The parent to place the new line in. May also
be a string containing the name of an existing
ViewObject.
Creates a new line and places it in the ViewObject parent.
Line ( Window window )Window window -
The window to place the new line in. May also be a
string containing the name of an existing Window.
Creates a new line and places it in the Window window.
Point from
The starting point of the line.
Point to
The ending point of the line.
number width
The width of the line.
number capStyle
The cap style for the line.
0 - Flat - may not cover the line ends (default)1 - Box - may extend past line ends2 - Roundednumber lineStyle
The style for the line.
0 - Solid line(default)1 - Dashed line2 - Dotted line3 - Dash - dot line4 - Dash - dot - dot lineClass: Matrix
Represents a matrix of any type in Kst. Some matrices are
editable, while others are not.
Inherits:
Object
Collection class:
MatrixCollection
Constructors:Matrix ( )Methods:resize ( columns, rows )zero ( )value ( row, column )setValue ( row, column, value )update ( )Properties:
editable
min
max
mean
numNew
rows
columns
Matrix ( )
Default constructor creates an empty matrix.
void resize ( number columns, number rows )number columns -
The new number of columns in the matrix. Should be >= 1.
number rows -
The new number of rows in the matrix. Should be >= 1.
Resizes the matrix.
Throws: GeneralError -
Throws this exception if the matrix is not
editable.
void zero ( )
Sets all values in the matrix to zero.
Throws: GeneralError -
Throws this exception if the matrix is not editable.
number value ( number row, number column )number row -
The row index of the matrix position to be set.
number column -
The column index of the matrix position to be set.
Gets the value of a matrix at the given row and column indices.
Throws: GeneralError -
Throws this exception if the indices are out of range.
void setValue ( number row, number column, number value )number row -
The row index of the matrix position to be set.
number column -
The column index of the matrix position to be set.
number value -
The value to set the specified matrix position to.
Sets the value of a matrix at the given row and column indices.
Throws: GeneralError -
Throws this exception if the matrix is not editable or the indices are out of range.
void update ( )
Updates the statistical values associated with a matrix.
Throws: GeneralError -
Throws this exception if the matrix is not editable.
number editable [Read-Only]
True if the matrix is editable by the user. This should be
checked before attempting to modify a matrix in any way.
number min [Read-Only]
The value of the smallest sample in the matrix.
number max [Read-Only]
The value of the largest sample in the matrix.
number mean [Read-Only]
The mean value of all samples in the matrix.
number numNew [Read-Only]
The mean value of all samples in the matrix.
number rows [Read-Only]
The number of rows in the matrix.
number columns [Read-Only]
The number of coluns in the matrix.
Class: MatrixCollection
An array of Matrices.
Inherits:
Collection
Class: Object
Represents any object in Kst. This is an abstract
object and may not be instantiated directly.
Collection class:
ObjectCollection
Properties:
tagName
string tagName
A unique identifier for this data object.
Class: ObjectCollection
An array of Objects. This could contain any objects that
inherit from Object, but they are only immediately accessible
in their pure base class form.
Inherits:
Collection
Class: Picture
A customizable picture object.
Inherits:
BorderedViewObject
Collection class:
ViewObjectCollection
Constructors:Picture ( parent )Picture ( window [, url] )Methods:load ( url )Properties:
image
url
refreshTimer
Picture ( ViewObject parent )ViewObject parent -
The parent to place the new picture in. May also
be a string containing the name of an existing
ViewObject.
Creates a new picture and places it in the ViewObject parent.
Picture ( Window window [, string url] )Window window -
The window to place the new picture in. May also be a
string containing the name of an existing Window.
string url -
The URL of a file to load the picture from.
[OPTIONAL]
Creates a new picture and places it in the Window window.
boolean load ( string url )string url -
The URL to retrieve the image from.
Load an image from a give url. Returns true on success.
Image image
The raw image that is being displayed. You can take a copy
of this, manipulate it, then set it back to change the
image.
string url [Read-Only]
The URL of the image if it was loaded from a file and has
not been modified.
number refreshTimer
A timer to automatically refresh the picture. Value of 0
means the timer is disabled. Units are in seconds.
Class: Plot
This class represents a plot in Kst.
Inherits:
BorderedViewObject
Collection class:
PlotCollection
Constructors:Plot ( window )Methods:createLegend ( )Properties:
curves
legend
topLabel
xAxis
yAxis
title
tied
Plot ( Window window )Window window -
The window to place the new plot in. May also be a
string containing the name of an existing Window.
Creates a new plot and places it in the Window window.
Legend createLegend ( )
Creates a Legend for this plot. If a legend already exists
then that one is returned.
CurveCollection curves [Read-Only]
A list of all the Curves used by the plot.
Legend legend [Read-Only]
The Legend for this plot. May be null.
string topLabel
The top label for this plot.
Axis xAxis [Read-Only]
The X-axis for this plot.
Axis yAxis [Read-Only]
The Y-axis for this plot.
PlotLabel title [Read-Only]
The title for this plot.
boolean tied
True if the plot zoom state is tied.
Class: PlotCollection
An array of Plots.
Inherits:
Collection
Class: PlotLabel
A class representing a plot label.
Properties:
text
font
fontSize
justification
string text
Contains the text contents of the label. This may include
carriage returns (\n), scalar references of the form
[scalar_name], and some basic LaTeX.
string font
Used to set or get the current font used for the label.
number fontSize
Contains the size of the font used to draw the label.
number justification
The horizontal justification for the label. This is a bit field.
The values are as follows:
0 - Justify None1 - Justify Left / Top2 - Justify Right / Bottom3 - Justify CenterClass: Plugin
This class represents a data plugin in Kst. It can be
instantiated to create a new instance of a plugin in the
Kst data collection.
Inherits:
DataObject
Collection class:
PluginCollection
Constructors:Plugin ( [module] )Methods:setInput ( index, input )validate ( )Properties:
inputs
outputs
module
lastError
valid
Plugin ( [PluginModule module] )PluginModule module -
The plugin module to use for this plugin.
[OPTIONAL]
Main constructor for the Plugini class. New plugins are
typically invalid until various properties have been set.
void setInput ( number index, Object input )number index -
or name of the input argument to be set.
Object input -
argument.
Sets the input argument at the specified index or name.
void validate ( )
Validates the plugin.
ObjectCollection inputs
The list of inputs to the plugin.
ObjectCollection outputs
The list of outputs to the plugin.
PluginModule module
The library or module that is used for data processing by
this plugin object.
string lastError [Read-Only]
A string containing details of the last error that
occurred while running the plugin.
boolean valid [Read-Only]
True if this plugin object is valid. If false, there is
probably an invalid setting somewhere that needs to be
corrected before it can be used. Some errors include
invalid inputs or outputs, or an invalid or missing
PluginModule.
Class: PluginCollection
An array of Plugins.
Inherits:
Collection
Class: PluginIO
An object representing an input or output for a given plugin
module.
Collection class:
PluginIOCollection
Properties:
name
type
subType
typeObject
description
defaultValue
string name [Read-Only]
The name of the input or output.
string type [Read-Only]
The data type of the input or output.
string subType [Read-Only]
The sub-type of the input or output, if needed. For
instance, a table may have a subtype of float.
string typeObject [Read-Only]
The object type of the input or output. The result will be one of:
VectorScalarStringUnknown - error conditionstring description [Read-Only]
A description of the meaning of the input or output.
string defaultValue [Read-Only]
The default value for this input or output, if specified by
the plugin.
Class: PluginIOCollection
An array of Plugin inputs or outputs.
Inherits:
Collection
Class: PluginManager
A reference to Kst's plugin manager subsystem.
Constructors:PluginManager ( )Properties:
modules
PluginManager ( )
Creates a new PluginManager referring to the Kst plugin
manager.
PluginModuleCollection modules [Read-Only]
A list of all PluginModules available.
Class: PluginModule
Represents a plugin module in Kst. This is not an instance of
a plugin, but a reference to the actual plugin itself. It is
typically used to instantiate a plugin object.
Collection class:
PluginModuleCollection
Properties:
usesLocalData
isFit
isFilter
name
readableName
author
description
version
inputs
outputs
boolean usesLocalData [Read-Only]
If true, the plugin makes use of persistant local storage.
boolean isFit [Read-Only]
If true, this plugin is a fit for a curve.
boolean isFilter [Read-Only]
If true, this plugin is a filter for a vector.
string name [Read-Only]
Represents the short name of the plugin.
string readableName [Read-Only]
Contains a long name for the plugin suitable for display in
a user interface.
string author [Read-Only]
Contains the name of the author of the plugin.
string description [Read-Only]
Contains a text description of what the plugin is and/or
does.
string version [Read-Only]
Contains the version number or string of the plugin.
PluginIOCollection inputs [Read-Only]
A list of all the inputs for the plugin.
PluginIOCollection outputs [Read-Only]
A list of all the outputs of the plugin.
Class: PluginModuleCollection
An array of PluginModules.
Inherits:
Collection
Class: Point
Represents a cartesian co-ordinate of the form (x,y).
Constructors:Point ( )Point ( x, y )Properties:
x
y
Point ( )
Creates a new point object with value (0.0, 0.0).
Point ( number x, number y )number x -
The X value.
number y -
The Y value.
Creates a new point object with value (x, y).
number x
The value of the x co-ordinate.
number y
The value of the y co-ordinate.
Class: PowerSpectrum
This class represents a power spectrum (PSD) object in Kst.
Inherits:
DataObject
Collection class:
PowerSpectrumCollection
Constructors:PowerSpectrum ( vector, freq [, average [, len [, apodize [, removeMean]]]] )Properties:
length
removeMean
average
apodize
frequency
xVector
yVector
vUnits
rUnits
PowerSpectrum ( Vector vector, number freq [, boolean average [, number len [, boolean apodize [, boolean removeMean]]]] )Vector vector -
The vector to use as input to the power spectrum.
number freq -
The frequency for the power spectrum.
boolean average -
[OPTIONAL]number len -
The base 2 logarithm of the length of the power
spectrum. Should be an integer >= 4.
[OPTIONAL]boolean apodize -
If true, sharp discontinuities are removed.
[OPTIONAL]boolean removeMean -
True if the mean should be removed before
performing the transform.
[OPTIONAL]
Creates a new power spectrum (PSD) object in Kst. Units
are V and Hz by default.
number length
Contains the base 2 logarithm of the length to be used for interleaved averaging. Should be an integer >= 4.
boolean removeMean
True if the mean should be removed before performing the
transform.
boolean average
True if the power spectrum should be calculated using an interleaved average.
boolean apodize
If true, sharp discontinuities are removed.
number frequency
Contains the sampling rate of the power spectrum.
Vector xVector [Read-Only]
The X-axis vector for the power spectrum.
Vector yVector [Read-Only]
The Y-axi vector for the power spectrum.
string vUnits
A string containing the units for the vector.
string rUnits
A string containing the units for the rate.
Class: PowerSpectrumCollection
An array of PowerSpectrums.
Inherits:
Collection
Class: Scalar
Represents a scalar value (a number) in Kst.
Inherits:
Object
Collection class:
ScalarCollection
Constructors:Scalar ( )Scalar ( value )Properties:
value
Scalar ( )
Default constructor. Creates a new scalar with value 0.0.
Scalar ( number value )number value -
Creates a new scalar with the specified value.
number value
Used to access or modify the value of a scalar.
Class: ScalarCollection
An array of Scalars.
Inherits:
Collection
Class: Size
Represents a two-dimensional size of the form (w, h).
Constructors:Size ( )Size ( w, h )Properties:
w
h
Size ( )
Creates a new size object with value (0.0, 0.0).
Size ( number w, number h )number w -
The width.
number h -
The height.
Creates a new size object with value (w, h).
number w
The width.
number h
The height.
Class: Spectrogram
This class represents a spectrogram (CSD) object in Kst.
Inherits:
DataObject
Collection class:
SpectrogramCollection
Constructors:Spectrogram ( vector, freq [, average [, len [, apodize [, removeMean]]]] )Properties:
length
removeMean
average
apodize
frequency
matrix
vUnits
rUnits
windowSize
Spectrogram ( Vector vector, number freq [, boolean average [, number len [, boolean apodize [, boolean removeMean]]]] )Vector vector -
The vector to use as input to the spectrogram.
number freq -
The frequency for the spectrogram.
boolean average -
[OPTIONAL]number len -
The base 2 logarithm of the length of the power
spectrum. Should be an integer >= 4.
[OPTIONAL]boolean apodize -
If true, sharp discontinuities are removed.
[OPTIONAL]boolean removeMean -
True if the mean should be removed before
performing the transform.
[OPTIONAL]
Creates a new power spectrum (PSD) object in Kst. Units
are V and Hz by default.
number length
Contains the base 2 logarithm of the length of the spectrogram.
Should be an integer >= 4.
boolean removeMean
True if the mean should be removed before performing the
transform.
number averageboolean apodize
If true, sharp discontinuities are removed.
number frequency
Contains the sampling rate of the spectrogram.
Matrix matrix [Read-Only]
The matrix for the spectrogram.
string vUnits
A string containing the units for the vector.
string rUnits
A string containing the units for the rate.
number windowSize
The window size of the spectrogram.
Class: SpectrogramCollection
An array of Spectrograms.
Inherits:
Collection
Class: String
Represents a string in Kst. Note that this is not
analagous to a string in JavaScript, and may not be directly
interchanged as such. A Kst String is an object internal to
Kst and is subject to update scheduling, sharing, and other
policies of the Kst core. However the contents of a
String may be manipulated with JavaScript string manipulation
functions.
Inherits:
Object
Collection class:
StringCollection
Constructors:String ( )Properties:
value
String ( )
Default constructor - creates an empty String.
string value
The value of the String.
Class: StringCollection
An array of Kst Strings.
Inherits:
Collection
Class: TimeInterpretation
A class representing a time interpretation. It is used to
convert values from one set of units to display in another.
Properties:
active
axisType
input
output
boolean active
True if the axis is being interpreted.
string axisType [Read-Only]
The type of axis this interpretation applies to.
number input
The format of the input to the interpretation.
Must be one of:
0 - Standard C Time1 - TAI2 - JD3 - MJD4 - RJD5 - JYnumber output
The format to convert the interpretation to.
Must be one of:
0 - DD/MM/YY HH:MM:SS1 - YY/MM/DD HH:MM:SS2 - JD3 - MJD4 - RJD5 - JY6 - Localized Short Date7 - Localized Long DateClass: Vector
Represents a vector of any type in Kst. Some vectors are
editable, while others are not. This class behaves just as a
JavaScript array, but has additional properties and methods.
Inherits:
Object
Collection class:
VectorCollection
Constructors:Vector ( )Vector ( array )Methods:resize ( size )interpolate ( i, n )zero ( )update ( )Properties:
length
min
max
mean
numNew
numShifted
editable
numNaN
array
Vector ( )
Default constructor creates an empty, editable vector.
- Vector ( Array array )
- Array array -
+ Vector ( Array array )
+ Array array -
The array to be copied.
Creates a vector that is a copy of array.
void resize ( number size )number size -
The new size of the vector. Should be >= 2.
Resizes the vector.
Throws: GeneralError -
Throws this exception if the vector is not
editable.
number interpolate ( number i, number n )number i -
The sample number to obtain the interpolated value of.
number n -
The number of samples to interpolate to.
Interpolates the vector to n samples and
returns the interpolated value of sample i.
void zero ( )
Sets all values in the vector to zero.
Throws: GeneralError -
Throws this exception if the vector is not editable.
void update ( )
Updates the statistical values associated with a vector.
Throws: GeneralError -
Throws this exception if the vector is not editable.
number length [Read-Only]
The number of samples in the vector.
number min [Read-Only]
The value of the smallest sample in the vector.
number max [Read-Only]
The value of the largest sample in the vector.
number mean [Read-Only]
The mean value of all samples in the vector.
number numNew [Read-Only]number numShifted [Read-Only]number editable [Read-Only]
True if the vector is editable by the user. This should be
checked before attempting to modify a vector in any way.
number numNaN [Read-Only]
The number of NaN values in the vector.
- Array array [Read-Only]
+ Array array [Read-Only]
The vector as an Array.
Class: VectorCollection
An array of Vectors.
Inherits:
Collection
Class: VectorView
Represents a vectorView.
Inherits:
DataObject
Constructors:VectorView ( x, y )Properties:
x
y
flag
xMin
xMax
yMin
yMax
useXMin
useXMax
useYMin
useYMax
interpolation
VectorView ( Vector x, Vector y )Vector x -
The x-vector.
Vector y -
The y-vector.
Creates a new vector view with the given x-vector and y-vector.
Vector x
the x-vector.
Vector y
the y-vector.
Vector flag
the flag-vector. Those points corresponding to non-zero values of the flag vector
are removed from the output vectors.
Scalar xMin
the value for the minimum x-value for the view range.
Scalar xMax
the value for the maximum x-value for the view range.
Scalar yMin
the value for the minimum y-value for the view range.
Scalar yMax
the value for the maximum y-value for the view range.
boolean useXMin
If true, the minimum x-value is respected.
boolean useXMax
If true, the maximum x-value is respected.
boolean useYMin
If true, the minimum y-value is respected.
boolean useYMax
If true, the maximum y-value is respected.
number interpolation
the value for the maximum y-value for the view range. Must be one of:
0 - interpolate to the x-vector1 - interpolate to the y-vector2 - interpolate to the high resolution vector3 - interpolate to the low resolution vectorClass: ViewObject
Represents any object in a Kst window. This is an abstract
object and may not be instantiated directly.
Inherits:
Object
Collection class:
ViewObjectCollection
Methods:resize ( size )move ( pos )findChild ( pos )convertTo ( type )raiseToTop ( )lowerToBottom ( )raise ( )lower ( )remove ( )Properties:
position
size
transparent
onGrid
columns
color
backgroundColor
maximized
minimumSize
type
children
ViewObject resize ( Size size )Size size -
The new size for the object.
Resizes the object to the given size, if possible.
ViewObject move ( Point pos )Point pos -
The position to move the object to.
Moves the object to a new position, if possible.
ViewObject findChild ( Point pos )Point pos -
The relative position to search.
Finds the topmost child of this view object at the given
point. Returns null if there is no child there.
ViewObject convertTo ( string type )string type -
The type to attempt to convert this object to.
Attempts to convert this ViewObject to a different type.
The object must be derived from this type at some level.
Null is returned if it is not possible to convert to the
requested type.
void raiseToTop ( )
Raises the object to the top of the z-order.
void lowerToBottom ( )
Lowers the object to the bottom of the z-order.
void raise ( )
Raises the object one place in the z-order.
void lower ( )
Lowers the object one place in the z-order.
void remove ( )
Deletes the object.
Point position
The location of the object relative to its parent.
Size size
The size of the object in pixels.
boolean transparent
True if this object is transparent. Not all objects
support transparency.
boolean onGrid
True if the children of this object are on a grid.
number columns
The number of columns the children are organized into. If
this value is modified, onGrid is set to true.
string color
The foreground color for this object.
string backgroundColor
The background color for this object.
boolean maximized
If true, this object is maximized relative to its parent.
This is a temporary state whereby the plot uses all the
space available in the parent but can be restored to
normal size again.
Size minimumSize [Read-Only]
The minimum size of the view object.
string type [Read-Only]
A string containing the type of this view object.
ViewObjectCollection children [Read-Only]
The list of all children of this view object in z-order
from the furthest back to the closest to the top. This
is a reference to a collection which may be modified, but
cannot be set.
Class: ViewObjectCollection
An array of ViewObjects.
Inherits:
Collection
Class: Window
An object that represents a reference to a Kst window or tab.
Collection class:
WindowCollection
Constructors:Window ( [name] )Methods:repaint ( )close ( )Properties:
windowName
plots
view
columns
Window ( [string name] )string name -
A name for the new window.
[OPTIONAL]
Creates a new window and object to refer to it.
void repaint ( )
Repaints the window.
void close ( )
Closes the window.
string windowName
The name of the window this object refers to.
PlotCollection plots
The list of plots contained in this window, flattened.
ViewObject view
The view object for this window.
number columns
The number of columns the children are organized into. If
this value is modified, onGrid is set to true.
Class: WindowCollection
An array of Kst Windows.
Inherits:
Collection
Index: branches/extragear/kde3/graphics/doc/kst/extensions-chapter.docbook
===================================================================
--- branches/extragear/kde3/graphics/doc/kst/extensions-chapter.docbook (revision 794893)
+++ branches/extragear/kde3/graphics/doc/kst/extensions-chapter.docbook (revision 794894)
@@ -1,575 +1,575 @@
Kst Extensions
&kst; extensions are a powerful way to add functionality to &kst;. They can, for example, add elements to the &kst; user interface. They are usually designed to accomplish specific tasks which aren't of general use to the &kst; community.
To load or unload extensions in &kst;, select SettingsExtensions.... A dialog will be presented which allows you to load or unload installed plugins.
Extensions DialogThe ELOG Extension
The ELOG extension allows event monitors to create logbook entries on a server running the Electronic Logbook (ELOG) application. The created logbook entries can be used, for example, to remotely monitor &kst; events or to produce periodic data reports. For information on configuring and maintaining an ELOG server, please see the official ELOG Homepage. To enable the ELOG extension in &kst;, select SettingsExtensions... and ensure that ELOG Extension is checked.
Server and Logging Settings
Server and logging settings should be configured before an entry is added to a logbook. To configure logging settings, select SettingsELOG... or click the Configure... button in the ELOG Entry dialog accessed from either FileAdd ELOG Entry... or the Event Monitor dialog if ELOG functionality is enabled for an event monitor object. The following dialog should be displayed:
Event Monitor Server SettingsEvent Monitor Server Settings
Descriptions of the settings in this dialog follow.
Configuration, Save, and Load
The Configuration drop down list contains a list of saved ELOG server configurations.
To load a set of configuration settings, select an item from the list and click the Load button.
To save the current configuration settings in this dialog into a slot, select the desired slot and click the
Save button.
Saving settings into a slot overwrites any existing settings in that slot.
IP address and Port number
Enter the IP address of the machine running the ELOG server application. The port number that the ELOG server
listens on is configurable through the server, but by default it is 8080, so if you are unsure, enter 8080 as
the port number.
Logbook
Each ELOG server can contain one or more logbooks, so the name of the logbook to write entries to must be
specified. Ensure that the spelling of the logbook name is correct.
User name, User password, and Write password
Depending on the how the ELOG server application is configured, these settings may or may not be necessary.
If they are, enter the correct login credentials in the appropriate textboxes.
Capture size
Use this list box to select the size, in pixels, of the &kst; screen capture to attach (if specified).
Submit as HTML text
If this checkbox is selected, HTML tags may be used in the logbook entry.
Suppress e-mail notification
If the logbook is configured to send e-mail notifications of new entries, selecting this checkbox
will disable the notifications. Note that this option is not related to &kst;'s own e-mail notification
setting for event monitors.
Apply
Click the Apply button to apply the entered settings.
Update
Click Update
to update the ELOG Event Entry dialog.
Close
Click Close to exit the dialog.
Add an ELOG Entry
To add an entry to the logbook, choose FileAdd ELOG Entry...
This brings a dialog allowing the user to provide information for attributes as well as entering the contents for the log message. The types of attributes depend on the logbook you specified. The screenshot below shows one example of possible required attributes.
Adding an EntryAdding EntryLogged Information
Use the three checkboxes at the bottom to select the type of information to be logged.
Include Kst capture specifies that a screen capture of the
currently active window should be included in the entry.
Include Kst configuration file
specifies that *.kst save file should be attached to the entry.
Include Kst debugging information is checked, a copy of the
debug log will be attached to the entry as well.
Configuration...
Clicking Configuration... brings the ELOG Configuration dialog. See the Server and Logging Settings section for details.
Submit
Click Submit to submit the log entry.
Cancel
Click Cancel to close the dialog without posting the log entry.
When the ELOG functionality is enabled for an Event Monitor object, clicking the Configure... button in the New Event Monitor dialog will bring the ELOG Event Entry dialog. In this dialog, the user can enter information for logbook attributes; again, the types of attributes depend on the logbook configured in the ELOG configuration dialog.
Event Monitor Logging SettingsEvent Monitor Logging SettingsLogged Information
See explanation above.
Configuration...
See explanation above.
Test
This button is used to test the ELOG configuration. If the user-specified logbook is configured correctly, clicking Test will post a test message:Test of Event ELOG Entry in the logbook.
Close
Click Close to close the dialog.
ELOG Browser
To view existing logbooks through Kst, choose FileLaunch ELOG Browser....
Launch ELOG BrowserELOG Browser
To quickly view the ELOG browser and add an entry to a logbook, just click the ELOG Browser
in the toolbar to launch the ELOG browser and
Entry Icon
to add an ELOG entry.
Using the ELOG Class in KstScript
Alternatively, you can use the ELOG class provided in KstScript to enter and submit messages in a logbook and change the server and logging settings. See details in the ELOG class documentation.
Adding an ELOG entry through KstScript
elog = new ELOG(); //construct a new ELOG object
elog.port = 8080; //specify the port
elog.hostname = "localhost"; //specify the hostname;
elog.logbook = "demo"; // specify the logbook;
elog.text = "message contents"; //enter the message;
elog.addAttribute("Author", "Kst");
elog.addAttribute("Type", "Routine");
elog.submit();
KstScript
KstScript is a JavaScript binding for &kst;. It aims to offer full control over all aspects of &kst;. To enable KstScript, select SettingsExtensions... and ensure that JavaScript Extension is checked.
Running a KstScript
There are three ways to to run a KstScript.
from the command line when starting &kst;:
kst -E js:"loadScript('myscript.js')"
using kstcmd. kstcmd is a JavaScript interpreter which connects to your &kst; session. It can be run from an external terminal, or from within &kst; itself by selecting ToolsShow JavaScript Console.
kstcmdAttached to Kst session kst-17704
kst> loadScript('myscript.js')
from the menu once &kst; is loaded: FileLoadJavaScript
Note that with the first two methods, any KstScript command, or collection of KstScript commands can be substituted for the loadscript command.
KstScript Examples
KstScript gives &kst; a powerful programming interface. Chiefly, it can be used to construct smart macro functions for common tasks. We will first look at a basic example illustrating how to control &kst; through KstScript, and then we will look at an example of a macro function.
A simple KstScript
Here we have the hello world of KstScripts: plot a curve of random numbers.
// simple.js: A simple KstScript demo.
// Generates a new plot with a curve of random numbers.
// grab the window
var w = Kst.windows[0];
// add a plot to the window
var p = new Plot(w);
// create new (editable) vectors.
// these could also be loaded from files.
var xv = new Vector(); var yv = new Vector();
xv.tagName = "time"; yv.tagName = "signal";
// make their length 100.
xv.resize(100); yv.resize(100);
// fill in their values.
for (var i = 0; i < 100; i++) {
xv[i] = i; //index
yv[i] = Math.random(); //uniformly distributed between 0 and 1.
}
// create a curve from x and y
var c = new Curve(xv,yv);
c.tagName = "signalvstime";
// put the curve in our new plot
p.curves.append(c);
// label the x-axis of our plot
p.xAxis.label = "Time (s)"
This script can be run using any of the methods from . Here is a screenshot of &kst; after entering the commands using the embedded console method.
Simple Output
In the &kst; UI, objects are not labelled by the variable names which we use in our KstScript, but are are referred to by their Tag Name (or "Unique Name"). If you do not manually set the tagName attribute of new objects, then when you look things up in the data manager you will find cryptic names like anonymous vector 1, or, . This is the reason why we received several undefined messages in the screenshot above. If you ever plan to use the UI to work with objects you have created with a KstScript, you will want to set their tagName property. You can also use tag names within KstScript itself. For example, after setting the tagName of our new curve we could have called
p.curves.append("signalvstime");
Writing, Including, and Calling Functions
-As with any JavaScript environment, you can write and call functions with KstScript. Additionally, KstScript posseses a means for a KstScript to load functions from disk. Consider the following example:
+As with any JavaScript environment, you can write and call functions with KstScript. Additionally, KstScript possesses a means for a KstScript to load functions from disk. Consider the following example:
// subroutines.js
function takeSpectraOfTimePlots() {
//takes all of the plots in the first window which have an x-axis of "Time (s)"
// and generates power spectra for their curves, which it dumps into a single new
// plot.
var w = Kst.windows[0];
var p = new Plot(w);
p.xAxis.label = "Frequency (Hz)"
for (var ip = 0; ip < w.plots.length; ip++ ) {
cp = w.plots[ip]; //current plot
if (cp.xAxis.label == "Time (s)") {
for (ic = 0; ip < cp.curves.length; ic++) {
plotSpectrum(p,cp.curves[ic].yVector)
}
}
}
}
function plotSpectrum(p,v) {
//creates a power spectrum for the vector v and displays it in plot p. Assumes
//the vector is data sampled at 1Hz.
ps = new PowerSpectrum(v, 1);
ps.tagName = v.tagName + "-PS";
c = new Curve(ps.xVector,ps.yVector);
c.tagName = ps.tagName + "-C";
p.curves.append(c);
}
This example contains two functions: takeSpectraOfTimePlots() and plotSpectrum(p,v). takeSpectraOfTimePlots() is a macro function which will generate spectra for all of the plots in the first window which have "Time (s)" as their x-axis. In this example, we can see the power of KstScript for such tasks.
The following script loads these routines from the subroutines.js. It uses the simple.js of the previous section to generate a noise plot with a time axis, and then calls takeSpectraOfTimePlots() to find its spectrum. Notice that subroutines.js is loaded using loadScript(), the same call that we used from the command line in .
// callsubs.js
// demonstrate calling subroutines
loadScript('subroutines.js');
loadScript('simple.js');
takeSpectraOfTimePlots();
A screenshot of &kst; after executing these commands is shown below.
CallSubs OutputMore KstScript Documentation
Complete documentation on the KstScript classes is given in Appendix D.