Ignore:
Timestamp:
Feb 6, 2007 3:58:38 PM (16 years ago)
Author:
srkline
Message:

bug fixes and performance tweaks

Location:
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Buttons.ipf

    r41 r47  
    259259//displays next (or previous) file in series of run numbers 
    260260//file is read from disk, if path is set and the file number is present 
    261 //increment +1, adds 1 to eun number, -1 subtracts one 
     261//increment +1, adds 1 to run number, -1 subtracts one 
    262262Function LoadPlotAndDisplayRAW(increment) 
    263263        Variable increment 
     
    299299Proc maskButtonProc(ctrlName) : ButtonControl 
    300300        String ctrlName 
    301           
    302          OverlayMask() 
     301                 
     302        DoWindow/F SANS_Data             //do nothing if SANS_Data is not displayed, make it target if it is open 
     303        if(V_flag==0) 
     304                return 
     305        endif 
     306         
     307        CheckDisplayed/W=SANS_Data root:MSK:overlay 
     308        if(V_flag==1)           //the overlay is present 
     309                Button $ctrlName,title="Show Mask",win=SANS_Data 
     310                OverlayMask(0)          //hide the mask 
     311        else 
     312                Button $ctrlName,title="Hide Mask",win=SANS_Data 
     313                OverlayMask(1)          //show the mask 
     314        endif 
     315         
     316 
    303317End 
    304318 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/CatVSTable.ipf

    r41 r47  
    22#pragma version=5.0 
    33#pragma IgorVersion=4.0 
     4 
     5 
     6// 
     7//      SRK modified 30 JAN07 to include Rotation angle, Temperature, and B-field in the table (at the end) 
     8// 
    49 
    510//************** 
     
    4752        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    4853        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     54        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     55        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     56        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Field" 
    4957 
    5058        If(V_Flag==0) 
     
    6068                ModifyTable width(:myGlobals:CatVSHeaderInfo:YCenter)=40 
    6169                ModifyTable width(:myGlobals:CatVSHeaderInfo:NumAttens)=30 
     70                ModifyTable width(:myGlobals:CatVSHeaderInfo:RotAngle)=50 
     71                ModifyTable width(:myGlobals:CatVSHeaderInfo:Field)=50 
    6272                 
    6373                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run 
     
    116126        KillWaves/Z notRAWlist 
    117127// 
     128 
    118129End 
    119130 
     
    152163        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    153164        Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
    154  
    155         Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans 
     165        Wave GRot = $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     166        Wave GTemp = $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     167        Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" 
     168 
     169        Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField 
    156170        return(0) 
    157171End 
     
    174188        //Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
    175189        Wave/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    176  
    177         //Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumGuides, NumAtten as "Cat/VShort" 
    178         Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" 
     190        Wave RotAngle =  $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     191        Wave Temperature = $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     192        Wave Field= $"root:myGlobals:CatVSHeaderInfo:Field" 
     193 
     194// original order, magnetic at the end 
     195//      Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field as "Data File Catalog" 
     196// put the magnetic information first 
     197        Edit Filenames, Labels, RotAngle, Temperature, Field, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" 
    179198        String name="CatVSTable" 
    180199        DoWindow/C $name 
     
    191210        String textstr,temp,lbl,date_time,suffix 
    192211        Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten 
    193         Variable lastPoint, beamstop 
     212        Variable lastPoint, beamstop,dum 
    194213 
    195214        Wave/T GFilenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" 
     
    210229        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    211230        Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     231        Wave GRot = $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     232        Wave GTemp = $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     233        Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" 
    212234         
    213235        lastPoint = numpnts(GLambda) 
     
    307329        InsertPoints lastPoint,1,GLambda 
    308330        GLambda[lastPoint]=lambda 
     331         
     332        //Rotation Angle 
     333        strToExecute = GBLoadStr + "/S=170/U=1" + "\"" + fname + "\"" 
     334        Execute strToExecute 
     335        dum = w[0] 
     336        InsertPoints lastPoint,1,GRot 
     337        GRot[lastPoint]=dum 
     338         
     339        //Sample Temperature 
     340        strToExecute = GBLoadStr + "/S=186/U=1" + "\"" + fname + "\"" 
     341        Execute strToExecute 
     342        dum = w[0] 
     343        InsertPoints lastPoint,1,GTemp 
     344        GTemp[lastPoint]=dum 
     345         
     346        //Sample Field 
     347        strToExecute = GBLoadStr + "/S=190/U=1" + "\"" + fname + "\"" 
     348        Execute strToExecute 
     349        dum = w[0] 
     350        InsertPoints lastPoint,1,GField 
     351        GField[lastPoint]=dum 
    309352         
    310353        //Beamstop position (not reported) 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/CircSectAve.ipf

    r41 r47  
    104104        // 
    105105        //pixels within rcentr of beam center are broken into 9 parts (units of mm) 
    106         rcentr = 100 
     106        rcentr = 100            //original 
     107//      rcentr = 0 
    107108        // values for error if unable to estimate value 
    108109        //large_num = 1e10 
     
    299300                else 
    300301                        //large arg, exact correction 
    301                         aveint[ii] *= uval*arg/(1-exp(-uval*arg)) 
     302                        aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 
    302303                endif 
    303304                ii+=1 
     
    392393        //get rid of the default mask, if one was created (it is in the current folder) 
    393394        //don't just kill "mask" since it might be pointing to the one in the MSK folder 
    394         Killwaves/z $(destPath+":mask") 
     395        Killwaves/Z $(destPath+":mask") 
    395396         
    396397        //return to root folder (redundant) 
     
    423424//function determines azimuthal angle dphi that a vector connecting 
    424425//center of detector to pixel makes with respect to vector 
    425 //at chosen azimuthal angle phi -> [cos(phi),sin(phi0] = [phi_x,phi_y] 
     426//at chosen azimuthal angle phi -> [cos(phi),sin(phi)] = [phi_x,phi_y] 
    426427//dphi is always positive, varying from 0 to Pi 
    427428// 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Correct.ipf

    r41 r47  
    12501250         
    12511251        If((xshift == 0) && (yshift == 0)) 
    1252                 data_out=data_in 
     1252                data_out=data_in                //no change 
     1253                noadd_mat = 1                   //use all of the data 
    12531254                return(0) 
    12541255        endif 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/FIT_Ops.ipf

    r41 r47  
    562562                endif 
    563563                If (cmpstr("1/I",ystr) == 0) 
    564                         textstr_3 = "I(q=0) =  "  + num2str(1/W_coef[0]) 
     564                        textstr_3 = "I(q=0) =  "  + num2str(1/W_coef[0])+ " ± " + num2str(1/(W_coef[0] - W_sigma[0])-1/W_coef[0]) 
    565565                        break 
    566566                endif 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/MaskUtils.ipf

    r41 r47  
    2727        //SetDataFolder root:MSK 
    2828        String fname = PromptForPath("Select Mask file") 
     29        if(strlen(fname)==0) 
     30                return 
     31        endif 
    2932        ReadMCID_MASK(fname) 
    3033         
    3134        //SetDataFolder root:MSK 
    32         String waveStr = "root:MSK:data" 
    33         NewImage/F/S=2/K=1 $waveStr 
    34         ModifyImage '' ctab= {*,*,YellowHot,0} 
     35////    SRK SEP06 disable plot of mask data, just show the overlay 
     36////    String waveStr = "root:MSK:data" 
     37////    NewImage/F/S=2/K=1 $waveStr 
     38////    ModifyImage '' ctab= {*,*,YellowHot,0} 
     39        maskButtonProc("maskButton") 
     40//      OverlayMask(1) 
     41 
     42 
    3543//      Display/W=(10,50,400,400); AppendImage $waveStr 
    3644 
     
    144152// points directly to window, doesn't need current display type 
    145153// 
    146 Function OverlayMask() 
    147  
     154// if state==1, show the mask, if ==0, hide the mask 
     155Function OverlayMask(state) 
     156        Variable state 
     157         
    148158        String maskPath = "root:MSK:data" 
    149159        if(WaveExists($maskPath) == 1) 
     
    156166         
    157167                //check to see if mask overlay is currently displayed 
     168                DoWindow SANS_Data 
     169                if(V_flag==0) 
     170                        return(0) 
     171                endif 
     172                 
    158173                CheckDisplayed/W=SANS_Data root:MSK:overlay 
    159174                //Print "V_flag = ",V_flag 
    160175         
    161                 If(V_Flag == 1) 
    162                         //remove old overlay, if there was one 
    163                         RemoveImage overlay 
    164                 Else 
    165                         //append the new overlay 
    166                         AppendImage/L=left/B=bottom root:MSK:overlay 
    167                         //set the color table to vary from 0 to * (=max data = 1), with blue maximum 
    168                         //Nan's will appear transparent (just a general feature of images) 
    169                         ModifyImage/W=SANS_Data overlay ctab={0,*,BlueRedGreen,0} 
     176                If(V_Flag == 1)         //overlay is present 
     177                        if(state==0) 
     178                                RemoveImage overlay 
     179                        endif           //don't need to do anything if we want to keep the mask 
     180                Else            //overlay is not present 
     181                        if(state==1) 
     182                                //append the new overlay 
     183                                AppendImage/L=left/B=bottom root:MSK:overlay 
     184                                //set the color table to vary from 0 to * (=max data = 1), with blue maximum 
     185                                //Nan's will appear transparent (just a general feature of images) 
     186                                ModifyImage/W=SANS_Data overlay ctab={0,*,BlueRedGreen,0} 
     187                        endif           //don't do anything if we don't want the overlay 
    170188                Endif 
    171189        Endif 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/ProtocolAsPanel.ipf

    r41 r47  
    21122112//Proc AskForAbsoluteParams_Quest() 
    21132113Function AskForAbsoluteParams_Quest()    
    2114         Variable isNG5=0,loc 
    2115          
    2116         Variable err 
     2114         
     2115        Variable err, isNG5=0,loc,refnum 
    21172116        //ask user if he wants to use a transmision file for absolute scaling 
    21182117        //or if he wants to enter his own information 
     
    21602159                String filename=tw[0],tempStr 
    21612160                err = GetXYBoxFromFile(filename,x1,x2,y1,y2)            //xy's are passed/returned by reference 
    2162 //              Print x1,x2,y1,y2 
     2161                Print x1,x2,y1,y2 
    21632162 
    21642163                if( ((x1-x2)==0) || ((y1-y2)==0) )      //need to re-select the box 
     
    21672166                                Abort "Box not selected properly - Please re-set the ABS parameters" 
    21682167                        Endif 
     2168                        //box is OK, write box values to file (this does the same as SetXYBoxCoords) 
     2169                        String tempName = FindValidFilename(filename) 
     2170                        PathInfo/S catPathName 
     2171                        print S_Path + tempname 
     2172                        Open/A/T="????TEXT" refnum as (S_Path + tempname) 
     2173                        FSetPos refnum,478 
     2174                        FBinWrite/F=3/B=3 refNum, x1 
     2175                        FBinWrite/F=3/B=3 refNum, x2 
     2176                        FBinWrite/F=3/B=3 refNum, y1 
     2177                        FBinWrite/F=3/B=3 refNum, y2 
     2178                        //move to the end of the file before closing 
     2179                        FStatus refnum 
     2180                        FSetPos refnum,V_logEOF 
     2181                        Close refnum 
    21692182                else 
    21702183                        //give option to override 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/RectAnnulAvg.ipf

    r41 r47  
    297297                else 
    298298                        //large arg, exact correction 
    299                         aveint[ii] *= uval*arg/(1-exp(-uval*arg)) 
     299                        aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 
    300300                endif 
    301301                ii+=1 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Transmission.ipf

    r40 r47  
    622622//also writes a trans=1 value back to the sample file 
    623623// 
    624 Function fClearSelectedAssignments(startRow,endRow) 
    625         Variable startRow,endRow 
    626  
    627 //      GetSelection table,ScatterFileTable,1 
     624// DEC 2006 - now also writes blank suffix to clear trans->empty assignment, and Twhole=1 
     625// 
     626// target = 1 = ScatterFileTable 
     627// target = 2 = TransFileTable 
     628Function fClearSelectedAssignments(startRow,endRow,target) 
     629        Variable startRow,endRow,target 
    628630         
    629631        Wave/T S_TRANS_Filenames = $"root:myGlobals:TransHeaderInfo:S_TRANS_Filenames" 
     
    632634        Wave/T S_GSuffix = $"root:myGlobals:TransHeaderInfo:S_Suffix" 
    633635        Wave S_GTransmission =  $"root:myGlobals:TransHeaderInfo:S_Transmission" 
     636        Wave/T T_EMP_Filenames = $"root:myGlobals:TransHeaderInfo:T_EMP_Filenames" 
     637        Wave/T T_GFilenames = $"root:myGlobals:TransHeaderInfo:T_Filenames" 
     638        Wave/T T_GSuffix = $"root:myGlobals:TransHeaderInfo:T_Suffix" 
     639        Wave T_GTransmission =  $"root:myGlobals:TransHeaderInfo:T_Transmission" 
     640        Wave T_GTWhole =  $"root:myGlobals:TransHeaderInfo:T_Whole" 
     641         
    634642         
    635643        Variable num_s_files, num_t_files, ii, jj 
    636         Variable refnum 
     644        Variable refnum,zero=0 
    637645        num_t_files = numpnts(T_GFilenames) 
    638646        String suffix = "    "          //4 blank spaces 
     
    641649        String filename 
    642650 
    643 // don't do anything with the trans file -> empty beam file correspondence 
    644  
     651// If the selection is from the TransFileTable 
     652// - wipe out the box coordinates 
     653// - wipe out the suffix 
     654// - wipe out the transmission 
     655// - wipe out T_whole  
     656// - update the waves in the table 
     657 
     658        if(target == 2) 
     659                ii= startRow 
     660                do 
     661                        filename = pathname + T_GFilenames[ii] 
     662                         
     663                        // write in zeros for the box coordinates 
     664                        Open/A/T="????TEXT" refnum as filename 
     665                        FSetPos refnum,478 
     666                        FBinWrite/F=3/B=3 refNum, zero 
     667                        FBinWrite/F=3/B=3 refNum, zero 
     668                        FBinWrite/F=3/B=3 refNum, zero 
     669                        FBinWrite/F=3/B=3 refNum, zero 
     670                        FStatus refnum                                  //move to the end of the file before closing 
     671                        FSetPos refnum,V_logEOF 
     672                        Close refnum 
     673         
     674                        // write in a null suffix 
     675                        Open/A/T="????TEXT" refnum as filename 
     676                        FSetPos refnum,404                      //suffix start byte is 404 
     677                        FBinWrite refnum, suffix 
     678                        FStatus refnum 
     679                        FSetPos refnum,V_logEOF 
     680                        Close refnum 
     681                         
     682                        //write a trans==1 to the file header of the raw data (open/close done in function) 
     683                        ReWriteReal(filename,1,158)             //transmission start byte is 158 
     684                        ReWriteReal(filename,1,392)             //WholeTrans start byte is 392 
     685                         
     686                        //then update the table that is displayed 
     687                        T_EMP_Filenames[ii] = "" 
     688                        T_GTransmission[ii] = 1 
     689                        T_GTWhole[ii] = 1 
     690                         
     691                        ii+=1 
     692                while(ii<=endRow) 
     693        endif 
     694         
    645695//      // Write suffix of empty beam file into transmission files 
    646696//      ii= 0 
     
    666716//      while(ii<num_t_files) 
    667717  
    668         // Write null suffix of transmission files into scattering files 
    669         ii= startRow 
    670         do 
    671                 filename = pathname + S_GFilenames[ii] 
    672                 Open/A/T="????TEXT" refnum as filename 
    673                 //FSetPos refnum,91             //wrong position 
    674                 FSetPos refnum,404 
    675                 FBinWrite refnum, suffix 
    676                 FStatus refnum 
    677                 FSetPos refnum,V_logEOF 
    678                 Close refnum 
    679                  
    680                 //write a trans==1 to the file header of the raw data (open/close done in function) 
    681                 ReWriteReal(filename,1,158)             //transmission start byte is 158 
    682                  
    683                 //then update the table that is displayed 
    684                 S_TRANS_Filenames[ii] = "" 
    685                 S_GTransmission[ii] = 1 
    686                  
    687                 ii+=1 
    688         while(ii<=endRow) 
     718        if(target == 1) 
     719                // Write null suffix of transmission files into scattering files 
     720                ii= startRow 
     721                do 
     722                        filename = pathname + S_GFilenames[ii] 
     723                        Open/A/T="????TEXT" refnum as filename 
     724                        //FSetPos refnum,91             //wrong position 
     725                        FSetPos refnum,404 
     726                        FBinWrite refnum, suffix 
     727                        FStatus refnum 
     728                        FSetPos refnum,V_logEOF 
     729                        Close refnum 
     730                         
     731                        //write a trans==1 to the file header of the raw data (open/close done in function) 
     732                        ReWriteReal(filename,1,158)             //transmission start byte is 158 
     733                         
     734                        //then update the table that is displayed 
     735                        S_TRANS_Filenames[ii] = "" 
     736                        S_GTransmission[ii] = 1 
     737                         
     738                        ii+=1 
     739                while(ii<=endRow) 
     740        endif 
     741         
    689742        return(0) 
    690743End 
     
    21342187Function ClearSelectedAssignments() 
    21352188         
    2136         Variable ii 
    2137         Variable scatterTableExists 
    2138         scatterTableExists = WinType("ScatterFileTable") 
    2139         if (scatterTableExists != 0) 
     2189        String winStr = WinList("*", ";", "WIN:" )              //returns the target window 
     2190        Variable scatterTableExists, transTableExists 
     2191        Print winStr 
     2192        scatterTableExists = cmpstr(winStr,"ScatterFileTable;") 
     2193        if (scatterTableExists == 0) 
    21402194                GetSelection table,ScatterFileTable,1    
    2141                 fClearSelectedAssignments(V_startRow,V_endRow) 
     2195                fClearSelectedAssignments(V_startRow,V_endRow,1) 
    21422196        endif 
     2197         
     2198        transTableExists = cmpstr(winStr,"TransFileTable;") 
     2199        if (transTableExists == 0) 
     2200                GetSelection table,TransFileTable,1      
     2201                fClearSelectedAssignments(V_startRow,V_endRow,2) 
     2202        endif 
     2203         
    21432204        return(0) 
    21442205End 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WorkFileUtils.ipf

    r41 r47  
    399399        while(ii<pixelsX) 
    400400         
     401//      Make/O/N=(pixelsX,pixelsX) SolidAngle 
     402         
    401403        ii=0 
    402404        do 
     
    411413                        domega = rad/dtdist 
    412414                        ratio = domega^3 
     415//                      solidAngle[ii][jj] = ratio                       
    413416                        xy = xx[ii]*yy[jj] 
    414417                        data[ii][jj] *= xy*ratio 
Note: See TracChangeset for help on using the changeset viewer.