Ignore:
Timestamp:
Sep 16, 2016 2:37:34 PM (6 years ago)
Author:
srkline
Message:

Updating the patch panel for the VSANS variables, a first pass at including the essential values, and a section that has per-detector values.

Still needs to be fully stress tested to be sure that it does all of read/write operations correctly.

adjusted the "last file loaded" global variable that is displayed on the data display to only update when a file is loaded for display, not when any file is loaded for the catalog, or for the patch panel.

File:
1 edited

Legend:

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

    r1005 r1012  
    9191        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS2 = "no file selected" 
    9292        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS3 = "no box selected" 
     93        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS4 = "no file selected" 
     94        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS5 = "no file selected" 
     95        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS6 = "no file selected" 
    9396        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV1 =0 
    9497        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV2 = 0 
     
    403406//from the calling routine 
    404407// 
    405 Function GetCheckBoxesState(w,num) 
    406         Wave w     //on return, this wave contains the current state of the checkboxes 
    407         Variable num 
    408          
    409         if(num != 20) 
    410                 Abort "wrong number of checkboxes GetCheckBoxesState()" 
    411         Endif 
    412         ControlInfo checkPS1 
    413         w[0] = V_value 
    414          
    415         Variable ii 
    416         String baseStr="checkPV" 
    417          
    418         ii=1 
    419         do 
    420                 ControlInfo $(baseStr + num2str(ii)) 
    421                 w[ii] = V_Value 
    422                 ii+=1 
    423         while(ii<num) 
    424         return(0) 
    425 End 
     408//Function GetCheckBoxesState(w,num) 
     409//      Wave w     //on return, this wave contains the current state of the checkboxes 
     410//      Variable num 
     411//       
     412//      if(num != 20) 
     413//              Abort "wrong number of checkboxes GetCheckBoxesState()" 
     414//      Endif 
     415//      ControlInfo checkPS1 
     416//      w[0] = V_value 
     417//       
     418//      Variable ii 
     419//      String baseStr="checkPV" 
     420//       
     421//      ii=1 
     422//      do 
     423//              ControlInfo $(baseStr + num2str(ii)) 
     424//              w[ii] = V_Value 
     425//              ii+=1 
     426//      while(ii<num) 
     427//      return(0) 
     428//End 
    426429 
    427430//on return, wt is a TEXT wave with the values in the SetVar boxes 
     
    431434//from the calling routine 
    432435// 
    433 Function GetEditedSetVarBoxes(wt,num) 
    434         Wave/T wt           
    435         Variable num 
    436          
    437         if(num != 20) 
    438                 Abort "wrong number of checkboxes GetEditedSetVarBoxes()" 
    439         Endif 
    440          
    441         //pass all as a text wave - so only one wave has to be passed (conversion 2x, though) 
    442         //global is set to the changed value when entered. read others directly from the control 
    443          
    444         //make sure the text label is exactly 60 characters long, to match VAX field length 
    445         SVAR dum=root:Packages:NIST:VSANS:Globals:Patch:gPS1 
    446 //      String str60="", junk="junk"  
    447 //      str60 = PadString(junk,60,0x20) 
    448 //      if(strlen(dum) <= 60) 
    449 //              if(strlen(dum) == 60) 
    450 //                 str60 = dum 
    451 //              else 
    452 //                 str60 = PadString(dum,60,0x20) 
    453 //              Endif 
    454 //      else 
    455 //              //too long, truncate 
    456 //              str60[0,59] = dum[0,59] 
     436//Function GetEditedSetVarBoxes(wt,num) 
     437//      Wave/T wt           
     438//      Variable num 
     439//       
     440//      if(num != 20) 
     441//              Abort "wrong number of checkboxes GetEditedSetVarBoxes()" 
    457442//      Endif 
    458443//       
    459 //      wt[0] = str60 
    460         wt[0] = dum                     //with Nexus, no need to enforce 60 character field 
     444//      //pass all as a text wave - so only one wave has to be passed (conversion 2x, though) 
     445//      //global is set to the changed value when entered. read others directly from the control 
    461446//       
    462         Variable ii 
    463         String baseStr="PV" 
    464         ii=1 
    465         do 
    466                 ControlInfo $(baseStr + num2str(ii)) 
    467                 wt[ii] = num2str(V_Value) 
    468                 ii+=1 
    469         while(ii<num) 
    470          
    471         return(0)       //no error 
    472 End 
     447//      //make sure the text label is exactly 60 characters long, to match VAX field length 
     448//      SVAR dum=root:Packages:NIST:VSANS:Globals:Patch:gPS1 
     449// 
     450////    wt[0] = str60 
     451//      wt[0] = dum                     //with Nexus, no need to enforce 60 character field 
     452////     
     453//      Variable ii 
     454//      String baseStr="PV" 
     455//      ii=1 
     456//      do 
     457//              ControlInfo $(baseStr + num2str(ii)) 
     458//              wt[ii] = num2str(V_Value) 
     459//              ii+=1 
     460//      while(ii<num) 
     461//       
     462//      return(0)       //no error 
     463//End 
    473464 
    474465 
     
    505496        Variable ok,nvars = 20,ii 
    506497         
    507         Make/O/N=(nvars) tempChange 
    508         Wave w=tempchange 
    509         GetCheckBoxesState(w,nvars) 
     498//      Make/O/N=(nvars) tempChange 
     499//      Wave w=tempchange 
     500//      GetCheckBoxesState(w,nvars) 
    510501        //Print "w[0] = ",w[0] 
    511502         
    512503         
    513         //Get the current values in each of the fields - to pass to Write() as a textwave 
    514         Make/O/T/N=(nvars) tempValues 
    515         Wave/T wt=tempValues 
    516         //initialize textwave 
    517         ii=0 
    518         do 
    519                 wt[ii] = "" 
    520                 ii+=1 
    521         while(ii<nvars) 
    522         GetEditedSetVarBoxes(wt,nvars) 
     504//      //Get the current values in each of the fields - to pass to Write() as a textwave 
     505//      Make/O/T/N=(nvars) tempValues 
     506//      Wave/T wt=tempValues 
     507//      //initialize textwave 
     508//      ii=0 
     509//      do 
     510//              wt[ii] = "" 
     511//              ii+=1 
     512//      while(ii<nvars) 
     513//      GetEditedSetVarBoxes(wt,nvars) 
    523514         
    524515        //get the popup string 
     
    539530         
    540531        //go write the changes to the file 
    541         WriteHeaderForPatch(tempName,w,wt) 
     532//      WriteHeaderForPatch(tempName,w,wt) 
     533        WriteHeaderForPatch(tempName) 
    542534         
    543535        //clean up wave before leaving 
     
    546538End 
    547539 
     540 
     541//      ControlInfo checkPS1 
     542//      w[0] = V_value 
     543//       
     544//      Variable ii 
     545//      String baseStr="checkPV" 
     546//       
     547//      ii=1 
     548//      do 
     549//              ControlInfo $(baseStr + num2str(ii)) 
     550//              w[ii] = V_Value 
     551//              ii+=1 
     552//      while(ii<num) 
     553         
    548554//*****this function actually writes the data to disk***** 
    549555//overwrites the specific bytes the the header that are to be changed 
     
    552558//if any additional fields are to be edited, the exact byte location must be known 
    553559// 
    554 Function WriteHeaderForPatch(fname,change,textVal) 
     560Function WriteHeaderForPatch(fname) 
    555561        String fname 
    556         Wave change 
    557         Wave/T textVal 
     562//      Wave change 
     563//      Wave/T textVal 
    558564         
    559565        Variable refnum,num 
     
    563569// -- currently I hard-wired a detector choice. This needs to be changed (somehow), with a better interface 
    564570// 
    565         String detStr = "FL" 
    566  
    567          
    568         //change the sample label ? 
    569         if(change[0]) 
    570                 V_writeSampleDescription(fname,textVal[0]) 
    571         Endif 
    572          
    573  
    574         if(change[1])           //sample transmission 
    575                 num = str2num(textVal[1]) 
    576                 V_writeSampleTransmission(fname,num) 
    577         Endif 
    578         if(change[2])           //sample thickness 
    579                 num = str2num(textVal[2]) 
    580                 V_writeSampleThickness(fname,num) 
    581         Endif 
    582         if(change[3])           //pixel X 
    583                 num = str2num(textVal[3]) 
    584                 V_writeDet_beam_center_x(fname,detStr,num)              // TODO un-hard-wire 
    585         Endif 
    586         if(change[4])           // pixel Y 
    587                 num = str2num(textVal[4]) 
    588                 V_writeDet_beam_center_y(fname,detStr,num)              // TODO un-hard-wire 
    589         Endif 
    590         if(change[5])           //attenuator number 
    591                 num = str2num(textVal[5]) 
    592                 V_writeAttenThickness(fname,num) 
    593         Endif 
    594         if(change[6]) 
    595                 num =str2num(textVal[6]) 
    596                 V_writeCount_time(fname,num) 
    597         Endif 
    598         if(change[7])    //monitor count 
    599                 num = str2num(textVal[7])  
    600                 V_writeMonitorCount(fname,num) 
    601         Endif 
    602         if(change[8])     //total detector count 
    603                 num = str2num(textVal[8]) 
    604                 V_writeDet_IntegratedCount(fname,detStr,num)            // TODO un-hard-wire 
    605         Endif 
    606         if(change[9])      //trans det count 
    607                 num = str2num(textVal[9]) 
    608 // TODO -- replace call 
    609 //              WriteTransDetCountToHeader(fname,num) 
    610         Endif 
    611         if(change[10])      //wavelength 
    612                 num = str2num(textVal[10]) 
    613                 V_writeWavelength(fname,num) 
    614         Endif 
    615         /// 
    616         if(change[11])      //wavelength spread 
    617                 num = str2num(textVal[11]) 
    618                 V_writeWavelength_spread(fname,num) 
    619         Endif 
    620         if(change[12])      //temperature 
    621                 num = str2num(textVal[12]) 
    622 // TODO -- replace call 
    623 //              WriteTemperatureToHeader(fname,num) 
    624         Endif 
    625         if(change[13])      //magnetic field 
    626                 num = str2num(textVal[13]) 
    627 // TODO -- replace call 
    628 //              WriteMagnFieldToHeader(fname,num) 
    629         Endif 
    630         if(change[14])      //source aperture 
    631 //              num = str2num(textVal[14]) 
    632                 V_writeSourceAp_size(fname,textVal[14])         //this is expecting a string 
    633         Endif 
    634         if(change[15])      //sample aperture 
    635                 num = str2num(textVal[15]) 
    636                 V_writeSampleAp2_size(fname,num)                //TODO -- not sure if this is correct call 
    637         Endif 
    638         /// 
    639         if(change[16])      //source-sam dist 
    640                 num = str2num(textVal[16]) 
     571        ControlInfo popup_0 
     572        String detStr = S_value 
     573 
     574// handle strings differently 
     575 
     576        ControlInfo checkPS1            //change the sample label ? 
     577        if(V_Value == 1) 
     578                SVAR gPS1 = root:Packages:NIST:VSANS:Globals:Patch:gPS1 
     579                V_writeSampleDescription(fname,gPS1) 
     580        endif 
     581         
     582        ControlInfo checkPV1 
     583        if(V_Value == 1)                //sample transmission 
     584                ControlInfo PV1 
     585                V_writeSampleTransmission(fname,V_value) 
     586        Endif 
     587         
     588        ControlInfo checkPV2 
     589        if(V_Value == 1)                //sample thickness 
     590                ControlInfo PV2 
     591                V_writeSampleThickness(fname,V_Value) 
     592        Endif 
     593         
     594        ControlInfo checkPV5 
     595        if(V_Value == 1)                //attenuator number 
     596                ControlInfo PV5 
     597                V_writeAttenThickness(fname,V_value) 
     598        Endif 
     599 
     600        ControlInfo checkPV6            // count time 
     601        if(V_Value == 1) 
     602                ControlInfo PV6 
     603                V_writeCount_time(fname,V_Value) 
     604        Endif 
     605 
     606        ControlInfo checkPV7     
     607        if(V_Value == 1)    //monitor count 
     608                ControlInfo PV7  
     609                V_writeMonitorCount(fname,V_Value) 
     610        Endif 
     611 
     612        ControlInfo checkPV10    
     613        if(V_Value == 1)      //wavelength 
     614                ControlInfo PV10 
     615                V_writeWavelength(fname,V_Value) 
     616        Endif 
     617 
     618        ControlInfo checkPV11            
     619        if(V_Value == 1)      //wavelength spread 
     620                ControlInfo PV11 
     621                V_writeWavelength_spread(fname,V_Value) 
     622        Endif    
     623 
     624        ControlInfo checkPV14            
     625        if(V_Value == 1)      //source aperture 
     626                ControlInfo PV14 
     627                textStr = num2str(V_Value) 
     628                V_writeSourceAp_size(fname,textStr)             //this is expecting a string 
     629        Endif 
     630         
     631        ControlInfo checkPV15            
     632        if(V_Value == 1)      //sample aperture 
     633                ControlInfo PV15 
     634                V_writeSampleAp2_size(fname,V_Value)            //TODO -- not sure if this is correct call 
     635        Endif 
     636 
     637        ControlInfo checkPV16 
     638        if(V_Value == 1)      //source-sam dist 
     639                ControlInfo PV16 
    641640// TODO -- replace call 
    642641//              WriteSrcToSamDistToHeader(fname,num) 
    643642        Endif 
    644         if(change[17])      //det offset 
    645                 num = str2num(textVal[17]) 
    646                 V_writeDet_LateralOffset(fname,detStr,num)              // TODO lateral or vertical offset, based on detStr 
    647         Endif 
    648         if(change[18])      //beamstop diam 
    649                 num = str2num(textVal[18]) 
    650                 V_writeBeamStopC2_size(fname,num)                       //TODO depends on which det carriage I'm working with (2) or (3) 
    651         Endif 
    652         if(change[19])     //SDD 
    653                 num = str2num(textVal[19]) 
    654                 V_writeDet_distance(fname,detStr,num)   // TODO un-hard-wire 
    655         Endif 
     643 
     644        ControlInfo checkPV18 
     645        if(V_Value == 1)      //beamstop diam 
     646                ControlInfo PV18 
     647                V_writeBeamStopC2_size(fname,V_Value)                   //TODO depends on which det carriage I'm working with (2) or (3) 
     648        Endif    
     649 
     650        ControlInfo checkPS2            //change the DIV file name? 
     651        if(V_Value == 1) 
     652                SVAR gPS2 = root:Packages:NIST:VSANS:Globals:Patch:gPS2 
     653                V_writeSensitivityFileName(fname,gPS2) 
     654        endif    
     655         
     656        ControlInfo checkPS3            //change the sample intent? 
     657        if(V_Value == 1) 
     658                SVAR gPS3 = root:Packages:NIST:VSANS:Globals:Patch:gPS3 
     659                V_writeReductionIntent(fname,gPS3) 
     660        endif    
     661 
     662         
     663// individual detector values    
     664        ControlInfo checkPV3 
     665        if(V_Value == 1)                //pixel X 
     666                ControlInfo PV3 
     667                V_writeDet_beam_center_x(fname,detStr,V_Value)   
     668        Endif 
     669         
     670        ControlInfo checkPV4 
     671        if(V_Value == 1)                // pixel Y 
     672                ControlInfo PV4 
     673                V_writeDet_beam_center_y(fname,detStr,V_Value)   
     674        Endif 
     675         
     676        ControlInfo checkPV17 
     677        if(V_Value == 1)      //det offset 
     678                ControlInfo PV17 
     679                V_writeDet_LateralOffset(fname,detStr,V_Value)          // TODO lateral or vertical offset, based on detStr 
     680        Endif 
     681 
     682        ControlInfo checkPV19 
     683        if(V_Value == 1)     //SDD 
     684                ControlInfo PV19 
     685                V_writeDet_distance(fname,detStr,V_Value)         
     686        Endif 
     687 
     688        ControlInfo checkPV8     
     689        if(V_Value == 1)     //total detector count 
     690                ControlInfo PV8 
     691                V_writeDet_IntegratedCount(fname,detStr,V_value)                 
     692        Endif 
     693 
     694 
    656695        Return(0) 
    657696End 
     
    661700Proc V_Patch_Panel() 
    662701        PauseUpdate; Silent 1      // building window... 
    663         NewPanel /W=(519,85,950,608)/K=2 as "Patch Raw VSANS Data Files" 
     702        NewPanel /W=(519,85,950,688)/K=2 as "Patch Raw VSANS Data Files" 
    664703        DoWindow/C V_Patch_Panel 
    665         ModifyPanel cbRGB=(1,39321,19939) 
     704        ModifyPanel cbRGB=(11291,48000,3012) 
    666705        ModifyPanel fixedSize=1 
    667706        SetDrawLayer UserBack 
     
    671710        DrawLine 7,288,422,288 
    672711        DrawLine 7,199,422,199 
    673         DrawLine 7,378,422,378 
    674         DrawLine 7,469,422,469 
     712        DrawLine 7,378+18,422,378+18 
     713        DrawLine 7,469+18,422,469+18 
     714         
    675715        SetVariable PathDisplay,pos={77,7},size={310,13},title="Path" 
    676716        SetVariable PathDisplay,help={"This is the path to the folder that will be used to find the SANS data while patching. If no files appear in the popup, make sure that this folder is set correctly"} 
     
    694734        Button ChAllButton,pos={245,60},size={180,20},proc=ChAllHeadersButtonProc,title="Change All Headers in List" 
    695735        Button ChAllButton,help={"This will change the checked values (ONLY) in ALL of the files in the popup list, not just the top file. If the \"change\" checkbox for the item is not checked, nothing will be changed for that item."} 
    696         Button DoneButton,pos={310,489},size={110,20},proc=DoneButtonProc,title="Done Patching" 
     736        Button DoneButton,pos={314,85},size={110,20},proc=DoneButtonProc,title="Done Patching" 
    697737        Button DoneButton,help={"When done Patching files, this will close this control panel."} 
    698         Button cat_short,pos={9,485},size={100,20},proc=DoCatShort,title="File Catalog" 
    699         Button cat_short,help={"Use this button to generate a notebook with file header information. Very useful for identifying files."} 
    700         SetVariable PS1,pos={42,111},size={338,13},proc=SetLabelVarProc,title="label" 
     738//      Button cat_short,pos={9,485},size={100,20},proc=DoCatShort,title="File Catalog" 
     739//      Button cat_short,help={"Use this button to generate a notebook with file header information. Very useful for identifying files."} 
     740        CheckBox check0,pos={18,80},size={40,15},title="Run #",value= 1,mode=1,proc=MatchCheckProc 
     741        CheckBox check1,pos={78,80},size={40,15},title="Text",value= 0,mode=1,proc=MatchCheckProc 
     742        CheckBox check2,pos={138,80},size={40,15},title="SDD",value= 0,mode=1,proc=MatchCheckProc 
     743 
     744        Variable base=111,step=18 
     745        SetVariable PS1,pos={42,base},size={340,13},proc=SetLabelVarProc,title="label" 
    701746        SetVariable PS1,help={"Current sample label"},font="Courier",fSize=10 
    702747        SetVariable PS1,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPS1 
    703         SetVariable PV1,pos={42,129},size={340,13},title="Transmission" 
     748        SetVariable PV1,pos={42,base+step},size={340,13},title="Transmission" 
    704749        SetVariable PV1,help={"Current transmission\rvalue"},font="Courier",fSize=10 
    705750        SetVariable PV1,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV1 
    706         SetVariable PV2,pos={42,147},size={340,13},title="Thickness (cm)" 
     751        SetVariable PV2,pos={42,base+2*step},size={340,13},title="Thickness (cm)" 
    707752        SetVariable PV2,help={"Current sample thickness, in units of centimeters"} 
    708753        SetVariable PV2,font="Courier",fSize=10 
    709754        SetVariable PV2,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV2 
    710         SetVariable PV3,pos={42,165},size={340,13},title="Beamcenter X" 
     755 
     756        SetVariable PV5,pos={42,base+3*step},size={340,13},title="Attenuator number" 
     757        SetVariable PV5,help={"attenuator number present during data collection"} 
     758        SetVariable PV5,font="Courier",fSize=10 
     759        SetVariable PV5,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV5 
     760        SetVariable PV6,pos={42,base+4*step},size={340,13},title="Counting time (s)",font="Courier",fSize=10 
     761        SetVariable PV6,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV6 
     762        SetVariable PV6,help={"total counting time in seconds"} 
     763        SetVariable PV7,pos={42,base+5*step},size={340,13},title="Monitor count",font="Courier",fSize=10 
     764        SetVariable PV7,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV7 
     765        SetVariable PV7,help={"total monitor counts"} 
     766 
     767        SetVariable PV10,pos={42,base+6*step},size={340,13},title="Wavelength (A)",font="Courier",fSize=10 
     768        SetVariable PV10,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV10 
     769        SetVariable PV10,help={"neutron wavelength in angstroms"} 
     770        SetVariable PV11,pos={42,base+7*step},size={340,13},title="Wavelength spread (dL/L)",font="Courier",fSize=10 
     771        SetVariable PV11,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV11 
     772        SetVariable PV11,help={"wavelength spread (delta lambda)/lambda"} 
     773 
     774        SetVariable PV14,pos={42,base+8*step},size={340,13},title="Source aperture diameter (mm)",font="Courier",fSize=10 
     775        SetVariable PV14,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV14 
     776        SetVariable PV14,help={"source aperture diameter, in millimeters"} 
     777        SetVariable PV15,pos={42,base+9*step},size={340,13},title="Sample aperture diameter (mm)",font="Courier",fSize=10 
     778        SetVariable PV15,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV15 
     779        SetVariable PV15,help={"sample aperture diameter, in millimeters"} 
     780        SetVariable PV16,pos={42,base+10*step},size={340,13},title="Source to sample distance (cm)",font="Courier",fSize=10 
     781        SetVariable PV16,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV16 
     782        SetVariable PV16,help={"Source to sample distance in centimeters"} 
     783         
     784        SetVariable PV18,pos={42,base+11*step},size={340,13},title="Beamstop diameter (mm)",font="Courier",fSize=10 
     785        SetVariable PV18,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV18 
     786        SetVariable PV18,help={"beamstop diamter, in millimeters (1 inch = 25.4mm)"} 
     787// TODO: add functions for these, make the intent a popup (since it's an enumerated type) 
     788        SetVariable PS2,pos={42,base+12*step},size={340,13},proc=SetLabelVarProc,title="DIV file name" 
     789        SetVariable PS2,help={"DIV file name"},font="Courier",fSize=10 
     790        SetVariable PS2,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPS2 
     791        SetVariable PS3,pos={42,base+13*step},size={340,13},proc=SetLabelVarProc,title="Intent" 
     792        SetVariable PS3,help={"File Intent"},font="Courier",fSize=10 
     793        SetVariable PS3,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPS3 
     794        PopupMenu popup_1,pos={42,base+14*step},size={109,20},title="File intent" 
     795        PopupMenu popup_1,mode=1,popvalue="SCATTER",value= #"\"SCATTER;EMPTY;TRANS;EMPTY BEAM;\"" 
     796         
     797        CheckBox checkPS1,pos={18,base},size={20,20},title="" 
     798        CheckBox checkPS1,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     799        CheckBox checkPV1,pos={18,base+step},size={20,20},title="" 
     800        CheckBox checkPV1,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     801        CheckBox checkPV2,pos={18,base+2*step},size={20,20},title="" 
     802        CheckBox checkPV2,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     803 
     804        CheckBox checkPV5,pos={18,base+3*step},size={20,20},title="" 
     805        CheckBox checkPV5,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     806        CheckBox checkPV6,pos={18,base+4*step},size={20,20},title="" 
     807        CheckBox checkPV6,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     808        CheckBox checkPV7,pos={18,base+5*step},size={20,20},title="",value=0 
     809        CheckBox checkPV7,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     810 
     811        CheckBox checkPV10,pos={18,base+6*step},size={20,20},title="",value=0 
     812        CheckBox checkPV10,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     813        CheckBox checkPV11,pos={18,base+7*step},size={20,20},title="",value=0 
     814        CheckBox checkPV11,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     815 
     816        CheckBox checkPV14,pos={18,base+8*step},size={20,20},title="",value=0 
     817        CheckBox checkPV14,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     818        CheckBox checkPV15,pos={18,base+9*step},size={20,20},title="",value=0 
     819        CheckBox checkPV15,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     820        CheckBox checkPV16,pos={18,base+10*step},size={20,20},title="",value=0 
     821        CheckBox checkPV16,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     822 
     823        CheckBox checkPV18,pos={18,base+11*step},size={20,20},title="",value=0 
     824        CheckBox checkPV18,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     825        CheckBox checkPS2,pos={18,base+12*step},size={20,20},title="",value=0 
     826        CheckBox checkPS2,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     827        CheckBox checkPS3,pos={18,base+13*step},size={20,20},title="",value=0 
     828        CheckBox checkPS3,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     829 
     830 
     831 
     832 
     833// put these in a tabbed? section for the 9 different panels 
     834// will it be able to patch all "FL" with the proper values, then all "FR", etc. to batchwise correct files? 
     835 
     836        base = base+19*step 
     837        PopupMenu popup_0,pos={30,base-step-10},size={109,20},title="Detector Panel",proc=PatchPopMenuProc 
     838        PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;MR;ML;MT;MB;B;\"" 
     839 
     840        SetVariable PV3,pos={42,base},size={340,13},title="Beamcenter X" 
    711841        SetVariable PV3,help={"Current X-position of the beamcenter, in pixels"} 
    712842        SetVariable PV3,font="Courier",fSize=10 
    713843        SetVariable PV3,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV3 
    714         SetVariable PV4,pos={42,183},size={340,13},title="Beamcenter Y" 
     844        SetVariable PV4,pos={42,base+step},size={340,13},title="Beamcenter Y" 
    715845        SetVariable PV4,help={"Current Y-position of the beamcenter, in pixels"} 
    716846        SetVariable PV4,font="Courier",fSize=10 
    717847        SetVariable PV4,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV4 
    718         SetVariable PV5,pos={42,202},size={340,13},title="Attenuator number" 
    719         SetVariable PV5,help={"attenuator number present during data collection"} 
    720         SetVariable PV5,font="Courier",fSize=10 
    721         SetVariable PV5,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV5 
    722         SetVariable PV6,pos={42,219},size={340,13},title="Counting time (s)",font="Courier",fSize=10 
    723         SetVariable PV6,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV6 
    724         SetVariable PV6,help={"total counting time in seconds"} 
    725         SetVariable PV7,pos={42,237},size={340,13},title="Monitor count",font="Courier",fSize=10 
    726         SetVariable PV7,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV7 
    727         SetVariable PV7,help={"total monitor counts"} 
    728         SetVariable PV8,pos={42,255},size={340,13},title="Detector count",font="Courier",fSize=10 
     848 
     849 
     850        SetVariable PV17,pos={42,base+2*step},size={340,13},title="Detector offset (mm)",font="Courier",fSize=10 
     851        SetVariable PV17,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV17 
     852        SetVariable PV17,help={"Detector offset, in millimeters"} 
     853        SetVariable PV19,pos={42,base+3*step},size={340,13},title="Sample to detector distance (cm)",font="Courier",fSize=10 
     854        SetVariable PV19,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV19 
     855        SetVariable PV19,help={"sample to detector distance, in centimeters"} 
     856         
     857        SetVariable PV8,pos={42,base+4*step},size={340,13},title="Detector count",font="Courier",fSize=10 
    729858        SetVariable PV8,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV8 
    730859        SetVariable PV8,help={"total detector counts"} 
    731         SetVariable PV9,pos={42,273},size={340,13},title="Trans. det. count",font="Courier",fSize=10 
    732         SetVariable PV9,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV9 
    733         SetVariable PV9,help={"Transmission\r detector counts"} 
    734         SetVariable PV10,pos={42,291},size={340,13},title="Wavelength (A)",font="Courier",fSize=10 
    735         SetVariable PV10,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV10 
    736         SetVariable PV10,help={"neutron wavelength in angstroms"} 
    737         SetVariable PV11,pos={42,309},size={340,13},title="Wavelength spread (dL/L)",font="Courier",fSize=10 
    738         SetVariable PV11,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV11 
    739         SetVariable PV11,help={"wavelength spread (delta lambda)/lambda"} 
    740         SetVariable PV12,pos={42,327},size={340,13},title="Temperature (C)",font="Courier",fSize=10 
    741         SetVariable PV12,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV12 
    742         SetVariable PV12,help={"Set point temperature in centigrade"} 
    743         SetVariable PV13,pos={42,345},size={340,13},title="Magnetic field (G)",font="Courier",fSize=10 
    744         SetVariable PV13,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV13 
    745         SetVariable PV13,help={"magnetic field strength units?"} 
    746         SetVariable PV14,pos={42,363},size={340,13},title="Source aperture diameter (mm)",font="Courier",fSize=10 
    747         SetVariable PV14,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV14 
    748         SetVariable PV14,help={"source aperture diameter, in millimeters"} 
    749         SetVariable PV15,pos={42,381},size={340,13},title="Sample aperture diameter (mm)",font="Courier",fSize=10 
    750         SetVariable PV15,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV15 
    751         SetVariable PV15,help={"sample aperture diameter, in millimeters"} 
    752         SetVariable PV16,pos={42,399},size={340,13},title="Source to sample distance (m)",font="Courier",fSize=10 
    753         SetVariable PV16,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV16 
    754         SetVariable PV16,help={"Source to sample distance in meters"} 
    755         SetVariable PV17,pos={42,417},size={340,13},title="Detector offset (cm)",font="Courier",fSize=10 
    756         SetVariable PV17,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV17 
    757         SetVariable PV17,help={"Detector offset, in centimeters"} 
    758         SetVariable PV18,pos={42,435},size={340,13},title="Beamstop diameter (mm)",font="Courier",fSize=10 
    759         SetVariable PV18,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV18 
    760         SetVariable PV18,help={"beamstop diamter, in millimeters (1 inch = 25.4mm)"} 
    761         SetVariable PV19,pos={42,453},size={340,13},title="Sample to detector distance (m)",font="Courier",fSize=10 
    762         SetVariable PV19,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV19 
    763         SetVariable PV19,help={"sample to detector distance, in meters"} 
    764          
    765         CheckBox checkPS1,pos={18,108},size={20,20},title="" 
    766         CheckBox checkPS1,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    767         CheckBox checkPV1,pos={18,126},size={20,20},title="" 
    768         CheckBox checkPV1,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    769         CheckBox checkPV2,pos={18,144},size={20,20},title="" 
    770         CheckBox checkPV2,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    771         CheckBox checkPV3,pos={18,162},size={20,20},title="" 
     860 
     861                 
     862        CheckBox checkPV3,pos={18,base},size={20,20},title="" 
    772863        CheckBox checkPV3,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    773         CheckBox checkPV4,pos={18,180},size={20,20},title="" 
     864        CheckBox checkPV4,pos={18,base+step},size={20,20},title="" 
    774865        CheckBox checkPV4,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    775         CheckBox checkPV5,pos={18,198},size={20,20},title="" 
    776         CheckBox checkPV5,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    777         CheckBox checkPV6,pos={18,216},size={20,20},title="" 
    778         CheckBox checkPV6,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    779         CheckBox checkPV7,pos={18,234},size={20,20},title="",value=0 
    780         CheckBox checkPV7,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    781         CheckBox checkPV8,pos={18,252},size={20,20},title="",value=0 
     866 
     867        CheckBox checkPV8,pos={18,base+2*step},size={20,20},title="",value=0 
    782868        CheckBox checkPV8,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    783         CheckBox checkPV9,pos={18,270},size={20,20},title="",value=0 
    784         CheckBox checkPV9,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    785         CheckBox checkPV10,pos={18,288},size={20,20},title="",value=0 
    786         CheckBox checkPV10,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    787         CheckBox checkPV11,pos={18,306},size={20,20},title="",value=0 
    788         CheckBox checkPV11,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    789         CheckBox checkPV12,pos={18,324},size={20,20},title="",value=0 
    790         CheckBox checkPV12,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    791         CheckBox checkPV13,pos={18,342},size={20,20},title="",value=0 
    792         CheckBox checkPV13,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    793         CheckBox checkPV14,pos={18,360},size={20,20},title="",value=0 
    794         CheckBox checkPV14,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    795         CheckBox checkPV15,pos={18,378},size={20,20},title="",value=0 
    796         CheckBox checkPV15,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    797         CheckBox checkPV16,pos={18,396},size={20,20},title="",value=0 
    798         CheckBox checkPV16,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    799         CheckBox checkPV17,pos={18,414},size={20,20},title="",value=0 
     869 
     870        CheckBox checkPV17,pos={18,base+3*step},size={20,20},title="",value=0 
    800871        CheckBox checkPV17,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    801         CheckBox checkPV18,pos={18,432},size={20,20},title="",value=0 
    802         CheckBox checkPV18,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    803         CheckBox checkPV19,pos={18,450},size={20,20},title="",value=0 
     872 
     873        CheckBox checkPV19,pos={18,base+4*step},size={20,20},title="",value=0 
    804874        CheckBox checkPV19,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    805875 
    806         CheckBox check0,pos={18,80},size={40,15},title="Run #",value= 1,mode=1,proc=MatchCheckProc 
    807         CheckBox check1,pos={78,80},size={40,15},title="Text",value= 0,mode=1,proc=MatchCheckProc 
    808         CheckBox check2,pos={138,80},size={40,15},title="SDD",value= 0,mode=1,proc=MatchCheckProc 
     876//      SetVariable PV9,pos={42,273},size={340,13},title="Trans. det. count",font="Courier",fSize=10 
     877//      SetVariable PV9,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV9 
     878//      SetVariable PV9,help={"Transmission\r detector counts"} 
     879//      SetVariable PV12,pos={42,327},size={340,13},title="Temperature (C)",font="Courier",fSize=10 
     880//      SetVariable PV12,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV12 
     881//      SetVariable PV12,help={"Set point temperature in centigrade"} 
     882//      SetVariable PV13,pos={42,345},size={340,13},title="Magnetic field (G)",font="Courier",fSize=10 
     883//      SetVariable PV13,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPV13 
     884//      SetVariable PV13,help={"magnetic field strength units?"} 
     885//      CheckBox checkPV9,pos={18,270},size={20,20},title="",value=0 
     886//      CheckBox checkPV9,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     887//      CheckBox checkPV12,pos={18,324},size={20,20},title="",value=0 
     888//      CheckBox checkPV12,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
     889//      CheckBox checkPV13,pos={18,342},size={20,20},title="",value=0 
     890//      CheckBox checkPV13,help={"If checked, the entered value will be written to the data file if either of the \"Change..\" buttons is pressed."},value=0 
    809891 
    810892End 
     
    849931         
    850932        // TODO -- remove the hard-wired detStr. This will require some serious interface thought. 
    851         String detStr = "FL" 
     933        ControlInfo popup_0 
     934        String detStr = S_value 
    852935         
    853936        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS1= V_getSampleDescription(fname) 
     937 
    854938        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV1 = V_getSampleTransmission(fname) 
    855939        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV2 = V_getSampleThickness(fname) 
    856         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV3 = V_getDet_beam_center_x(fname,detStr) 
    857         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV4 = V_getDet_beam_center_y(fname,detStr) 
     940 
    858941        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV5 = V_getAttenThickness(fname) 
    859942        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV6 = V_getCount_Time(fname) 
    860943        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV7 = V_getMonitorCount(fname) 
    861         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV8 = V_getDet_IntegratedCount(fname,detStr) 
    862         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV9 = -999           // TODO no equivalent for VSANS to --getTransDetectorCounts(fname) 
     944 
     945//      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV9 = -999           // TODO no equivalent for VSANS to --getTransDetectorCounts(fname) 
    863946        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV10 = V_getWavelength(fname) 
    864947        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV11 = V_getWavelength_Spread(fname) 
    865         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV12 = -999 // TODO no equivalent yet for -- getTemperature(fname) 
    866         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV13 = -999 // TODO no equivalent yet for -- getFieldStrength(fname) 
     948//      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV12 = -999 // TODO no equivalent yet for -- getTemperature(fname) 
     949//      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV13 = -999 // TODO no equivalent yet for -- getFieldStrength(fname) 
    867950        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV14 = str2num(V_getSourceAp_size(fname)) 
    868951        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV15 = V_getSampleAp2_size(fname) 
    869952        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV16 = -999 // TODO no equivalent yet for -- getSourceToSampleDist(fname) 
     953        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV18 = V_getBeamStopC3_size(fname) 
     954 
     955// per detector information 
     956        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV3 = V_getDet_beam_center_x(fname,detStr) 
     957        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV4 = V_getDet_beam_center_y(fname,detStr) 
    870958        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV17 = V_getDet_LateralOffset(fname,detStr)  //TODO lateral vs vertical offset 
    871         Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV18 = V_getBeamStopC3_size(fname) 
    872959        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV19 = V_getDet_ActualDistance(fname,detStr) 
     960        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV8 = V_getDet_IntegratedCount(fname,detStr) 
     961                 
     962        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS2= V_getSensitivityFileName(fname)   //DIV file name 
     963        String/G root:Packages:NIST:VSANS:Globals:Patch:gPS3= V_getReduction_intent(fname)              //intent 
    873964         
    874965        Return 0 
     
    9141005        Variable ok,nvars = 20 
    9151006         
    916         Make/O/N=(nvars) tempChange 
    917         Wave w=tempchange 
    918         GetCheckBoxesState(w,nvars) 
     1007//      Make/O/N=(nvars) tempChange 
     1008//      Wave w=tempchange 
     1009//      GetCheckBoxesState(w,nvars) 
    9191010        //Print "w[0] = ",w[0] 
    9201011         
    921         //Get the current values in each of the fields - to pass to Write() as a textwave 
    922         Make/O/T/N=(nvars) tempValues 
    923         Wave/T wt=tempValues 
    924         //initialize textwave 
    925         ii=0 
    926         do 
    927                 wt[ii] = "" 
    928                 ii+=1 
    929         while(ii<nvars) 
    930         GetEditedSetVarBoxes(wt,nvars) 
     1012//      //Get the current values in each of the fields - to pass to Write() as a textwave 
     1013//      Make/O/T/N=(nvars) tempValues 
     1014//      Wave/T wt=tempValues 
     1015//      //initialize textwave 
     1016//      ii=0 
     1017//      do 
     1018//              wt[ii] = "" 
     1019//              ii+=1 
     1020//      while(ii<nvars) 
     1021//      GetEditedSetVarBoxes(wt,nvars) 
    9311022         
    9321023        //loop through all of the files in the list, applying changes as dictated by w and wt waves 
     
    9491040                else 
    9501041                   //go write the changes to the file 
    951                    WriteHeaderForPatch(tempName,w,wt) 
     1042//                 WriteHeaderForPatch(tempName,w,wt) 
     1043                   WriteHeaderForPatch(tempName) 
    9521044                Endif 
    9531045                 
Note: See TracChangeset for help on using the changeset viewer.