Changeset 978 for sans/Dev


Ignore:
Timestamp:
Feb 5, 2016 12:46:18 PM (7 years ago)
Author:
srkline
Message:

more additions to the raw data display panel

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf

    r970 r978  
    660660         
    661661// detector resolution (xy for each bank!) 
    662         Variable/G gFront_L_pixelX = 0.8                        // (cm)         these tubes are vertical 
     662        Variable/G gFront_L_pixelX = 0.84                       // (cm)         these tubes are vertical 8.4 mm spacing (JGB 2/2106) 
    663663        Variable/G gFront_L_pixelY = 0.8                        // (cm)         //!! now 8 mm, since nPix=128, rather than 256 
    664         Variable/G gFront_R_pixelX = 0.8                        // (cm) 
     664        Variable/G gFront_R_pixelX = 0.84                       // (cm) 
    665665        Variable/G gFront_R_pixelY = 0.8                        // (cm) 
    666666         
    667667        Variable/G gFront_T_pixelX = 0.4                        // (cm)         these tubes are horizontal 
    668         Variable/G gFront_T_pixelY = 0.8                        // (cm) 
     668        Variable/G gFront_T_pixelY = 0.84                       // (cm) 
    669669        Variable/G gFront_B_pixelX = 0.4                        // (cm) 
    670         Variable/G gFront_B_pixelY = 0.8                        // (cm) 
     670        Variable/G gFront_B_pixelY = 0.84                       // (cm) 
    671671         
    672672// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here) 
     
    692692         
    693693// detector resolution (xy for each bank!) 
    694         Variable/G gMiddle_L_pixelX = 0.8                       // (cm)         these tubes are vertical 
     694        Variable/G gMiddle_L_pixelX = 0.8       4               // (cm)         these tubes are vertical 
    695695        Variable/G gMiddle_L_pixelY = 0.8               // (cm) 
    696         Variable/G gMiddle_R_pixelX = 0.8                       // (cm) 
     696        Variable/G gMiddle_R_pixelX = 0.8       4               // (cm) 
    697697        Variable/G gMiddle_R_pixelY = 0.8               // (cm) 
    698698         
    699699        Variable/G gMiddle_T_pixelX = 0.4                       // (cm)         these tubes are horizontal 
    700         Variable/G gMiddle_T_pixelY = 0.8                       // (cm) 
     700        Variable/G gMiddle_T_pixelY = 0.84                      // (cm) 
    701701        Variable/G gMiddle_B_pixelX = 0.4                       // (cm) 
    702         Variable/G gMiddle_B_pixelY = 0.8                       // (cm) 
     702        Variable/G gMiddle_B_pixelY = 0.8       4               // (cm) 
    703703 
    704704// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here) 
     
    773773// to fill in: 
    774774// values for always-visible items 
    775         String/G gPresetPopStr = "Low Q;High Q;Converging Pinholes;Narrow Slit Aperture;Converging Slits;White Beam;Polarizer;" 
     775        String/G gPresetPopStr = "Low Q;High Q;Converging Pinholes;Narrow Slit Aperture;White Beam;Polarizer;" 
    776776        String/G gBinTypeStr = "One;Two;Four;Slit Mode;" 
    777777 
     
    782782// tab 0 - collimation 
    783783        String/G gMonochromatorType = "Velocity Selector;Graphite;White Beam;" 
    784         String/G gSourceShape = "circular;rectangular;converging pinholes;converging slits;" 
     784        String/G gSourceShape = "circular;rectangular;converging pinholes;" 
    785785        String/G gSourceDiam = "1.0 cm;2.0 cm;5.0 cm;" 
    786786        String/G gDeltaLambda = "0.10;0.20;0.30;" 
     
    788788// tab 1 - sample conditions 
    789789        String/G gTableLocation = "Changer;Stage;" 
    790         String/G gSampleApertureShape = "circular;rectangular;converging pinholes;converging slits;" 
     790        String/G gSampleApertureShape = "circular;rectangular;converging pinholes;" 
    791791        String/G gSampleApertureDiam = "0.5;1.0;1.5;2.0;" 
    792792         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf

    r977 r978  
    9393                SetScale/I y ctr,ctr+48,"",det_MT 
    9494//              det_mt[][20] = 50 
     95        det_MT *= 10 
    9596 
    9697                SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_MB 
     
    99100                SetScale/I x -npix/2,npix/2,"",det_MB 
    100101                SetScale/I y -ctr,-ctr-48,"",det_MB 
     102        det_MB *= 5 
    101103                 
    102104                ctr=30 
     
    106108                SetScale/I x -ctr-48,-ctr,"",det_ML 
    107109                SetScale/I y -npix/2,npix/2,"",det_ML 
     110        det_ML *= 2 
    108111                 
    109112                SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_MR 
     
    213216// -- if not, read the file in, then return the value 
    214217// 
     218// TODO: 
     219// currently, the work folders have the following path - so passing in "RAW" as fname 
     220// will take some re-configuring.  
     221//  root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_FL:distance 
     222// -- be sure this read from work folders is not broken in the future, and is passed to ALL of the 
     223//    top-level R/W routines. (Write is necessary ONLY for SIM data files. Patch is direct to disk.) 
    215224Function V_getRealValueFromHDF5(fname,path) 
    216225        String fname,path 
     
    220229         
    221230        folderStr = V_RemoveDotExtension(V_GetFileNameFromPathNoSemi(fname)) 
     231 
     232// check for a work folder first (note that "entry" is doubled) 
     233        if(Exists("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path)) 
     234                Wave/Z w = $("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path) 
     235                return(w[0]) 
     236        endif 
    222237         
    223238        if(Exists(ksBaseDFPath+folderStr+":"+path)) 
     
    257272         
    258273        folderStr = V_RemoveDotExtension(V_GetFileNameFromPathNoSemi(fname)) 
    259          
     274 
     275// check for a work folder first (note that "entry" is doubled) 
     276        if(Exists("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path)) 
     277                Wave wOut = $("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path) 
     278                return wOut 
     279        endif 
     280                 
    260281        if(Exists(ksBaseDFPath+folderStr+":"+path)) 
    261282                valExists=1 
     
    291312         
    292313        folderStr = V_RemoveDotExtension(V_GetFileNameFromPathNoSemi(fname)) 
     314 
     315// check for a work folder first (note that "entry" is doubled) 
     316        if(Exists("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path)) 
     317                Wave/T wOut = $("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path) 
     318                return wOut 
     319        endif 
    293320         
    294321        if(Exists(ksBaseDFPath+folderStr+":"+path)) 
     
    351378         
    352379        folderStr = V_RemoveDotExtension(V_GetFileNameFromPathNoSemi(fname)) 
     380 
     381// check for a work folder first (note that "entry" is doubled) 
     382        if(Exists("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path)) 
     383                Wave/Z/T tw = $("root:Packages:NIST:VSANS:"+folderStr+":entry:"+path) 
     384                return(tw[0]) 
     385        endif 
    353386         
    354387        if(Exists(ksBaseDFPath+folderStr+":"+path)) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf

    r977 r978  
    4747        // TODO: update the information here  - in either case 
    4848        // what isn't automatically picked up? What is "stale" on the display? 
    49          
     49        String/G root:Packages:NIST:VSANS:Globals:gCurDispType = type 
     50        DoWindow/T VSANS_Data,type + " VSANS_Data" 
    5051end 
    5152 
     
    6566        String/G gCurDispFile = "default string" 
    6667        String/G gCurTitle = "" 
     68        String/G gCurDispType = "" 
    6769         
    6870        SetDataFolder root: 
     
    7981        ShowTools/A 
    8082         
    81         DoWindow/T VSANS_Data,"VSANS_Data"//+cur_folder 
     83        String curFolder = root:Packages:NIST:VSANS:Globals:gCurDispType 
     84        DoWindow/T VSANS_Data,curFolder + " VSANS_Data" 
    8285        SetWindow VSANS_Data,hook(dataHook)=VSANSDataHook,hookevents=2 
    8386         
     
    113116 
    114117        TitleBox title_file,pos={606,178},size={76,20},variable= file_name 
    115         TitleBox title_status,pos={606,210},size={76,20},variable= file_name 
     118        TitleBox title_status,pos={606,210},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gCurDispFile 
    116119         
    117120        Button button_tagFile,pos={603,412},size={70,20},proc=TagFileButtonProc,title="Tag File" 
     
    121124        TitleBox title_xy,pos={24,71},size={76,20},variable= file_name 
    122125        Slider slider_hi,pos={558,224},size={16,80},proc=HiMapSliderProc 
    123         Slider slider_hi,limits={0,2,0},value= 2,ticks= 0 
     126        Slider slider_hi,limits={0,1,0},value= 1,ticks= 0 
    124127        Slider slider_lo,pos={558,315},size={16,80},proc=LowMapSliderProc 
    125         Slider slider_lo,limits={0,2,0},value= 0,ticks= 0 
     128        Slider slider_lo,limits={0,1,0},value= 0,ticks= 0 
    126129 
    127130        SetVariable xpos,pos={22,97},size={50,17},title="X " 
     
    182185// 
    183186// event code 4 = mouse moved 
     187//  
     188// mouse moved is the only event that I really care about for the data display. 
    184189// 
    185190// TODO 
     
    209214                        NVAR xloc = root:Packages:NIST:VSANS:Globals:gXPos 
    210215                        NVAR yloc = root:Packages:NIST:VSANS:Globals:gYPos 
    211                         Variable xaxval,yaxval 
     216                        NVAR gQX = root:Packages:NIST:VSANS:Globals:gQX 
     217                        NVAR gQY = root:Packages:NIST:VSANS:Globals:gQY 
     218                        NVAR gQQ = root:Packages:NIST:VSANS:Globals:gQQ 
     219                        NVAR gNCounts = root:Packages:NIST:VSANS:Globals:gNCounts 
     220                        SVAR gCurDispFile = root:Packages:NIST:VSANS:Globals:gCurDispFile 
     221                        SVAR gCurDispType = root:Packages:NIST:VSANS:Globals:gCurDispType               //the current folder 
     222                        Variable xaxval,yaxval,tab 
    212223                         
    213224                        // is the mouse location within the "main" display window? 
     
    215226                        // right now, the "main" display is at (50,185,545,620). its name depends on the active tab 
    216227                         
     228//                              xloc = s.mouseLoc.h 
     229//                              yloc = s.mouseLoc.v 
     230 
    217231//                      if out of bounds, exit now 
    218 //              TODO - currently the values are hard-wired. eliminate this 
     232//              TODO - currently the values are hard-wired. eliminate this later if the size of the graph changes 
    219233                        if(s.mouseLoc.h < 50 || s.mouseLoc.h > 545 || s.mouseLoc.v < 185 || s.mouseLoc.v > 620) 
    220234                                break 
     
    223237//                      if(in bounds) 
    224238//                              get the point location 
    225 //                              update the globals 
    226 //                              if detectors are drawn to scale on the graph, then qxqy can be calculated 
     239//                              update the globals -- 
    227240//                              but which data instance am I pointing to? 
     241//                              deduce the carriage and panel, and calculate Q 
    228242//                      endif 
    229243 
    230244                        GetWindow $s.winName activeSW 
    231                         String activeSubwindow = S_value 
    232                         if (CmpStr(activeSubwindow,"VSANS_Data#det_panelsF") == 0) 
    233                                 // front active, do something 
    234 //                              xloc = s.mouseLoc.h 
    235 //                              yloc = s.mouseLoc.v 
     245                        String activeSubwindow = S_value                // returns something like: "VSANS_Data#det_panelsF" 
    236246                                 
    237                                 xaxval= AxisValFromPixel("","bottom",s.mouseLoc.h) 
    238                                 yaxval= AxisValFromPixel("","left",s.mouseLoc.v) 
    239                                 xloc = round(xaxval) 
    240                                 yloc = round(yaxval) 
    241                         endif 
    242                          
    243                         break 
     247                        xaxval= AxisValFromPixel("","bottom",s.mouseLoc.h) 
     248                        yaxval= AxisValFromPixel("","left",s.mouseLoc.v) 
     249                        xloc = round(xaxval) 
     250                        yloc = round(yaxval) 
     251                         
     252                        // which tab is selected? -this is the main graph panel (subwindow may not be the active one!) 
     253                        ControlInfo/W=VSANS_Data tab0 
     254                        tab = V_Value 
     255                        if(tab == 0) 
     256                                activeSubwindow = "VSANS_Data#det_panelsF" 
     257                        elseif (tab == 1) 
     258                                activeSubwindow = "VSANS_Data#det_panelsM" 
     259                        else 
     260                                activeSubwindow = "VSANS_Data#det_panelsB" 
     261                        endif 
     262                         
     263                        // which images are here? 
     264                        String detStr="",imStr,carriageStr 
     265                        String currentImageRef 
     266                        String imageList = ImageNameList(activeSubwindow,";") 
     267                        Variable ii,nIm,testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY 
     268                        nIm = ItemsInList(imageList,";") 
     269                        gCurDispFile = imageList 
     270                        if(nIm==0) 
     271                                break           //problem, get out 
     272                        endif 
     273 
     274                        // images were added in the order TBLR, so look back through in the order RLBT, checking each to see if 
     275                        // the xy value is found on that (scaled) array 
     276                                                 
     277                        // loop backwards through the list of panels (may only be one if on the back) 
     278                        for(ii=nIm-1;ii>=0;ii-=1) 
     279                                Wave w = ImageNameToWaveRef(activeSubwindow,StringFromList(ii, imageList,";")) 
     280                                 
     281                                // which, if any image is the mouse xy location on? 
     282                                // use a multidemensional equivalent to x2pnt: (ScaledDimPos - DimOffset(waveName, dim))/DimDelta(waveName,dim) 
     283                                testX = trunc( (xloc - DimOffset(w,0))/DimDelta(w,0) ) 
     284                                testY = trunc( (yloc - DimOffset(w,1))/DimDelta(w,1) ) 
     285                                 
     286                                if( (testX > 0 && testX < DimSize(w,0)) && (testY > 0 && testY < DimSize(w,1)) ) 
     287                                        // we're in-bounds on this wave 
     288                                         
     289                                        // count value to the global 
     290                                        gNCounts = w[testX][testY] 
     291                                         
     292                                        // deduce the detector panel 
     293                                        currentImageRef = StringFromList(ii, imageList,";")     //the image instance ## 
     294                                        // string is "data", or "data#2" etc. - so this returns "", "1", "2", or "3" 
     295                                        imStr = StringFromList(1, currentImageRef,"#")           
     296                                        carriageStr = activeSubWindow[strlen(activeSubWindow)-1] 
     297                                         
     298                                        if(cmpstr(carriageStr,"B")==0) 
     299                                                detStr = carriageStr 
     300                                        else 
     301                                                if(strlen(imStr)==0) 
     302                                                        imStr = "9"                     // a dummy value so I can replace it later 
     303                                                endif 
     304                                                detStr = carriageStr+imStr              // "F2" or something similar 
     305                                                detStr = ReplaceString("9", detStr, "T")        // ASSUMPTION :::: instances 0123 correspond to TBLR 
     306                                                detStr = ReplaceString("1", detStr, "B")        // ASSUMPTION :::: this is the order that the panels 
     307                                                detStr = ReplaceString("2", detStr, "L")        // ASSUMPTION :::: are ALWAYS added to the graph 
     308                                                detStr = ReplaceString("3", detStr, "R")        // ASSUMPTION ::::  
     309                                        endif 
     310                                        gCurDispFile = detStr 
     311 
     312                                        // now figure out q 
     313                                        // calculate the q-values, will be different depending on which panel is up (pixel size, geometry, etc.) 
     314                                        // TODO: !!!! get rid of the hard-wired values 
     315                                        // TODO: be sure that the units from HDF are what I expect 
     316                                        // TODO: beam center XY are pixels in the file, expected in the function, but are better suited for mm or cm 
     317                                        // TODO: units of xy pixel size are likely wrong 
     318                                        xctr = V_getDet_beam_center_x(gCurDispType,detStr)              //written in pixels 
     319                                        yctr = V_getDet_beam_center_y(gCurDispType,detStr) 
     320                                        sdd = V_getDet_distance(gCurDispType,detStr)    / 100   //written in cm, pass in meters 
     321                                        lam = V_getVSWavelength(gCurDispType)           //A 
     322                                        pixSizeX = V_getDet_x_pixel_size(gCurDispType,detStr)/10                // written mm? need cm 
     323                                        pixSizeY = V_getDet_y_pixel_size(gCurDispType,detStr)/10                // written mm? need cm 
     324                                         
     325                                        gQQ = V_CalcQval(xaxval+1,yaxval+1,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     326                                        gQX = V_CalcQX(xaxval+1,yaxval+1,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     327                                        gQY = V_CalcQY(xaxval+1,yaxval+1,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     328 
     329                                        ii = -1         //look no further, set ii to bad value to exit the for loop 
     330                                endif   //end if(mouse is over a detector panel) 
     331                        endfor          // end loop over list of displayed images 
     332                 
     333                        break 
     334                         
    244335                // And so on . . . 
    245336        endswitch 
     
    341432                                CheckDisplayed /W=VSANS_Data#det_panelsF det_FL 
    342433                                if(V_flag == 0) 
     434                                        AppendImage/W=VSANS_Data#det_panelsF det_FT 
    343435                                        AppendImage/W=VSANS_Data#det_panelsF det_FB 
    344                                         AppendImage/W=VSANS_Data#det_panelsF det_FT 
    345436                                        AppendImage/W=VSANS_Data#det_panelsF det_FL 
    346437                                        AppendImage/W=VSANS_Data#det_panelsF det_FR 
     438//                                      ModifyImage/W=VSANS_Data#det_panelsF det_FT ctab= {*,*,ColdWarm,0} 
    347439//                                      ModifyImage/W=VSANS_Data#det_panelsF det_FB ctab= {*,*,ColdWarm,0} 
    348 //                                      ModifyImage/W=VSANS_Data#det_panelsF det_FT ctab= {*,*,ColdWarm,0} 
    349440//                                      ModifyImage/W=VSANS_Data#det_panelsF det_FL ctab= {*,*,ColdWarm,0} 
    350441//                                      ModifyImage/W=VSANS_Data#det_panelsF det_FR ctab= {*,*,ColdWarm,0} 
     
    605696// link this slider to the "high" end of the color mapping for whatever is currently displayed 
    606697// 
     698// -- see Buttons.ipf for the old SANS implementation 
     699// 
    607700Function HiMapSliderProc(sa) : SliderControl 
    608701        STRUCT WMSliderAction &sa 
     
    625718// link this slider to the "low" end of the color mapping for whatever is currently displayed 
    626719// 
     720// -- see Buttons.ipf for the old SANS implementation 
     721// 
    627722Function LowMapSliderProc(sa) : SliderControl 
    628723        STRUCT WMSliderAction &sa 
     
    642737 
    643738 
    644  
Note: See TracChangeset for help on using the changeset viewer.