Ignore:
Timestamp:
May 25, 2017 1:29:50 PM (6 years ago)
Author:
srkline
Message:

Added the angle dependent transmission correction to the data correction in the raw_to_work step, in 2D

added a testing file that can generate fake event data, read, write, and decode it. Read is based on GBLoadWave. Hoepfully I'll not need to write an XOP. manipulation of the 64 bit words are done with simple bit shifts and logic.

also added are a number of error checking routines to improve behavior when wave, folders, etc. are missing.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
Files:
1 added
11 edited

Legend:

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

    r1040 r1041  
    9595 
    9696#include "V_MultipleReduce" 
    97  
     97#include "V_VSANS_Event_Testing" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf

    r1034 r1041  
    1111// -- add method to be able to write the values to the local folder / or better, to file on disk 
    1212// -- graphically show the beam center / radius of where it is in relation to the panel 
     13// 
     14// x- error checking, if data is selected from a folder that does not exist (like VCALC). Otherwise 
     15//    the user is caught in a long loop of open file dialogs looking for something... 
    1316// 
    1417// -- move everything into it's own folder, rather than root: 
     
    186189        folder = S_Value 
    187190 
     191// error checking -- if the VCALC folder is the target & does not exist, exit now 
     192        if( cmpstr(folder,"VCALC") == 0 && DataFolderExists("root:Packages:NIST:VSANS:VCALC") == 0) 
     193                return(0) 
     194        endif 
     195 
     196// error checking -- if the RAW folder is the target & does not exist, exit now 
     197        if( cmpstr(folder,"RAW") == 0 && DataFolderExists("root:Packages:NIST:VSANS:RAW:entry") == 0) 
     198                return(0) 
     199        endif 
     200 
     201// error checking -- if the SAM folder is the target & does not exist, exit now 
     202        if( cmpstr(folder,"SAM") == 0 && DataFolderExists("root:Packages:NIST:VSANS:SAM:entry") == 0) 
     203                return(0) 
     204        endif 
     205                 
    188206        // TODO -- fix all of this mess 
    189207        if(cmpstr(folder,"VCALC") == 0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BroadPeak_Pix_2D.ipf

    r1024 r1041  
    6969End 
    7070 
     71 
     72// 
     73// this sets the x and y waves of the triplet to be the pixel numbers 
     74// 
     75// TODO: 
     76// -- this will need to be changed if I want to fit based on real-space mm 
     77// 
    7178Function V_FillPixTriplet(xwave_PeakPix2D, ywave_PeakPix2D,zwave_PeakPix2D,xDim,yDim) 
    7279        Wave xwave_PeakPix2D, ywave_PeakPix2D,zwave_PeakPix2D 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf

    r1027 r1041  
    676676        // TODO: 
    677677        // correctly apply the correction to the error wave (assume a perfect value?) 
    678         // w_err /= solid_angle         //is this correct?? 
     678        w_err /= solid_angle            //is this correct?? 
    679679 
    680680// TODO -- clean up after I'm satisfied computations are correct                 
     
    793793                                 
    794794                                // pass in the transmission error, and the error in the correction is returned as the last parameter 
    795                                 lat_corr = V_LargeAngleTransmissionCorr(trans,dtdist,xd,yd,trans_err,lat_err)           //moved from 1D avg SRK 11/2007 
     795 
     796//                              lat_corr = V_LargeAngleTransmissionCorr(trans,dtdist,xd,yd,trans_err,lat_err)           //moved from 1D avg SRK 11/2007 
     797 
    796798                                data[ii][jj] /= lat_corr                        //divide by the correction factor 
    797799                                // 
     
    822824 
    823825 
    824  
     826// 
    825827// DIVIDE the intensity by this correction to get the right answer 
    826828// TODO: 
     
    828830// 
    829831// 
    830 Function V_LargeAngleTransmissionCorr(trans,dtdist,xd,yd,trans_err,err) 
    831         Variable trans,dtdist,xd,yd,trans_err,&err 
    832  
    833         DoAlert 0,"This has not yet been updated for VSANS" 
    834          
    835         //angle dependent transmission correction  
    836         Variable uval,arg,cos_th,correction,theta 
    837          
    838         ////this section is the trans_correct() VAX routine 
    839 //      if(trans<0.1) 
    840 //              Print "***transmission is less than 0.1*** and is a significant correction" 
    841 //      endif 
    842 //      if(trans==0) 
    843 //              Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 
    844 //              trans = 1 
    845 //      endif 
    846          
    847         theta = atan( (sqrt(xd^2 + yd^2))/dtdist )              //theta at the input pixel 
     832 
     833// Apply the large angle transmssion correction as the data is converted to WORK 
     834// so that whether the data is saved as 2D or 1D, the correction has properly been done. 
     835// 
     836// This is, however, a SAMPLE dependent calculation, not purely instrument geometry. 
     837// 
     838Function V_LargeAngleTransmissionCorr(w,w_err,fname,detStr,destPath) 
     839        Wave w,w_err 
     840        String fname,detStr,destPath 
     841 
     842        Variable sdd,xCtr,yCtr,trans,trans_err,uval 
     843 
     844// get all of the geometry information   
     845//      orientation = V_getDet_tubeOrientation(fname,detStr) 
     846        sdd = V_getDet_ActualDistance(fname,detStr) 
     847        sdd/=100                // sdd in cm, pass in m 
     848 
     849        // this is ctr in mm 
     850        xCtr = V_getDet_beam_center_x_mm(fname,detStr) 
     851        yCtr = V_getDet_beam_center_y_mm(fname,detStr) 
     852        trans = V_getSampleTransmission(fname) 
     853        trans_err = V_getSampleTransError(fname) 
     854         
     855        SetDataFolder $(destPath + ":entry:instrument:detector_"+detStr) 
     856         
     857        Wave data_realDistX = data_realDistX 
     858        Wave data_realDistY = data_realDistY 
     859 
     860        Duplicate/O w lat_corr,tmp_theta,tmp_dist,lat_err,tmp_err               //in the current df 
     861 
     862//// calculate the scattering angle 
     863//      dx = (distX - xctr)             //delta x in mm 
     864//      dy = (distY - yctr)             //delta y in mm 
     865        tmp_dist = sqrt((data_realDistX - xctr)^2 + (data_realDistY - yctr)^2) 
     866         
     867        tmp_dist /= 10  // convert mm to cm 
     868        sdd *=100               //convert to cm 
     869 
     870        tmp_theta = atan(tmp_dist/sdd)          //this is two_theta, the scattering angle 
     871 
     872        Variable ii,jj,numx,numy,dx,dy,cos_th,arg,tmp 
     873        numx = DimSize(tmp_theta,0) 
     874        numy = DimSize(tmp_theta,1) 
     875         
    848876         
    849877        //optical thickness 
    850878        uval = -ln(trans)               //use natural logarithm 
    851         cos_th = cos(theta) 
    852         arg = (1-cos_th)/cos_th 
    853          
    854         // a Taylor series around uval*arg=0 only needs about 4 terms for very good accuracy 
    855         //                      correction= 1 - 0.5*uval*arg + (uval*arg)^2/6 - (uval*arg)^3/24 + (uval*arg)^4/120 
    856         // OR 
    857         if((uval<0.01) || (cos_th>0.99))         
    858                 //small arg, approx correction 
    859                 correction= 1-0.5*uval*arg 
    860         else 
    861                 //large arg, exact correction 
    862                 correction = (1-exp(-uval*arg))/(uval*arg) 
    863         endif 
    864  
    865         Variable tmp 
    866          
    867         if(trans == 1) 
    868                 err = 0         //no correction, no error 
    869         else 
    870                 //sigT, calculated from the Taylor expansion 
    871                 tmp = (1/trans)*(arg/2-arg^2/3*uval+arg^3/8*uval^2-arg^4/30*uval^3) 
    872                 tmp *= tmp 
    873                 tmp *= trans_err^2 
    874                 tmp = sqrt(tmp)         //sigT 
    875                  
    876                 err = tmp 
    877         endif 
    878          
    879 //      Printf "trans error = %g\r",trans_err 
    880 //      Printf "correction = %g +/- %g\r", correction, err 
    881          
    882         //end of transmission/pathlength correction 
    883  
    884         return(correction) 
     879         
     880        for(ii=0        ;ii<numx;ii+=1) 
     881                for(jj=0;jj<numy;jj+=1) 
     882                         
     883                        cos_th = cos(tmp_theta[ii][jj]) 
     884                        arg = (1-cos_th)/cos_th 
     885                         
     886                        // a Taylor series around uval*arg=0 only needs about 4 terms for very good accuracy 
     887                        //                      correction= 1 - 0.5*uval*arg + (uval*arg)^2/6 - (uval*arg)^3/24 + (uval*arg)^4/120 
     888                        // OR 
     889                        if((uval<0.01) || (cos_th>0.99))         
     890                                //small arg, approx correction 
     891                                lat_corr[ii][jj] = 1-0.5*uval*arg 
     892                        else 
     893                                //large arg, exact correction 
     894                                lat_corr[ii][jj] = (1-exp(-uval*arg))/(uval*arg) 
     895                        endif 
     896                          
     897                        // TODO 
     898                        // -- properly calculate and apply the 2D error propagation 
     899                        if(trans == 1) 
     900                                lat_err[ii][jj] = 0             //no correction, no error 
     901                        else 
     902                                //sigT, calculated from the Taylor expansion 
     903                                tmp = (1/trans)*(arg/2-arg^2/3*uval+arg^3/8*uval^2-arg^4/30*uval^3) 
     904                                tmp *= tmp 
     905                                tmp *= trans_err^2 
     906                                tmp = sqrt(tmp)         //sigT 
     907                                 
     908                                lat_err[ii][jj] = tmp 
     909                        endif 
     910                          
     911  
     912                endfor 
     913        endfor 
     914         
     915 
     916         
     917        // Here it is! Apply the correction to the intensity (divide -- to get the proper correction) 
     918        w /= lat_corr 
     919 
     920        // relative errors add in quadrature to the current 2D error 
     921        tmp_err = (w_err/lat_corr)^2 + (lat_err/lat_corr)^2*w*w/lat_corr^2 
     922        tmp_err = sqrt(tmp_err) 
     923         
     924        w_err = tmp_err  
     925         
     926        // TODO: 
     927        // correctly apply the correction to the error wave (assume a perfect value?) 
     928        // w_err /= tmp         //is this correct?? 
     929 
     930        // TODO -- clean up after I'm satisfied computations are correct                 
     931        KillWaves/Z tmp_theta,tmp_dist,tmp_err,lat_err 
     932         
     933        return(0) 
    885934end 
    886935 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf

    r1040 r1041  
    63736373// TODO -- needs to be a Text WAVE, and of the proper size and type!!! 
    63746374//  -- this is a test where I write a wave to a field that does not exist... 
    6375 Function V_write_ProtocolWave(fname,inTW) 
     6375Function V_writeReductionProtocolWave(fname,inTW) 
    63766376        String fname 
    63776377        Wave/T inTW 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf

    r1040 r1041  
    7979End 
    8080 
     81Proc Patch_XY_MainButtonProc(ctrlName) : ButtonControl 
     82        String ctrlName 
     83 
     84        V_PatchDet_xyCenters_Panel() 
     85End 
     86 
     87Proc Patch_DeadTime_MainButtonProc(ctrlName) : ButtonControl 
     88        String ctrlName 
     89 
     90        V_PatchDetectorDeadtimePanel() 
     91End 
     92 
     93Proc Patch_Calib_MainButtonProc(ctrlName) : ButtonControl 
     94        String ctrlName 
     95 
     96        V_PatchDetectorCalibrationPanel() 
     97End 
     98 
     99 
    81100Proc TransMainButtonProc(ctrlName) : ButtonControl 
    82101        String ctrlName 
     
    114133 
    115134//      ShowNSORTPanel() 
     135         
     136End 
     137 
     138Proc Combine1D_MainButtonProc(ctrlName) : ButtonControl 
     139        String ctrlName 
     140 
     141//      ShowCombinePanel() 
    116142        V_CombineDataGraph() 
    117 End 
    118  
    119 Proc Combine1D_MainButtonProc(ctrlName) : ButtonControl 
    120         String ctrlName 
    121  
    122         ShowCombinePanel() 
    123143End 
    124144 
     
    360380        Button MainButton_0e,pos={15,210},size={130,20},proc=CatSort_MainButtonProc,title="Sort Catalog" 
    361381        Button MainButton_0e,help={"Sort the Data Catalog, courtesy of ANSTO"} 
    362         Button MainButton_0f,pos={170,90},size={90,20},proc=DataTree_MainButtonProc,title="Data Tree" 
     382        Button MainButton_0f,pos={300,90},size={90,20},proc=DataTree_MainButtonProc,title="Data Tree" 
    363383        Button MainButton_0f,help={"Show the header and data tree"} 
    364384        Button MainButton_0g,pos={170,180},size={110,20},proc=RTReduce_MainButtonProc,title="RT Reduction" 
    365385        Button MainButton_0g,help={"Reduce live (incomplete) data files during acquisition"} 
    366  
     386        Button MainButton_0h,pos={170,90},size={90,20},proc=Patch_XY_MainButtonProc,title="Patch XY" 
     387        Button MainButton_0h,help={"Patch will update incorrect information in raw data headers"} 
     388        Button MainButton_0i,pos={170,120},size={110,20},proc=Patch_DeadTime_MainButtonProc,title="Patch DeadTime" 
     389        Button MainButton_0i,help={"Patch will update incorrect information in raw data headers"} 
     390        Button MainButton_0j,pos={170,150},size={90,20},proc=Patch_Calib_MainButtonProc,title="Patch Calib" 
     391        Button MainButton_0j,help={"Patch will update incorrect information in raw data headers"} 
    367392 
    368393//on tab(1) - Reduction 
     
    383408        Button MainButton_2a,pos={15,90},size={60,20},proc=Plot1D_MainButtonProc,title="Plot" 
    384409        Button MainButton_2a,help={"Loads and plots a 1-D dataset in the format expected by \"FIT\""} 
    385         Button MainButton_2b,pos={15,120},size={60,20},proc=Sort1D_MainButtonProc,title="Sort" 
    386         Button MainButton_2b,help={"Sorts and combines 2 or 3 separate 1-D datasets into a single file. Use \"Plot\" button to import 1-D data files"} 
     410//      Button MainButton_2b,pos={15,120},size={60,20},proc=Sort1D_MainButtonProc,title="Sort" 
     411//      Button MainButton_2b,help={"Sorts and combines 2 or 3 separate 1-D datasets into a single file. Use \"Plot\" button to import 1-D data files"} 
    387412        Button MainButton_2c,pos={15,150},size={60,20},proc=Fit1D_MainButtonProc,title="FIT" 
    388413        Button MainButton_2c,help={"Shows panel for performing a variety of linearized fits to 1-D data files. Use \"Plot\" button to import 1-D data files"} 
     
    396421        Button MainButton_2f,help={"Shows panel for batch combination of 1D data files. Use after you're comfortable with NSORT"} 
    397422        Button MainButton_2a,disable=1 
    398         Button MainButton_2b,disable=1 
     423//      Button MainButton_2b,disable=1 
    399424        Button MainButton_2c,disable=1 
    400425//      Button MainButton_2d,disable=1 
     
    411436        Button MainButton_3c,pos={15,150},size={90,20},proc=ReadMask_MainButtonProc,title="Read Mask" 
    412437        Button MainButton_3c,help={"Reads a mask file into the proper work folder, and displays a small image of the mask. Yellow areas will be excluded from the data"} 
    413         Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=ShowTilePanel_MainButtonProc 
    414         Button MainButton_3d,help={"Adds selected RAW data files to a layout."} 
     438//      Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=ShowTilePanel_MainButtonProc 
     439//      Button MainButton_3d,help={"Adds selected RAW data files to a layout."} 
    415440        Button MainButton_3e,pos={150,90},size={100,20},title="Copy Work",proc=CopyWork_MainButtonProc 
    416441        Button MainButton_3e,help={"Copies WORK data from specified folder to destination folder."} 
    417         Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=WorkMath_MainButtonProc 
    418         Button MainButton_3f,help={"Perfom simple math operations on workfile data"} 
     442//      Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=WorkMath_MainButtonProc 
     443//      Button MainButton_3f,help={"Perfom simple math operations on workfile data"} 
    419444        Button MainButton_3g,pos={150,180},size={100,20},title="Event Data",proc=Event_MainButtonProc 
    420445        Button MainButton_3g,help={"Manipulate TISANE Timeslice data"} 
     
    423448        Button MainButton_3b,disable=1 
    424449        Button MainButton_3c,disable=1 
    425         Button MainButton_3d,disable=1 
     450//      Button MainButton_3d,disable=1 
    426451        Button MainButton_3e,disable=1 
    427         Button MainButton_3f,disable=1 
     452//      Button MainButton_3f,disable=1 
    428453        Button MainButton_3g,disable=1 
    429454 
     
    431456        Button MainButton_4a,pos={15,90},size={80,20},proc=Draw3D_MainButtonProc,title="3D Display" 
    432457        Button MainButton_4a,help={"Plots a 3-D surface of the selected file type"} 
    433         Button MainButton_4b,pos={15,120},size={120,20},proc=ShowSchematic_MainButtonProc,title="Show Schematic" 
    434         Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"} 
    435         Button MainButton_4c,pos={15,150},size={80,20},proc=ShowAvePanel_MainButtonProc,title="Average" 
    436         Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"} 
     458//      Button MainButton_4b,pos={15,120},size={120,20},proc=ShowSchematic_MainButtonProc,title="Show Schematic" 
     459//      Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"} 
     460//      Button MainButton_4c,pos={15,150},size={80,20},proc=ShowAvePanel_MainButtonProc,title="Average" 
     461//      Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"} 
    437462//      Button MainButton_4d,pos={15,180},size={110,20},proc=CatShort_MainButtonProc,title="CAT/Notebook" 
    438463//      Button MainButton_4d,help={"This will generate a CATalog notebook of all files in a specified local folder"} 
     
    441466        Button MainButton_4f,pos={180,120},size={130,20},proc=PRODIV_MainButtonProc,title="Make DIV file" 
    442467        Button MainButton_4f,help={"Merges two stored workfiles (CORrected) into a DIV file, and saves the result"} 
    443         Button MainButton_4g,pos={180,150},size={130,20},proc=Raw2ASCII_MainButtonProc,title="RAW ASCII Export" 
    444         Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"} 
     468//      Button MainButton_4g,pos={180,150},size={130,20},proc=Raw2ASCII_MainButtonProc,title="RAW ASCII Export" 
     469//      Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"} 
    445470        Button MainButton_4h,pos={180,180},size={130,20},proc=Preferences_MainButtonProc,title="Preferences" 
    446471        Button MainButton_4h,help={"Sets user preferences for selected parameters"} 
    447472         
    448473        Button MainButton_4a,disable=1 
    449         Button MainButton_4b,disable=1 
    450         Button MainButton_4c,disable=1 
     474//      Button MainButton_4b,disable=1 
     475//      Button MainButton_4c,disable=1 
    451476//      Button MainButton_4d,disable=1 
    452477//      Button MainButton_4e,disable=1 
    453478        Button MainButton_4f,disable=1 
    454         Button MainButton_4g,disable=1 
     479//      Button MainButton_4g,disable=1 
    455480        Button MainButton_4h,disable=1 
    456481//       
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf

    r1034 r1041  
    5656                // this function will modify the x and y values (passed by reference) as needed to keep on the panel 
    5757                V_KeepSelectionInBounds(x1,x2,y1,y2,detStr,gCurDispType) 
    58                 Print x1,x2,y1,y2 
     58                Printf "%d;%d;%d;%d;\r",x1,x2,y1,y2 
    5959 
    6060 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf

    r1040 r1041  
    27872787        endif 
    27882788 
    2789         V_write_ProtocolWave(fileName,$("root:Packages:NIST:VSANS:Globals:Protocols:"+Protocol) ) 
     2789        V_writeReductionProtocolWave(fileName,$("root:Packages:NIST:VSANS:Globals:Protocols:"+Protocol) ) 
    27902790 
    27912791        setDataFolder root: 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf

    r1039 r1041  
    170170        TitleBox title_status,pos={606,240},size={200,200},variable= root:Packages:NIST:VSANS:Globals:gStatusText 
    171171         
    172         Button button_tagFile,pos={603,412},size={70,20},proc=V_TagFileButtonProc,title="Tag File" 
    173         Button button_tagFile,disable=2 
    174         Button button_saveIQ,pos={720,412},size={70,20},proc=V_SaveIQ_ButtonProc,title="Save I(Q)" 
     172//      Button button_tagFile,pos={720,412},size={70,20},proc=V_TagFileButtonProc,title="Tag File" 
     173//      Button button_tagFile,disable=2 
     174        Button button_saveIQ,pos={603,412},size={70,20},proc=V_SaveIQ_ButtonProc,title="Save I(Q)" 
    175175        Button button_BeamCtr,pos={603,450},size={70,20},proc=V_BeamCtrButtonProc,title="Beam Ctr" 
    176176        Button button_SpreadPanels,pos={603,488},size={100,20},proc=V_SpreadPanelButtonProc,title="Spread Panels" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf

    r1036 r1041  
    66// TODO 
    77//-- initialization 
    8 // -- link to main panel 
     8// x- link to main panel 
    99// 
    1010// ?? redesign the panel based on the CATALOG? 
     
    2323Window V_TransmissionPanel() : Panel 
    2424        PauseUpdate; Silent 1           // building window... 
    25         NewPanel /W=(823,45,1301,669) 
     25        NewPanel /W=(1286,328,1764,952) 
    2626        ModifyPanel cbRGB=(32896,16448,0,19621) 
    2727        DoWindow/C V_TransmissionPanel 
     
    2929//      ShowTools/A 
    3030        PopupMenu popup_0,pos={19.00,55.00},size={86.00,23.00},proc=V_TSamFilePopMenuProc,title="Sample" 
    31         PopupMenu popup_0,mode=1,value= V_getFileIntentList("SAMPLE",0) 
    32         PopupMenu popup_1,pos={98.00,166.00},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 
     31        PopupMenu popup_0,mode=1,value= V_getFileIntentList("SAMPLE",0)+V_getFileIntentList("EMPTY CELL",0) 
     32        PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 
    3333        PopupMenu popup_1,mode=1,value= V_getFileIntentList("TRANSMISSION",0) 
    34         PopupMenu popup_2,pos={160.00,271.00},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Empty Beam" 
     34        PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Empty Beam" 
    3535        PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",0) 
    36         Button button_0,pos={22.00,397.00},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 
     36        Button button_0,pos={37,193},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 
    3737//      Button button_1,pos={23.00,491.00},size={100.00,20.00},proc=V_WriteTransmButtonProc,title="Write" 
    3838        Button button_2,pos={349.00,13.00},size={30.00,20.00},proc=V_HelpTransmButtonProc,title="?" 
     
    4242        SetVariable setvar_1,pos={21.00,113.00},size={300.00,14.00},title="Group ID:" 
    4343        SetVariable setvar_1,limits={-inf,inf,0},value= VSANS_RED_VERSION 
    44         SetVariable setvar_2,pos={101.00,194.00},size={300.00,14.00},title="Label:" 
     44        SetVariable setvar_2,pos={105,276.00},size={300.00,14.00},title="Label:" 
    4545        SetVariable setvar_2,limits={-inf,inf,0},value= _STR:"file label" 
    46         SetVariable setvar_3,pos={100.00,220.00},size={300.00,14.00},title="Group ID:" 
     46        SetVariable setvar_3,pos={104,302},size={300.00,14.00},title="Group ID:" 
    4747        SetVariable setvar_3,limits={-inf,inf,0},value= VSANS_RED_VERSION 
    48         SetVariable setvar_4,pos={161.00,300.00},size={300.00,14.00},title="Label:" 
     48        SetVariable setvar_4,pos={165,382},size={300.00,14.00},title="Label:" 
    4949        SetVariable setvar_4,limits={-inf,inf,0},value= _STR:"file label" 
    50         SetVariable setvar_5,pos={161.00,324.00},size={300.00,14.00},title="XY Box:" 
     50        SetVariable setvar_5,pos={165,406},size={300.00,14.00},title="XY Box:" 
    5151        SetVariable setvar_5,limits={-inf,inf,0},value= _STR:"dummy" 
    52         SetVariable setvar_6,pos={159.00,349.00},size={300.00,14.00},title="Panel:" 
     52        SetVariable setvar_6,pos={165,431},size={300.00,14.00},title="Panel:" 
    5353        SetVariable setvar_6,limits={-inf,inf,0},value= _STR:"dummy" 
    54         SetVariable setvar_7,pos={24.00,426.00},size={300.00,14.00},title="Transmission:" 
     54        SetVariable setvar_7,pos={21,138},size={300.00,14.00},title="Transmission:" 
    5555        SetVariable setvar_7,limits={-inf,inf,0},value= VSANS_RED_VERSION 
    56         SetVariable setvar_8,pos={25.00,448.00},size={300.00,14.00},title="Error:" 
     56        SetVariable setvar_8,pos={21,163},size={300.00,14.00},title="Error:" 
    5757        SetVariable setvar_8,limits={-inf,inf,0},value= VSANS_RED_VERSION 
    5858EndMacro 
     
    115115 
    116116                // now loop back through to find the empty beam file 
    117                 // TODO x- fill in the XY box 
    118                 // --  Panel field is hard wired... 
     117                // TODO  
     118                // x- fill in the XY box 
     119                // --  Detector Panel field is hard-wired for "B" 
    119120                //       
    120121                        WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 
     
    195196// TODO 
    196197// -- figure out which detector corrections are necessary to do on loading 
    197 // data for calcualtion. Then set/reset preferences accordingly 
     198// data for calculation. Then set/reset preferences accordingly 
    198199// (see V_isoCorrectButtonProc() for example of how to do this) 
    199200// 
     
    202203// -- solid angle (turn off ?) 
    203204// -- dead time (keep on?) 
     205// 
     206// -- once calculated, update the Transmission panel 
     207// -- update the data file 
     208// -- update the CATALOG (and/or delete the RawVSANS to force a re-read) 
    204209// 
    205210Function V_CalcTransmButtonProc(ba) : ButtonControl 
     
    233238                        trans = V_getSampleTransmission(fileName) 
    234239                        trans_err = V_getSampleTransError(fileName) 
    235                         // TODO 
    236                         // -- this criteria is rather crude. think it through better 
    237                         if(trans != 0 && trans < 1 && trans_err != 0) 
    238                                 Printf "Sample transmission, error = %g +/- %g   already exists, nothing calculated\r",trans,trans_err 
    239                                 break 
    240                         endif 
     240//                      // TODO 
     241//                      // -- this criteria is rather crude. think it through better 
     242//                      // -- or should I simply let it overwrite? What is the harm in that? 
     243//                      if(trans != 0 && trans < 1 && trans_err != 0) 
     244//                              Printf "Sample transmission, error = %g +/- %g   already exists, nothing calculated\r",trans,trans_err 
     245//                              break 
     246//                      endif 
    241247                         
    242248                // for empty beam 
     
    258264                        // -- this criteria is rather crude. think it through better 
    259265                        if(emptyCts > 1 && empty_ct_err != 0) 
    260                                 Printf "Empty beam box counts, error = %g +/- %g   already exists, nothing calculated\r",emptyCts,empty_ct_err 
     266                                Printf "Empty beam box counts, error = %g +/- %g   already exists, box counts not re-calculated\r",emptyCts,empty_ct_err 
    261267                                 
    262268                        else 
     
    351357                         
    352358                        // TODO 
    353                         // (update the value displayed in the table?) 
    354                         // (update the local value?) 
     359                        // -- update the value displayed in the panel  
     360                        // -- update the local value in the file catalog 
     361                        // -- delete the file from RawVSANS to force a re-read? 
     362//                      SetVariable setvar_7,value= trans 
     363//                      SetVariable setvar_8,value= trans_err 
     364//                      DoUpdate/W=V_TransmissionPanel 
    355365                         
    356366                         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf

    r1031 r1041  
    538538        // (6) angle dependent transmission correction 
    539539        // TODO: 
    540         // -- this still needs to be filled in 
     540        // x- this still needs to be filled in 
    541541        // -- still some debate of when/where in the corrections that this is best applied 
    542542        //    - do it here, and it's done whether the output is 1D or 2D 
    543543        //    - do it later (where SAMPLE information is used) since this section is ONLY instrument-specific 
     544        // -- verify that the calculation is correct 
     545        // -- verify that the error propagation (in 2D) is correct 
     546        // 
    544547        NVAR gDoTrans = root:Packages:NIST:VSANS:Globals:gDoTransmissionCor 
    545548        if (gDoTrans == 1) 
    546                 Print "(stub)Doing Large-angle transmission correction -- INCOMPLETE FUNCTION "// for "+ detStr 
     549                Print "Doing Large-angle transmission correction"// for "+ detStr 
    547550                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    548551                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    550553                        Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    551554                         
    552 //                      V_TransmissionCorrection(fill this in) 
     555                        V_LargeAngleTransmissionCorr(w,w_err,fname,detStr,destPath) 
    553556                         
    554557                endfor 
Note: See TracChangeset for help on using the changeset viewer.