Ticket #8655: verify8655.py

File verify8655.py, 2.9 KB (added by Wenduo Zhou, 6 years ago)
Line 
1def runTest():
2    """ This is the script for verification
3    """
4    ######################################################################
5    # Approach 1: Use GenerateEventsFilter/FilterEvents
6    ######################################################################
7    LoadEventPreNexus(EventFilename=r'/SNS/VULCAN/IPTS-7727/0/20002/preNeXus/VULCAN_20002_neutron0_event.dat',
8        PulseidFilename=r'/SNS/VULCAN/IPTS-7727/0/20002/preNeXus/VULCAN_20002_pulseid0.dat',
9        OutputWorkspace=r'V20002_PP0_LEP')
10    MergeLogs(Workspace='V20002_PP0_LEP',LogName1='Pixel1342177282',LogName2='Pixel1342177283',MergedLogName='PulseElectric',ResetLogValue='1')
11    GenerateEventsFilter(InputWorkspace='V20002_PP0_LEP',
12        OutputWorkspace='V20002_PP0_LEP_Filter',
13        InformationWorkspace='V20002_PP0_LEP_Info',
14        FastLog='1',LogName='PulseElectric',MinimumLogValue='0',MaximumLogValue='1',LogValueInterval='1',
15        UseParallelProcessing="Parallel", NumberOfThreads=16)
16    FilterEvents(InputWorkspace='V20002_PP0_LEP',SplitterWorkspace='V20002_PP0_LEP_Filter',
17        OutputWorkspaceBaseName='V20002_PP0_Split',InformationWorkspace='V20002_PP0_LEP_Info',
18        GroupWorkspaces='1',SplitSampleLogs='0', GenerateTOFCorrection=True)
19
20    ######################################################################
21    # Approach 2: Use FilterEventsByLogValuePreNxus
22    ######################################################################
23    FilterEventsByLogValuePreNexus(EventFilename=r'/SNS/VULCAN/IPTS-7727/0/20002/preNeXus/VULCAN_20002_neutron0_event.dat',
24        PulseidFilename=r'/SNS/VULCAN/IPTS-7727/0/20002/preNeXus/VULCAN_20002_pulseid0.dat',UseParallelProcessing='Parallel',
25        OutputWorkspace='20002PP0_AB',EventLogTableWorkspace='20002SpecialPixelb',FunctionMode='Filter',PixelIDtoExamine='1342177282',
26        NumberOfEventsToExamine='1',
27        LogPixelIDs='1342177282,1342177283',LogPIxelTags='A,B', CorrectTOFtoSample=True)
28
29    ######################################################################
30    # Compare the result from these two different approach
31    ######################################################################
32    Rebin(InputWorkspace='20002PP0_AB', OutputWorkspace = '20002PP0_AB', Params = -0.001, PreserveEvents = True)
33    SumSpectra(InputWorkspace = '20002PP0_AB', OutputWorkspace = '20002PP0_AB')
34
35    Rebin(InputWorkspace = 'V20002_PP0_Split_0', OutputWorkspace = 'V20002_PP0_Split_0', Params = -0.001, PreserveEvents = True)
36    SumSpectra(InputWorkspace = 'V20002_PP0_Split_0', OutputWorkspace = 'V20002_PP0_Split_0')
37
38    diffws = Minus(LHSWorkspace = '20002PP0_AB', RHSWorkspace = 'V20002_PP0_Split_0', OutputWorkspace = 'Diff20002')
39
40    print "Diff WS name = ", diffws.name()
41    absum = 0.
42    vecy = diffws.readY(0)
43    for i in xrange(len(vecy)):
44        absum += abs(vecy[i])
45
46    print "Total differet counts = ", absum
47
48runTest()       
49
50