source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_EventMode_Utils.ipf @ 1074

Last change on this file since 1074 was 1060, checked in by srkline, 5 years ago

renaming of event mode utilities to appear in the list next to the main event mode file.

File size: 20.1 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5//
6// for the event mode data with the proposed 64 bit structure, I may be able to use Igor for everything.
7//
8// Skipping the appropriate bits of the header (after I read them in) may be possible with
9// either LoadWave (treating the entire wave as 64 bit, unsigned), loading chunks from clipboard?
10// -- see in LoadWave, the suggestions for "Loading Large Waves"
11//
12// or using FBinRead, again, filling a wave, or a chunk of the data, as needed
13//
14// Then - since the data has sequential timing, not dependent on rollovers, I can
15// chunk the data for parallel processing, and piece it back together
16// after all of the decoding is done.
17//
18//
19// I don't know if it's possible to use a STRUCT  definition for each 64 bit word so that I could address
20// the bytes directly - since that may not work properly in Igor, and I'm not sure how to address the 6 byte section
21// -possibly with a uchar(6) definition?
22//
23//
24//      (from WM help) You can define an array of structures as a field in a structure:
25//              Structure mystruct
26//                      STRUCT Point pt[100]                    // Allowed as a sub-structure
27//              EndStructure
28//
29// -- which may be of use to read "blocks" of datq from a file using FBinRead
30//
31// -- right now, I'm having issues with being able to "cast" or convert uint64 values to STRUCT
32// (I don't know how to read from the struct if I can't fill it??)
33//
34// TODO:
35//
36// (5/2017)
37// The basic bits of reading work, but will need to be customized to be able to accomodate file names in/out
38// and especially the number of disabled tubes (although as long as I have the offset, it shouldn't be that
39// big of an issue.
40//
41// -- don't see the struct idea working out. only in real c-code if needed
42//
43// -- need to add detector binning to the decoding, to place the counts within the correct panels
44// -- not sure how this will work with JointHistogram Operation
45// (split to separate "streams" of values for each detector panel?
46//
47//
48// -- can I efficiently use "sort" (on the tube index) to block the data into groups that can be split
49//  into 4 sets of waves
50//  that can then be binned per panel, using the usual Joint histogram procedures? Works only if the
51// tube indexing is orderly. if it's a mess, Ill need to try something else (indexed sort?) (replace?)
52// (manually? ugh.)
53//
54
55//
56////
57//Structure eventWord
58//      uchar eventTime[6]
59//      uchar location
60//      uchar tube
61//endStructure
62
63
64
65//
66//
67Function V_testBitShift()
68
69//      // /l=64 bit, /U=unsigned
70//      Make/L/U/N=100 eventWave
71//      eventWave = 0
72       
73        // for each 64-bit value:
74        // byte 1: tube index [0,191]
75        // byte 2: pixel value [0,127]
76        // bytes 3-8 (= 6 bytes): time stamp in resolution unit
77       
78        int64 i64_num,b1,b2,b3,b4,b5,b6,b7,b8
79        int64 i64_ticks,i64_start
80       
81        b1=255
82        b3=255
83        b5=255
84        b7=255
85        b2=0
86        b4=0
87        b6=0
88        b8=0
89       
90        b7 = b7 << 8
91        b6 = b6 << 16
92        b5 = b5 << 24
93        b4 = b4 << 32
94        b3 = b3 << 40
95        b2 = b2 << 48
96        b1 = b1 << 56
97       
98        i64_num = b1+b2+b3+b4+b5+b6+b7+b8
99        printf "%64b\r",i64_num
100       
101        return(0)
102End
103
104Function V_MakeFakeEvents()
105
106//      // /l=64 bit, /U=unsigned
107        Make/O/L/U/N=10 smallEventWave
108        smallEventWave = 0
109       
110        // for each 64-bit value:
111        // byte 1: tube index [0,191]
112        // byte 2: pixel value [0,127]
113        // bytes 3-8 (= 6 bytes): time stamp in resolution unit
114       
115        uint64 i64_num,b1,b2,b3,b4,b5,b6,b7,b8
116        uint64 i64_ticks,i64_start
117       
118//      b1 = 47
119//      b2 = 123
120//      i64_ticks = 123456789
121        b1 = 41
122        b2 = 66
123        i64_ticks = 15
124
125
126//      b2 = b2 << 48
127//      b1 = b1 << 56
128//     
129//      i64_num = b1+b2+i64_ticks
130
131        // don't shift b1
132        b2 = b2 << 8
133        i64_ticks = i64_ticks << 16
134
135        i64_num = b1+b2+i64_ticks
136
137        printf "%64b\r",i64_num
138        print i64_num
139       
140        smallEventWave[0] = i64_num
141       
142        return(0)
143End
144
145Function V_decodeFakeEvent()
146
147        WAVE w = smallEventWave
148        uint64 val,b1,b2,btime
149        val = w[0]
150       
151//      printf "%64b\r",w[0]            //wrong (drops the last Å 9 bits)
152        printf "%64b\r",val                     //correct, assign value to 64bit variable
153//      print w[0]                              //wrong
154        print val                               // correct
155       
156//      b1 = (val >> 56 ) & 0xFF                        // = 255, last byte, after shifting
157//      b2 = (val >> 48 ) & 0xFF       
158//      btime = val & 0xFFFFFFFFFFFF    // = really big number, last 6 bytes
159
160
161        b1 = val & 0xFF
162        b2 = (val >> 8) & 0xFF
163        btime = (val >> 16)
164
165       
166        print b1
167        print b2
168        print btime
169
170
171//      //test as struct
172//      Print "as STRUCT"
173//     
174//      STRUCT eventWord s
175//     
176//      s = w[0]
177//     
178//      print s.tube
179//      print s.location
180//      print s.eventTime
181       
182
183               
184        return(0)
185End
186
187//
188// tested up to num=1e8 successfully
189//
190Function V_MakeFakeEventWave(num)
191        Variable num
192       
193        Variable ii
194
195
196//      num = 1e3
197       
198//      // /l=64 bit, /U=unsigned
199        Make/O/L/U/N=(num) eventWave
200        eventWave = 0
201       
202        // for each 64-bit value:
203        // byte 1: tube index [0,191]
204        // byte 2: pixel value [0,127]
205        // bytes 3-8 (= 6 bytes): time stamp in resolution unit
206       
207        uint64 i64_num,b1,b2
208        uint64 i64_ticks,i64_start
209       
210        i64_start = ticks
211        for(ii=0;ii<num;ii+=1)
212//              sleep/T/C=-1 1                  // 6 ticks, approx 0.1 s (without the delay, the loop is too fast)
213                b1 = trunc(abs(enoise(192)))            //since truncated, need 192 as highest random to give 191 after trunc
214                b2 = trunc(abs(enoise(128)))            // same here, to get results [0,127]
215               
216//              i64_ticks = ticks-i64_start
217                i64_ticks = ii+1
218               
219//              b2 = b2 << 48
220//              b1 = b1 << 56
221
222                // don't shift b1
223                b2 = b2 << 8
224                i64_ticks = i64_ticks << 16
225       
226                i64_num = b1+b2+i64_ticks
227       
228                eventWave[ii] = i64_num
229        endfor
230
231
232        return(0)
233End
234
235
236//
237// TODO:
238// -- can this be multithreaded (eliminating the loop)?
239//
240// MultiThread tube = (w[p]) & 0xFF     
241// MultiThread location = (w[p] >> 8 ) & 0xFF   
242// MultiThread eventTime = (w[p] >> 16)
243//
244// !!!!- yes - for a 35 MB file:
245// for loop = 4.3 s
246// MultiThread = 0.35 s
247//
248// !!! can I use the bit operations in MatrixOp? 1D waves are valid
249//  to use with MatrixOp. Would it be better than multiThread?
250//
251//
252Function V_decodeFakeEventWave(w)
253        Wave w
254
255v_tic()
256//      WAVE w = eventWave
257        uint64 val,b1,b2,btime
258        val = w[0]
259       
260//      printf "%64b\r",w[0]            //wrong (drops the last Å 9 bits)
261//      printf "%64b\r",val                     //correct, assign value to 64bit variable
262//      print w[0]                              //wrong
263//      print val                               // correct
264       
265        Variable num,ii
266        num=numpnts(w)
267       
268        Make/O/L/U/N=(num) eventTime
269        Make/O/U/B/N=(num) tube,location                //8 bit unsigned
270
271 MultiThread tube = (w[p]) & 0xFF       
272 MultiThread location = (w[p] >> 8 ) & 0xFF     
273 MultiThread eventTime = (w[p] >> 16)
274       
275//      for(ii=0;ii<num;ii+=1)
276//              val = w[ii]
277//             
278////            b1 = (val >> 56 ) & 0xFF                        // = 255, last two bytes, after shifting
279////            b2 = (val >> 48 ) & 0xFF       
280////            btime = val & 0xFFFFFFFFFFFF    // = really big number, last 6 bytes
281//
282//              b1 = val & 0xFF
283//              b2 = (val >> 8) & 0xFF
284//              btime = (val >> 16)
285//
286//              tube[ii] = b1
287//              location[ii] = b2
288//              eventTime[ii] = btime
289//             
290//      endfor
291
292v_toc()
293               
294        return(0)
295End
296
297
298Function V_writeFakeEventFile(fname)
299        String fname
300
301        WAVE w = eventWave
302        Variable refnum
303       
304        String vsansStr="VSANS"
305        Variable revision = 11
306        Variable offset = 26            // no disabled tubes
307        Variable time1 = 2017
308        Variable time2 = 0525
309        Variable time3 = 1122
310        Variable time4 = 3344           // these 4 time pieces are supposed to be 8 bytes total
311        Variable time5 = 3344           // these 5 time pieces are supposed to be 10 bytes total
312        String detStr = "M"
313        Variable volt = 1500
314        Variable resol = 1e7
315       
316       
317        Open refnum as fname
318
319        FBinWrite refnum, vsansStr
320        FBinWrite/F=2/U refnum, revision
321        FBinWrite/F=2/U refnum, offset
322        FBinWrite/F=2/U refnum, time1
323        FBinWrite/F=2/U refnum, time2
324        FBinWrite/F=2/U refnum, time3
325        FBinWrite/F=2/U refnum, time4
326        FBinWrite/F=2/U refnum, time5
327        FBinWrite refnum, detStr
328        FBinWrite/F=2/U refnum, volt
329        FBinWrite/F=3/U refnum, resol
330
331        FGetPos refnum
332        Print "End of header = ",V_filePos
333        offset = V_filePos
334       
335        FSetPos refnum,7
336        FBinWrite/F=2/U refnum, offset                  //write the correct offset
337
338       
339        FSetPos refNum, offset
340       
341        FBinWrite refnum, w
342       
343        close refnum
344       
345        return(0)
346End
347
348//
349// use GBLoadWave to do the reading, then I can do the decoding
350//
351Function V_readFakeEventFile(fileName)
352        String filename
353       
354// this reads in uint64 data, to a unit64 wave, skipping 22 bytes       
355//      GBLoadWave/B/T={192,192}/W=1/S=22
356        Variable num,refnum
357       
358
359//  to read a VSANS event file:
360//
361// - get the file name
362//      - read the header (all of it, since I need parts of it) (maybe read as a struct? but I don't know the size!)
363// - move to EOF and close
364//
365// - Use GBLoadWave to read the 64-bit events in
366
367        String vsansStr=""
368        Variable revision
369        Variable offset         // no disabled tubes
370        Variable time1
371        Variable time2
372        Variable time3
373        Variable time4          // these 4 time pieces are supposed to be 8 bytes total
374        Variable time5          // these 5 time pieces are supposed to be 10 bytes total
375        String detStr=""
376        Variable volt
377        Variable resol
378
379        vsansStr = PadString(vsansStr,5,0x20)           //pad to 5 bytes
380        detStr = PadString(detStr,1,0x20)                               //pad to 1 byte
381
382        Open/R refnum as filename
383        filename = S_fileName
384
385v_tic()
386
387        FBinRead refnum, vsansStr
388        FBinRead/F=2/U refnum, revision
389        FBinRead/F=2/U refnum, offset
390        FBinRead/F=2/U refnum, time1
391        FBinRead/F=2/U refnum, time2
392        FBinRead/F=2/U refnum, time3
393        FBinRead/F=2/U refnum, time4
394        FBinRead/F=2/U refnum, time5
395        FBinRead refnum, detStr                 //NOTE - the example data file Phil sent skipped the detStr (no placeholder!)
396        FBinRead/F=2/U refnum, volt
397        FBinRead/F=3/U refnum, resol
398
399        FStatus refnum
400        FSetPos refnum, V_logEOF
401       
402        Close refnum
403       
404// number of data bytes
405        num = V_logEOF-offset
406        Print "Number of data values = ",num/8
407       
408        GBLoadWave/B/T={192,192}/W=1/S=(offset) filename                // intel, little-endian
409//      GBLoadWave/T={192,192}/W=1/S=(offset) filename                  // motorola, big-endian
410       
411        Duplicate/O $(StringFromList(0,S_waveNames)) V_Events
412        KillWaves/Z $(StringFromList(0,S_waveNames))
413v_toc()
414       
415        Print vsansStr
416        Print revision
417        Print offset
418        Print time1
419        Print time2
420        Print time3
421        Print time4
422        Print time5
423        Print detStr
424        print volt
425        print resol
426       
427        return(0)
428End
429
430//
431//
432//
433Function V_MakeFakeEventWave_TOF(delayTime,std)
434        Variable delayTime,std
435
436        Variable num,ii,jj,numRepeat
437
438
439        num = 1000
440        numRepeat = 1000
441       
442//      delayTime = 50          //microseconds
443//      std = 4                                 //std deviation, microseconds
444       
445//      // /l=64 bit, /U=unsigned
446        Make/O/L/U/N=(num*numRepeat) eventWave
447        eventWave = 0
448       
449        Make/O/D/N=(num) arrival
450       
451        // for each 64-bit value:
452        // byte 1: tube index [0,191]
453        // byte 2: pixel value [0,127]
454        // bytes 3-8 (= 6 bytes): time stamp in resolution unit
455       
456        uint64 i64_num,b1,b2,b3,b4,b5,b6,b7,b8
457        uint64 i64_ticks,i64_start
458       
459//      i64_start = ticks
460        i64_ticks = 0
461        for(jj=0;jj<numRepeat;jj+=1)
462                arrival = delayTime + gnoise(std)
463                sort arrival,arrival
464                arrival *= 1000         //milliseconds now
465       
466                for(ii=0;ii<num;ii+=1)
467        //              sleep/T/C=-1 1                  // 6 ticks, approx 0.1 s (without the delay, the loop is too fast)
468                        b1 = trunc(abs(enoise(192)))            //since truncated, need 192 as highest random to give 191 after trunc
469                        b2 = trunc(abs(enoise(128)))            // same here, to get results [0,127]
470                       
471                        i64_ticks = trunc(arrival[ii])
472                       
473//                      b2 = b2 << 48
474//                      b1 = b1 << 56
475
476                        // don't shift b1
477                        b2 = b2 << 8
478                        i64_ticks = i64_ticks << 16
479               
480                        i64_num = b1+b2+i64_ticks
481                        eventWave[jj*num+ii] = i64_num
482                endfor
483               
484        endfor
485
486        return(0)
487End
488
489
490// TODO:
491//
492// There may be memory issues with this
493//
494// -- do I want to do the time binning first?
495// -- does it really matter?
496//
497Function V_SortAndSplitFakeEvents()
498
499        Wave eventTime = root:EventTime
500        Wave location = root:location
501        Wave tube = root:tube
502       
503        Sort tube,tube,eventTime,location
504
505        Variable b1,e1,b2,e2,b3,e3,b4,e4       
506        FindValue/S=0/I=48 tube
507        b1 = 0
508        e1 = V_Value - 1
509        b2 = V_Value
510        FindValue/S=(b2)/I=96 tube
511        e2 = V_Value - 1
512        b3 = V_Value
513        FindValue/S=(b3)/I=144 tube
514        e3 = V_Value - 1
515        b4 = V_Value
516        e4 = numpnts(tube)-1
517       
518        Print b1,e1
519        Print b2,e2
520        Print b3,e3
521        Print b4,e4
522       
523//      tube and location become x and y, and can be byte data
524// eventTime still needs to be 64 bit - when do I convert it to FP?
525        Make/O/B/U/N=(e1-b1+1) tube1,location1
526        Make/O/L/U/N=(e1-b1+1) eventTime1
527
528        Make/O/B/U/N=(e2-b2+1) tube2,location2
529        Make/O/L/U/N=(e2-b2+1) eventTime2
530       
531        Make/O/B/U/N=(e3-b3+1) tube3,location3
532        Make/O/L/U/N=(e3-b3+1) eventTime3
533       
534        Make/O/B/U/N=(e4-b4+1) tube4,location4
535        Make/O/L/U/N=(e4-b4+1) eventTime4
536       
537       
538        tube1 = tube[p+b1]
539        tube2 = tube[p+b2]
540        tube3 = tube[p+b3]
541        tube4 = tube[p+b4]
542       
543        location1 = location[p+b1]
544        location2 = location[p+b2]
545        location3 = location[p+b3]
546        location4 = location[p+b4]
547       
548        eventTime1 = eventTime[p+b1]
549        eventTime2 = eventTime[p+b2]
550        eventTime3 = eventTime[p+b3]
551        eventTime4 = eventTime[p+b4]
552       
553       
554        KillWaves/Z eventTime,location,tube
555       
556        return(0)
557End
558
559
560
561
562
563
564
565
566
567// TODO:
568//
569// There may be memory issues with this
570//
571// -- do I want to do the time binning first?
572// -- does it really matter?
573//
574Function V_SortAndSplitEvents()
575
576
577        SetDataFolder root:Packages:NIST:VSANS:Event:
578       
579        Wave eventTime = EventTime
580        Wave location = location
581        Wave tube = tube
582
583        Variable t1=ticks
584 Print "sort started"   
585        Sort tube,tube,eventTime,location
586print "sort done ",(ticks-t1)/60
587
588        Variable b1,e1,b2,e2,b3,e3,b4,e4       
589        FindValue/S=0/I=48 tube
590        b1 = 0
591        e1 = V_Value - 1
592        b2 = V_Value
593        FindValue/S=(b2)/I=96 tube
594        e2 = V_Value - 1
595        b3 = V_Value
596        FindValue/S=(b3)/I=144 tube
597        e3 = V_Value - 1
598        b4 = V_Value
599        e4 = numpnts(tube)-1
600       
601        Print b1,e1
602        Print b2,e2
603        Print b3,e3
604        Print b4,e4
605       
606//      tube and location become x and y, and can be byte data
607// eventTime still needs to be 64 bit - when do I convert it to FP?
608        Make/O/B/U/N=(e1-b1+1) tube1,location1
609        Make/O/L/U/N=(e1-b1+1) eventTime1
610
611        Make/O/B/U/N=(e2-b2+1) tube2,location2
612        Make/O/L/U/N=(e2-b2+1) eventTime2
613       
614        Make/O/B/U/N=(e3-b3+1) tube3,location3
615        Make/O/L/U/N=(e3-b3+1) eventTime3
616       
617        Make/O/B/U/N=(e4-b4+1) tube4,location4
618        Make/O/L/U/N=(e4-b4+1) eventTime4
619       
620       
621        tube1 = tube[p+b1]
622        tube2 = tube[p+b2]
623        tube3 = tube[p+b3]
624        tube4 = tube[p+b4]
625       
626        location1 = location[p+b1]
627        location2 = location[p+b2]
628        location3 = location[p+b3]
629        location4 = location[p+b4]
630       
631        eventTime1 = eventTime[p+b1]
632        eventTime2 = eventTime[p+b2]
633        eventTime3 = eventTime[p+b3]
634        eventTime4 = eventTime[p+b4]
635       
636       
637        KillWaves/Z eventTime,location,tube
638       
639        return(0)
640End
641
642
643//
644// switch the "active" panel to the selected group (1-4) (5 concatenates them all together)
645//
646
647//
648// copy the set of tubes over to the "active" set that is to be histogrammed
649// and redimension them to be sure that they are double precision
650//
651Function V_SwitchTubeGroup(tubeGroup)
652        Variable tubeGroup
653       
654        SetDataFolder root:Packages:NIST:VSANS:Event:
655       
656        if(tubeGroup <= 4)
657                Wave tube = $("tube"+num2Str(tubeGroup))
658                Wave location = $("location"+num2Str(tubeGroup))
659                Wave eventTime = $("eventTime"+num2Str(tubeGroup))
660               
661                Wave/Z xloc,yLoc,timePt
662               
663                KillWaves/Z timePt,xLoc,yLoc
664                Duplicate/O eventTime timePt
665
666// TODO:
667// -- for processing, initially treat all of the tubes along x, and 128 pixels along y
668//   panels can be transposed later as needed to get the orientation correct
669
670
671//              if(tubeGroup == 1 || tubeGroup == 4)   
672                // L/R panels, they have tubes along x 
673                        Duplicate/O tube xLoc
674                        Duplicate/O location yLoc
675//              else
676//              // T/B panels, tubes are along y
677//                      Duplicate/O tube yLoc
678//                      Duplicate/O location xLoc               
679//              endif
680               
681                Redimension/D xLoc,yLoc,timePt 
682               
683        endif
684       
685        if(tubeGroup == 5)
686                Wave xloc,yLoc,timePt
687               
688                KillWaves/Z timePt,xLoc,yLoc
689               
690                String str = ""
691                str = "tube1;tube2;tube3;tube4;"
692                Concatenate/O/NP str,xloc
693                str = "location1;location2;location3;location4;"
694                Concatenate/O/NP str,yloc
695                str = "eventTime1;eventTime2;eventTime3;eventTime4;"
696                Concatenate/O/NP str,timePt
697               
698                Redimension/D xLoc,yLoc,timePt 
699        endif
700       
701       
702        return(0)
703End
704
705Proc V_SwitchGroupAndCleanup(num)
706        Variable num
707       
708        V_SwitchTubeGroup(num)
709        SetDataFolder root:Packages:NIST:VSANS:Event:
710        Duplicate/O timePt rescaledTime
711        KillWaves/Z OscSortIndex
712        print WaveMax(rescaledTime)
713        root:Packages:NIST:VSANS:Event:gEvent_t_longest = waveMax(rescaledTime)
714       
715        SetDataFolder root:
716
717end
718
719Function V_count(num)
720        Variable num
721       
722        SetDataFolder root:Packages:NIST:VSANS:Event:
723
724        Wave xloc = xloc
725        wave yloc = yloc
726        Variable ii,npt,total=0
727        npt = numpnts(xloc)
728        for(ii=0;ii<npt;ii+=1)
729                if(xloc[ii] == num)
730                        total += 1
731                endif
732                if(yloc[ii] == num)
733                        total += 1
734                endif
735        endfor
736       
737        Print total
738       
739        SetDataFolder root:
740        return(0)
741end
742
743
744
745// Based on the numbering 0-191:
746// group 1 = R (0,47)                   MatrixOp out = ReverseRows(in)
747// group 2 = T (48,95)          output = slices_T[q][p][r]
748// group 3 = B (96,143)                 output = slices_B[XBINS-q-1][YBINS-p-1][r]              (reverses rows and columns)
749// group 4 = L (144,191)        MatrixOp out = ReverseCols(in)
750//
751// the transformation flips the panel to the view as if the detector was viewed from the sample position
752// (this is the standard view for SANS and VSANS)
753//
754// Takes the data that was binned, and separates it into the 4 detector panels
755// Waves are 3D waves x-y-time
756//
757// MatrixOp may not be necessary for the R/L transformations, but indexing or MatrixOp are both really fast.
758//
759//
760Function V_SplitBinnedToPanels()
761
762        SetDataFolder root:Packages:NIST:VSANS:Event:   
763        Wave slicedData = slicedData            //this is 3D
764       
765        Variable nSlices = DimSize(slicedData,2)
766       
767        Make/O/D/N=(XBINS,YBINS,nSlices) slices_R, slices_L, slices_T, slices_B, output
768       
769        slices_R = slicedData[p][q][r]
770        slices_T = slicedData[p+48][q][r]
771        slices_B = slicedData[p+96][q][r]
772        slices_L = slicedData[p+144][q][r]
773       
774        MatrixOp/O output = ReverseRows(slices_R)
775        slices_R = output
776       
777        MatrixOp/O output = ReverseCols(slices_L)
778        slices_L = output
779
780               
781        Redimension/N=(YBINS,XBINS,nSlices) output
782        output = slices_T[q][p][r]
783        KillWaves/Z slices_T
784        Duplicate/O output slices_T
785       
786        output = slices_B[XBINS-q-1][YBINS-p-1][r]
787        KillWaves/Z slices_B
788        Duplicate/O output slices_B
789       
790        KillWaves/Z output
791        SetDataFolder root:
792
793        return(0)
794End
795
796
797// simple panel to display the 4 detector panels after the data has been binned and sliced
798//
799// TODO:
800// -- label panels, axes
801// -- add a way to display different slices (this can still be done on the main panel, all at once)
802// -- any other manipulations?
803//
804
805Proc VSANS_EventPanels()
806        PauseUpdate; Silent 1           // building window...
807        NewPanel /W=(720,45,1530,570)/N=VSANS_EventPanels/K=1
808        DoWindow/C VSANS_EventPanels
809        ModifyPanel fixedSize=1,noEdit =1
810
811//      Display/W=(745,45,945,425)/HOST=#
812        Display/W=(10,45,210,425)/HOST=#
813        AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_L           //  /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly
814        ModifyImage slices_L ctab= {*,*,ColdWarm,0}
815        ModifyImage slices_L ctabAutoscale=3
816        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
817        ModifyGraph mirror=2
818        ModifyGraph nticks=4
819        ModifyGraph minor=1
820        ModifyGraph fSize=9
821        ModifyGraph standoff=0
822        ModifyGraph tkLblRot(left)=90
823        ModifyGraph btLen=3
824        ModifyGraph tlOffset=-2
825        RenameWindow #,Event_slice_L
826        SetActiveSubwindow ##
827
828//      Display/W=(1300,45,1500,425)/HOST=#
829        Display/W=(565,45,765,425)/HOST=#
830        AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_R           //  /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly
831        ModifyImage slices_R ctab= {*,*,ColdWarm,0}
832        ModifyImage slices_R ctabAutoscale=3
833        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
834        ModifyGraph mirror=2
835        ModifyGraph nticks=4
836        ModifyGraph minor=1
837        ModifyGraph fSize=9
838        ModifyGraph standoff=0
839        ModifyGraph tkLblRot(left)=90
840        ModifyGraph btLen=3
841        ModifyGraph tlOffset=-2
842        RenameWindow #,Event_slice_R
843        SetActiveSubwindow ##
844
845//      Display/W=(945,45,1300,235)/HOST=#
846        Display/W=(210,45,565,235)/HOST=#
847        AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_T           //  /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly
848        ModifyImage slices_T ctab= {*,*,ColdWarm,0}
849        ModifyImage slices_T ctabAutoscale=3
850        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
851        ModifyGraph mirror=2
852        ModifyGraph nticks=4
853        ModifyGraph minor=1
854        ModifyGraph fSize=9
855        ModifyGraph standoff=0
856        ModifyGraph tkLblRot(left)=90
857        ModifyGraph btLen=3
858        ModifyGraph tlOffset=-2
859        RenameWindow #,Event_slice_T
860        SetActiveSubwindow ##
861
862//      Display/W=(945,235,1300,425)/HOST=#
863        Display/W=(210,235,565,425)/HOST=#
864        AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_B           //  /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly
865        ModifyImage slices_B ctab= {*,*,ColdWarm,0}
866        ModifyImage slices_B ctabAutoscale=3
867        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
868        ModifyGraph mirror=2
869        ModifyGraph nticks=4
870        ModifyGraph minor=1
871        ModifyGraph fSize=9
872        ModifyGraph standoff=0
873        ModifyGraph tkLblRot(left)=90
874        ModifyGraph btLen=3
875        ModifyGraph tlOffset=-2
876        RenameWindow #,Event_slice_B
877        SetActiveSubwindow ##
878//
879
880
881End
882
883
Note: See TracBrowser for help on using the repository browser.