AddTimeSeriesLog v1

../_images/AddTimeSeriesLog-v1_dlg.png

AddTimeSeriesLog dialog.

Summary

Creates/updates a time-series log

Properties

Name Direction Type Default Description
Workspace InOut MatrixWorkspace Mandatory In/out workspace that will store the new log information
Name Input string Mandatory A string name for either a new time series log to be created or an existing name to update
Time Input string Mandatory An ISO formatted date/time string specifying the timestamp for the given log value, e.g 2010-09-14T04:20:12
Value Input number Mandatory The value for the log at the given time
Type Input string double An optional type for the given value. A double value with a Type=int will have the fractional part chopped off. Allowed values: [‘double’, ‘int’]
DeleteExisting Input boolean False If true and the named log exists then the whole log is removed first.

Description

Creates/updates a time-series log entry on a chosen workspace. The given timestamp & value are appended to the named log entry. If the named entry does not exist then a new log is created. A time stamp must be given in ISO8601 format, e.g. 2010-09-14T04:20:12.

By default, the given value is interpreted as a double and a double series is either created or expected. However, if the “Type” is set to “int” then the value is interpreted as an integer and an integer is either created or expected.

Usage

Example

ws = CreateSampleWorkspace("Event",BankPixelWidth=1)

AddTimeSeriesLog(ws, Name="my_log", Time="2010-01-01T00:00:00", Value=100)
AddTimeSeriesLog(ws, Name="my_log", Time="2010-01-01T00:30:00", Value=15)
AddTimeSeriesLog(ws, Name="my_log", Time="2010-01-01T00:50:00", Value=100.2)

log = ws.getRun().getLogData("my_log")
print "my_log has %i entries" % log.size()
for i in range(log.size()):
  print "\t%s\t%f" % (log.times[i], log.value[i])

AddTimeSeriesLog(ws, Name="my_log", Time="2010-01-01T00:00:00", Value=12, Type="int", DeleteExisting=True)
AddTimeSeriesLog(ws, Name="my_log", Time="2010-01-01T00:50:00", Value=34, Type="int")

log = ws.getRun().getLogData("my_log")
print "my_log now has %i entries" % log.size()
for i in range(log.size()):
  print "\t%s\t%i" % (log.times[i], log.value[i])

Output:

my_log has 3 entries
        2010-01-01T00:00:00     100.000000
        2010-01-01T00:30:00     15.000000
        2010-01-01T00:50:00     100.200000
my_log now has 2 entries
        2010-01-01T00:00:00     12
        2010-01-01T00:50:00     34

Categories: Algorithms | DataHandling\Logs