Commit 3effecc4 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Fix doc tests

parent 3c5e540b
......@@ -10,9 +10,9 @@
Description
-----------
Creates/updates a time-series log entry on a chosen workspace. The given
Creates/updates a time-series log entry on a chosen workspace. The given
time stamp and value are appended to the named log entry. If the named
entry does no exist, then a new log is created. A time stamp must be
entry does no exist, then a new log is created. A time stamp must be
given in ISO8601 format, e.g. 2010-09-14T04:20:12.
Usage
......@@ -22,38 +22,38 @@ Usage
.. testcode:: AddNoteExample
import numpy as np
# Create a host workspace
ws = CreateSampleWorkspace()
AddNote(ws, Name="my_log", Time="2014-01-01T00:00:00", Value="Initial")
AddNote(ws, Name="my_log", Time="2014-01-01T00:30:30", Value="Second")
AddNote(ws, Name="my_log", Time="2014-01-01T00:50:00", Value="Final")
log = ws.getRun().getLogData("my_log")
print("my_log has {} entries".format(log.size()))
for i in range(log.size()):
print("\t{}\t{}".format(log.times[i], log.value[i]))
for time, value in zip(log.times, log.value):
print("\t{}\t{}".format(time.astype(np.dtype('M8[s]')), value))
AddNote(ws, Name="my_log", Time="2014-01-01T00:00:00", Value="New Initial", DeleteExisting=True)
AddNote(ws, Name="my_log", Time="2014-01-01T00:30:00", Value="New Final")
log = ws.getRun().getLogData("my_log")
print("my_log now has {} entries".format(log.size()))
for i in range(log.size()):
print("\t{}\t{}".format(log.times[i], log.value[i]))
for time, value in zip(log.times, log.value):
print("\t{}\t{}".format(time.astype(np.dtype('M8[s]')), value))
Output:
.. testoutput:: AddNoteExample
:options: +NORMALIZE_WHITESPACE
my_log has 3 entries
2014-01-01T00:00:00 Initial
2014-01-01T00:30:30 Second
2014-01-01T00:50:00 Final
my_log now has 2 entries
2014-01-01T00:00:00 New Initial
2014-01-01T00:30:00 New Final
2014-01-01T00:30:00 New Final
.. categories::
......@@ -26,24 +26,25 @@ Usage
.. testcode:: AddTimeSeriesLogEx
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: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 i in range(log.size()):
print("\t{}\t{:.6f}".format(log.times[i], log.value[i]))
for time, value in zip(log.times, log.value):
print("\t{}\t{:.6f}".format(time.astype(np.dtype('M8[s]')), 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 i in range(log.size()):
print("\t{}\t{}".format(log.times[i], log.value[i]))
for time, value in zip(log.times, log.value):
print("\t{}\t{}".format(time.astype(np.dtype('M8[s]')), value))
Output:
......@@ -61,6 +62,3 @@ Output:
.. categories::
.. sourcelink::
......@@ -43,8 +43,10 @@ Output:
.. testoutput:: ChangeLogTime
OriginalTimes: [2010-Mar-25 16:09:27.780000000,2010-Mar-25 16:10:01.560998229,2010-Mar-25 16:10:31.514001159,2010-Mar-25 16:11:25.498002319]
ModifiedTimes: [2010-Mar-25 16:09:37.780000000,2010-Mar-25 16:10:11.560998229,2010-Mar-25 16:10:41.514001159,2010-Mar-25 16:11:35.498002319]
OriginalTimes: ['2010-03-25T16:09:27.780000000' '2010-03-25T16:10:01.560998229'
'2010-03-25T16:10:31.514001159' '2010-03-25T16:11:25.498002319']
ModifiedTimes: ['2010-03-25T16:09:37.780000000' '2010-03-25T16:10:11.560998229'
'2010-03-25T16:10:41.514001159' '2010-03-25T16:11:35.498002319']
.. categories::
......
......@@ -42,9 +42,9 @@ Output:
.. testoutput:: CorrectLogTimes
Original start time for 'proton_charge': 2010-03-25T16:08:37
Original start time for 'proton_charge': 2010-03-25T16:08:37.000000000
Original start time for 'Speed5': 2010-03-25T16:09:27.780000000
Corrected start time for 'Speed5': 2010-03-25T16:08:37
Corrected start time for 'Speed5': 2010-03-25T16:08:37.000000000
.. categories::
......
......@@ -51,7 +51,7 @@ Unit of input splitters
How to generate input workspace containing splitters
++++++++++++++++++++++++++++++++++++++++++++++++++++
There are two ways to generate
There are two ways to generate
Algorithm :ref:`GenerateEventsFilter <algm-GenerateEventsFilter>`
creates both the :ref:`SplittersWorkspace <SplittersWorkspace>` and
......@@ -181,6 +181,7 @@ Output:
.. testcode:: FilterEventNoCorrection
import numpy as np
ws = Load(Filename='CNCS_7860_event.nxs')
# create TableWorkspace
......@@ -209,7 +210,7 @@ Output:
tmpws = mtd[name]
print("workspace %s has %d events" % (name, tmpws.getNumberEvents()))
split_log = tmpws.run().getProperty('splitter')
print('event splitter log: entry 0 and entry 1 are {0} and {1}.'.format(split_log.times[0], split_log.times[1]))
print('event splitter log: entry 0 and entry 1 are {0} and {1}.'.format(split_log.times[0].astype(np.dtype('M8[s]')), split_log.times[1].astype(np.dtype('M8[s]'))))
Output:
......@@ -217,13 +218,13 @@ Output:
.. testoutput:: FilterEventNoCorrection
workspace tempsplitws3_a has 77580 events
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:10:17 .
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:10:17.
workspace tempsplitws3_b has 0 events
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:11:57 .
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:11:57.
workspace tempsplitws3_c has 0 events
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:15:17 .
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:15:17.
workspace tempsplitws3_unfiltered has 34686 events
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:10:17 .
event splitter log: entry 0 and entry 1 are 2010-03-25T16:08:37 and 2010-03-25T16:10:17.
**Example - Filtering event by pulse time**
......
......@@ -42,9 +42,9 @@ Output:
.. testoutput:: ShiftLogTime
OriginalTimes: [2010-Mar-25 16:09:27.780000000,2010-Mar-25 16:10:01.560998229,2010-Mar-25 16:10:31.514001159,2010-Mar-25 16:11:25.498002319]
ModifiedTimes: [2010-Mar-25 16:10:31.514001159,2010-Mar-25 16:11:25.498002319]
OriginalTimes: ['2010-03-25T16:09:27.780000000' '2010-03-25T16:10:01.560998229'
'2010-03-25T16:10:31.514001159' '2010-03-25T16:11:25.498002319']
ModifiedTimes: ['2010-03-25T16:10:31.514001159' '2010-03-25T16:11:25.498002319']
.. categories::
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment