ExportTimeSeriesLog v1

../_images/ExportTimeSeriesLog-v1_dlg.png

ExportTimeSeriesLog dialog.

Summary

Read a TimeSeries log and return information

Properties

Name Direction Type Default Description
InputWorkspace InOut MatrixWorkspace Mandatory Name of input Matrix workspace containing the log to export.
OutputWorkspace Output MatrixWorkspace Dummy Name of the workspace containing the log events in Export.
LogName Input string   Log’s name to filter events.
UnitOfTime Input string Seconds StartTime, StopTime and DeltaTime can be given in various unit.The unit can be ‘Seconds’ or ‘Nanoseconds’ from run start time.They can also be defined as ‘Percentage’ of total run time. Allowed values: [‘Seconds’, ‘Nano Seconds’]
StartTime Input number Optional Relative starting time of the output series. Its unit is determined by property UnitOfTime.
StopTime Input number Optional Relative stopping time of the output series.Its unit is determined by property UnitOfTime.
OutputAbsoluteTime Input boolean False If true, the output times will be absolute time to 1990.01.01.
NumberEntriesExport Input number Optional Number of entries of the log to be exported. Default is all entries.
IsEventWorkspace Input boolean True If set to true, output workspace is EventWorkspace. Otherwise, it is Workspace2D.

Description

Export a sample log, which is of type TimeSeriesProperty, in a Workspace to a MatrixWorkspace.

The output workspace can be either a MatrixWorkspace or an EventWorkspace. If the output workspace is choosen to be an EventWorkspace, there are some limitations to it.

Output TimeSeries Log to MatrixWorkspace

The output MatrixWorkspace has one spectrum. X-vector and Y-vector have the same size, which is the size of exported TimeSeriesProperty.

The unit of X-vector is either second or nano second.

Output TimeSeries Log As Events

The log values can be exported as a set of events. Each entry in the time series log will be converted to an event, , whose TOF are the log times. It is helpful if the log series has large number of entries. User should rebin the EventWorkspace afterwards.

Limitation

The time of each event in the output EventWorkspace is same as log time. It is not affected by the specified unit of time for the output.

Usage

Example - export a float series to a MatrixWorkspace of type Workspace2D:

# Load data
dataws = LoadNexusProcessed(Filename="PG3_2538_2k.nxs")

# Create a new log
import mantid.kernel as mk
testprop = mk.FloatTimeSeriesProperty("Temp")

import random
random.seed(10)
for i in xrange(60):
    randsec = random.randint(0, 59)
    randval = random.random()*100.
    timetemp = mk.DateAndTime("2012-01-01T00:%d:%d"%(i, randsec))
    testprop.addValue(timetemp, randval)
dataws.run().addProperty("Temp", testprop, True)

# Run algorithm
propws = ExportTimeSeriesLog(InputWorkspace=dataws, LogName="Temp", IsEventWorkspace=False)

# Check
print "Length of X = %d, Length of Y = %d." % (len(propws.readX(0)), len(propws.readY(0)))
print "X[0]  = %.1f, Y[0]  = %.5f" % (propws.readX(0)[0], propws.readY(0)[0])
print "X[20] = %.1f, Y[20] = %.5f" % (propws.readX(0)[20], propws.readY(0)[20])
print "X[40] = %.1f, Y[40] = %.5f" % (propws.readX(0)[40], propws.readY(0)[40])

Output:

Length of X = 60, Length of Y = 60.
X[0]  = 26089826.0, Y[0]  = 42.88891
X[20] = 26091001.0, Y[20] = 22.42990
X[40] = 26092226.0, Y[40] = 39.05869

Example - export a float series to a EventWorkspace:

# Load data
import mantid.kernel as mk
dataws = LoadNexusProcessed(Filename="PG3_2538_2k.nxs")

# Create a new log
testprop = mk.FloatTimeSeriesProperty("Temp")

import random
random.seed(10)
for i in xrange(60):
    randsec = random.randint(0, 59)
    randval = random.random()*100.
    timetemp = mk.DateAndTime("2012-01-01T00:%d:%d"%(i, randsec))
    testprop.addValue(timetemp, randval)
dataws.run().addProperty("Temp", testprop, True)

# Run algorithm
propws = ExportTimeSeriesLog(InputWorkspace=dataws, LogName="Temp", NumberEntriesExport=40, IsEventWorkspace=True)

# Check
print "Length of X = %d, Length of Y = %d." % (len(propws.readX(0)), len(propws.readY(0)))
print "X[0]  = %.1f, Y[0]  = %.5f" % (propws.readX(0)[0], propws.readY(0)[0])
print "Number of events = %d" % (propws.getNumberEvents())

Output:

Length of X = 2, Length of Y = 1.
X[0]  = 26089826000000.0, Y[0]  = 1702.58055
Number of events = 40

Categories: Algorithms | Diffraction\DataHandling | Events\EventFiltering