\(\renewcommand\AA{\unicode{x212B}}\)

AddTimeSeriesLog v1

../_images/AddTimeSeriesLog-v1_dlg.png

AddTimeSeriesLog dialog.

Summary

Creates/updates a time-series log

See Also

AddSampleLog, GetTimeSeriesLogInformation, MergeLogs

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

import numpy as np
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 {} entries".format(log.size()))
for time, value in zip(log.times, log.value):
  ts = np.datetime_as_string(time.astype(np.dtype('M8[s]')), timezone='UTC')
  print("\t{}\t{:.6f}".format(ts, value))

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 {} entries".format(log.size()))
for time, value in zip(log.times, log.value):
  ts = np.datetime_as_string(time.astype(np.dtype('M8[s]')), timezone='UTC')
  print("\t{}\t{:.6f}".format(ts, value))

Output:

my_log has 3 entries
    2010-01-01T00:00:00Z     100.000000
    2010-01-01T00:30:00Z     15.000000
    2010-01-01T00:50:00Z     100.200000
my_log now has 2 entries
    2010-01-01T00:00:00Z     12.000000
    2010-01-01T00:50:00Z     34.000000

Categories: AlgorithmIndex | DataHandling\Logs

Source

C++ header: AddTimeSeriesLog.h

C++ source: AddTimeSeriesLog.cpp