Ticket #10022 (closed: duplicate)
FilterByLogValue drops events if the log entries end
| Reported by: | Nick Draper | Owned by: | Wenduo Zhou |
|---|---|---|---|
| Priority: | major | Milestone: | Release 3.3 |
| Component: | Framework | Keywords: | |
| Cc: | Blocked By: | #10069 | |
| Blocking: | Tester: | Federico M Pouzols |
Description
If the log entries end before the events end then the events are discarded. This makes no sense with right handed value logs. This script illustrates this
import datetime
from dateutil import parser
#This is just creating a sample workspace, you can replace that by loading, or using one you alreasy have loaded
ws=CreateSampleWorkspace("Event")
#extracting the start and end run times from the workspace
start_time=ws.getRun().startTime()
end_time=ws.getRun().endTime()
#specifying the times to filter
filterDuration = 5 #seconds
timesToFilter = []
timesToFilter.append(start_time + int(300 * 1e9)) #300 is the number of seconds from the start of the run
timesToFilter.append(start_time + int(600 * 1e9))
timesToFilter.append(start_time + int(900 * 1e9))
#generate the log to filter by
AddTimeSeriesLog(ws,"SpurionFiltering", Time=str(start_time).rstrip(), Value=0)
for filterTime in timesToFilter:
AddTimeSeriesLog(ws,"SpurionFiltering", Time=str(filterTime).rstrip(), Value=1)
AddTimeSeriesLog(ws,"SpurionFiltering", Time=str(filterTime + int(filterDuration * 1e9)).rstrip() , Value=0)
#filtering out the unwanted times
wsFiltered = FilterByLogValue(ws, LogName='SpurionFiltering', MinimumValue=0, MaximumValue=0.9, LogBoundary='Left')
#add a final log entry
AddTimeSeriesLog(ws,"SpurionFiltering", Time=str(end_time).rstrip(), Value=0)
wsFilteredCorrect = FilterByLogValue(ws, LogName='SpurionFiltering', MinimumValue=0, MaximumValue=0.9, LogBoundary='Left')
print "number of events"
print "unfiltered\tfiltered\tfilteredCorrect"
print "%i\t%i\t%i" % (ws.getNumberEvents(),wsFiltered.getNumberEvents(),wsFilteredCorrect.getNumberEvents())
The results are
number of events unfiltered filtered filteredCorrect 800000 197625 796634
Change History
comment:2 Changed 6 years ago by Wenduo Zhou
- Status changed from assigned to inprogress
- Blocked By 10069 added
comment:3 Changed 6 years ago by Wenduo Zhou
- Status changed from inprogress to verify
- Resolution set to duplicate
This issue has been resolved by ticket #10069, which has been closed.
comment:4 Changed 6 years ago by Federico M Pouzols
- Status changed from verify to verifying
- Tester set to Federico M Pouzols
Note: See
TracTickets for help on using
tickets.

This will break a few doc tests, but in a good way, the expected output will just need correcting.