\(\renewcommand\AA{\unicode{x212B}}\)
AddLogDerivative v1¶
Summary¶
Add a sample log that is the first or second derivative of an existing sample log.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
InOut |
Mandatory |
An input/output workspace. The new log will be added to it. |
|
LogName |
Input |
string |
Mandatory |
The name that will identify the log entry to perform a derivative. This log must be a numerical series (double). |
Derivative |
Input |
number |
1 |
How many derivatives to perform. Default 1. |
NewLogName |
Input |
string |
Name of the newly created log. If not specified, the string ‘_derivativeN’ will be appended to the original name |
Description¶
This algorithm performs a simple numerical derivative of the values in a sample log.
The 1st order derivative is simply: dy = (y1-y0) / (t1-t0), which is placed in the log at t=(t0+t1)/2
Higher order derivatives are obtained by performing the equation above N times. Since this is a simple numerical derivative, you can expect the result to quickly get noisy at higher derivatives.
If any of the times in the logs are repeated, then those repeated time values will be skipped, and the output derivative log will have fewer points than the input.
Usage¶
Example: Taking the derivative of logs
ws = CreateSampleWorkspace()
AddTimeSeriesLog(ws,"MyLog","2010-01-01T00:00:00",1.0,DeleteExisting=False)
AddTimeSeriesLog(ws,"MyLog","2010-01-01T00:00:10",2.0,DeleteExisting=False)
AddTimeSeriesLog(ws,"MyLog","2010-01-01T00:00:20",0.0,DeleteExisting=False)
AddTimeSeriesLog(ws,"MyLog","2010-01-01T00:00:30",5.0,DeleteExisting=False)
AddLogDerivative(ws,"MyLog",derivative=1,NewLogName="Derivative1")
AddLogDerivative(ws,"MyLog",derivative=2,NewLogName="Derivative2")
AddLogDerivative(ws,"MyLog",derivative=3,NewLogName="Derivative3")
for logName in ["MyLog","Derivative1","Derivative2","Derivative3"]:
print("Log: {}".format(logName))
print(ws.getRun().getProperty(logName).valueAsString())
Output:
Log: MyLog
2010-Jan-01 00:00:00 1
2010-Jan-01 00:00:10 2
2010-Jan-01 00:00:20 0
2010-Jan-01 00:00:30 5
Log: Derivative1
2010-Jan-01 00:00:05 0.1
2010-Jan-01 00:00:15 -0.2
2010-Jan-01 00:00:25 0.5
Log: Derivative2
2010-Jan-01 00:00:10 -0.03
2010-Jan-01 00:00:20 0.07
Log: Derivative3
2010-Jan-01 00:00:15 0.01
Categories: AlgorithmIndex | DataHandling\Logs
Source¶
C++ header: AddLogDerivative.h
C++ source: AddLogDerivative.cpp