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

CorrectLogTimes v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

This algorithm attempts to make the time series property logs start at the same time as the first time in the proton charge log.

See Also

ChangeLogTime, CreateLogTimeCorrection, ChangePulsetime, ShiftLogTime

Properties

Name

Direction

Type

Default

Description

Workspace

InOut

Workspace

Mandatory

Input workspace

LogNames

Input

string

Experimental log values to be shifted. If empty, will attempt to shift all logs

Description

Sometimes the clocks controlling different sample environments or other experimental log values are not synchronized. This algorithm attempts to make all (some) time series property logs start at the same time as the first time in the proton charge log. It uses ChangeLogTime.

See also

ShiftLogTime and ChangeLogTime.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.

w=Load('CNCS_7860')
run=w.getRun()
ts = np.datetime_as_string(run['proton_charge'].times[0].astype(np.dtype('M8[s]')), timezone='UTC')
print("Original start time for 'proton_charge': {}".format(ts).strip())
ts = np.datetime_as_string(run['Speed5'].times[0].astype(np.dtype('M8[s]')), timezone='UTC')
print("Original start time for 'Speed5': {}".format(ts).strip())
#Change the log times
CorrectLogTimes(w)
#there should be almost 10 seconds different than before
ts = np.datetime_as_string(run['Speed5'].times[0].astype(np.dtype('M8[s]')), timezone='UTC')
print("Corrected start time for 'Speed5': {}".format(ts).strip())

Output:

Original start time for 'proton_charge': 2010-03-25T16:08:37Z
Original start time for 'Speed5': 2010-03-25T16:09:27Z
Corrected start time for 'Speed5': 2010-03-25T16:08:37Z

Categories: AlgorithmIndex | DataHandling\Logs

Source

Python: CorrectLogTimes.py