1 | from mantid.kernel import DateAndTime |
---|
2 | mtd.importAll() |
---|
3 | ws = WISH00026110 |
---|
4 | |
---|
5 | def meanWithinRange(filterstart, filterend, logname): |
---|
6 | run = ws.getRun() |
---|
7 | temperature = run.getLogData(logname) |
---|
8 | times = numpy.array(temperature.times) |
---|
9 | values = numpy.array(temperature.value) |
---|
10 | mask = (filterstart < times) & (times < filterend) # Get times between filter start and end. |
---|
11 | return values[mask].mean() # Use mask to get the mean value in this time interval. |
---|
12 | |
---|
13 | filterstart = DateAndTime("2013-10-30T10:03+00:00") # Example filter start |
---|
14 | filterend = DateAndTime("2013-10-30T11:14+00:00") # Example filter end |
---|
15 | logname = 'Sample_Temp' |
---|
16 | print meanWithinRange(filterstart, filterend, logname) |
---|
17 | |
---|
18 | |
---|