\(\renewcommand\AA{\unicode{x212B}}\)
A Run holds data related to the properties of the experimental run, e.g. good proton charge, total frames etc. It also holds all of the sample log files as sets of time-series data. Currently used properties within Mantid includes run_start, which specified the date the data were collected. Where an instrument has been modified over time, and multiple instrument definition files have been defined for it, this property is used to loads the IDF valid when the data were collected.
You can look at the Run API reference for a full list of properties and operations, but here are some of the key ones.
run = ws.getRun()
from mantid.kernel import DateAndTime
run = ws.getRun()
# Set the start and end time of a run
run.setStartAndEndTime(DateAndTime("2015-01-27T11:00:00"),
DateAndTime("2015-01-27T11:57:51"))
# Get the start and end time of a run
print(run.startTime())
print(run.endTime())
# Get the total good proton charge
print(run.getProtonCharge())
ws = Load("MAR11060")
run = ws.getRun()
# Get a list of the property names
print(run.keys())
# Loop over all of the Properties
for prop in run.getProperties():
print("{0} {1}".format(prop.name, prop.value))
ws = CreateSampleWorkspace()
run = ws.getRun()
# Check if property exists
print("Is runstart present: {0}".format(("run_start" in run.keys())))
# or
print("Is runstart present: {0}".format(run.hasProperty("run_start")))
#get the Property
runStart = run.getProperty("run_start")
print("Property name: " + runStart.name)
print("Property value: " + runStart.value)
If the instrument contains a Goniometer it can be accessed from the run object.
wg=CreateSingleValuedWorkspace()
AddSampleLog(wg,"Motor1","45.","Number")
SetGoniometer(wg,Axis0="Motor1,0,1,0,1",Axis1="5,0,1,0,1")
print("Goniometer angles: {}".format(wg.getRun().getGoniometer().getEulerAngles('YZY')))
On loading experimental data there is a default set of properties that are populated within the run. These are as follows:
(+) or YYYY-MM-DDTHH:MM:SS (ISO 8601 format, see 1)
Category: Concepts