Changeset 1061 for sans/Dev


Ignore:
Timestamp:
Aug 23, 2017 10:03:41 AM (6 years ago)
Author:
srkline
Message:

Added USANS loader/initializer

Updated units of distance for q-calculation (SDD)

status display bug fixed

Location:
sans/Dev/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_Igor_Procedures/NCNR_Package_Loader.ipf

    r1017 r1061  
    5151        "Load Simulation Run Builder",SimSANSRunListLoader() 
    5252        "Automated SANS Reduction - Beta",AutomateSANSLoader() 
     53        "-" 
     54        "Load VSANS Procedures",VSANSLoader() 
    5355 
    5456//      "-" 
     
    750752        return(0) 
    751753End 
     754 
     755 
     756// loads the VSANS package and initializes 
     757Function VSANSLoader() 
     758         
     759        Execute/P "INSERTINCLUDE \"VSANS_Includes\"" 
     760        Execute/P "COMPILEPROCEDURES " 
     761        Execute/P "Initialize_VSANS()" 
     762         
     763        BuildMenu "Macros" 
     764 
     765        return(0) 
     766End 
     767 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DIVUtils.ipf

    r1043 r1061  
    2828//   the normalization will be way off -- and the "active" area will end up much larger  
    2929//   than it should be - since the wings of the detector are mostly zero... 
     30//   ? Can I apply a mask, or will the detectors be set in a different configuration? 
    3031// 
    3132// 
     
    3839// -- expand this to do a basic renormalization of all 9 panels, and move the data into the  
    3940//    appropriate locations for saving as a DIV file. 
    40 // 
     41// x- (YES, done) what about error propogation? Can I store the error in the data file? 
     42//    Makes a difference if the DIV is not collected for long "enough". 
     43// x- then I need to be able to read the error in (done) 
    4144// 
    4245 
     
    4649// -- next, V_NormalizeDIV() 
    4750// -- then Setup_VSANS_DIV_Struct() 
    48 // -- next, V_CopyDIVToSave() 
     51// -- next, V_CopyDIVToSave() -or- V_CopyDIVToSave_OnePanel() 
    4952// -- last, Save_VSANS_DIV_Nexus()  
    50  
     53// 
    5154 
    5255 
     
    6063// TODO 
    6164// -- data should be copied to some alternate work folder before this step 
     65// -- for T/B detectors, this may not work as intended if the whole detector is not illuminated. 
     66//    How to handle? A mask? 
     67// x- is this the correct calculation of the error? (YES) It should be correct up to this point since the 
     68//    standard reduction has been used, but now the normalization step is a multiplication 
     69//    by a constant (w/no error). Be sure this error transformation is correct. (YES - this is correct, and is 
     70//    what is done in SANS) 
    6271// 
    6372Function V_NormalizeDIV(type) 
     
    7483                pixelY = V_getDet_pixel_num_y(type,detStr) 
    7584 
    76                 totCts=sum(w,Inf,-Inf)          //sum all of the data 
     85                totCts = sum(w,Inf,-Inf)                //sum all of the data 
    7786                 
    7887                w /= totCts 
     
    8897 
    8998 
    90  
     99// copies an entire work folder, all 9 detectors (at COR level) 
     100// to the DIV structure to write out 
     101// 
    91102Function V_CopyDIVToSave(type) 
    92103        String type 
     
    109120End 
    110121 
     122// 
     123// copies only the specified panel from a work folder, (at COR level) 
     124// to the DIV structure to write out 
     125// 
     126// used to replace a single panel, or to fill in carriage by carriage. 
     127// 
     128Function V_CopyDIVToSave_OnePanel(type,detStr) 
     129        String type,detStr 
     130         
     131        Variable ii,totCts,pixelX,pixelY 
     132        String topath = "root:VSANS_DIV_file:entry:instrument:detector_" 
     133        String fromPath = "root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_" 
     134         
     135         
     136                Duplicate/O $(fromPath+detStr+":data") $(toPath+detStr+":data") 
     137                Duplicate/O $(fromPath+detStr+":linear_data_error") $(toPath+detStr+":linear_data_error") 
     138                         
     139        return(0) 
     140End 
    111141 
    112142 
     
    170200// 
    171201// TODO -- make the number of pixels GLOBAL 
    172 // TODO -- there will be lots of work to do to develop the procedures necessary to actually generate the  
    173 //      9 data sets to become the DIV file contents. More complexity here than for the simple SANS case. 
    174202// 
    175203Proc H_Setup_VSANS_DIV_Structure() 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf

    r1055 r1061  
    565565 
    566566        sdd = V_getDet_ActualDistance(fname,detStr)             //sdd derived, including setback [cm] 
    567         sdd/=100                // sdd reported in cm, pass in m 
     567 
    568568        // this is the ctr in pixels --xx-- (now it is in cm!) 
    569569//      xCtr = V_getDet_beam_center_x(fname,detStr) 
     
    587587 
    588588// calculate all of the q-values 
     589// sdd is passed in [cm] 
    589590        qTot = V_CalcQval(p,q,xCtr,yCtr,sdd,lambda,data_realDistX,data_realDistY) 
    590591        qx = V_CalcQX(p,q,xCtr,yCtr,sdd,lambda,data_realDistX,data_realDistY) 
     
    605606//    to each pixel 
    606607// 
    607 //sdd is in meters 
     608//sdd is in [cm] 
     609// distX and distY are in [mm] 
    608610//wavelength is in Angstroms 
    609611// 
     
    616618        Variable dx,dy,qval,two_theta,dist 
    617619                 
    618         sdd *=100               //convert to cm 
     620 
    619621        dx = (distX[xaxval][yaxval] - xctr)             //delta x in mm 
    620622        dy = (distY[xaxval][yaxval] - yctr)             //delta y in mm 
     
    648650        qval = V_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) 
    649651         
    650         sdd *=100               //convert to cm 
     652 
    651653        dx = (distX[xaxval][yaxval] - xctr)             //delta x in mm 
    652654        dy = (distY[xaxval][yaxval] - yctr)             //delta y in mm 
     
    682684        qval = V_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) 
    683685         
    684         sdd *=100               //convert to cm 
     686 
    685687        dx = (distX[xaxval][yaxval] - xctr)             //delta x in mm 
    686688        dy = (distY[xaxval][yaxval] - yctr)             //delta y in mm 
     
    717719        qval = V_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) 
    718720         
    719         sdd *=100               //convert to cm 
     721 
    720722        dx = (distX[xaxval][yaxval] - xctr)             //delta x in mm 
    721723        dy = (distY[xaxval][yaxval] - yctr)             //delta y in mm 
     
    755757//      orientation = V_getDet_tubeOrientation(fname,detStr) 
    756758        sdd = V_getDet_ActualDistance(fname,detStr) 
    757         sdd/=100                // sdd in cm, pass in m 
     759 
    758760 
    759761        // this is ctr in mm 
     
    775777         
    776778        tmp_dist /= 10  // convert mm to cm 
    777         sdd *=100               //convert to cm 
     779        // sdd is in [cm] 
    778780 
    779781        tmp_theta = atan(tmp_dist/sdd)          //this is two_theta, the scattering angle 
     
    988990//      orientation = V_getDet_tubeOrientation(fname,detStr) 
    989991        sdd = V_getDet_ActualDistance(fname,detStr) 
    990         sdd/=100                // sdd in cm, pass in m 
    991992 
    992993        // this is ctr in mm 
     
    10091010         
    10101011        tmp_dist /= 10  // convert mm to cm 
    1011         sdd *=100               //convert to cm 
     1012        // sdd is in [cm] 
    10121013 
    10131014        tmp_theta = atan(tmp_dist/sdd)          //this is two_theta, the scattering angle 
     
    12831284// 
    12841285// TODO: 
    1285 //   --         DoAlert 0,"This has not yet been updated for VSANS" 
    1286 //   -- how is the error propagation handled? 
     1286//   x-         DoAlert 0,"This has not yet been updated for VSANS" 
     1287//   -- how is the error propagation handled? Be sure it is calculated correctly when DIV is generated 
     1288//      and is applied correctly here... 
    12871289// 
    12881290//function will divide the contents of "workType" folder with the contents of  
     
    13141316 
    13151317        data /= div_data 
    1316          
     1318 
     1319// TODO: -- correct the error propagation        
    13171320        data_err /= div_data 
    13181321         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf

    r1055 r1061  
    15391539End 
    15401540 
     1541// return value in [cm] 
    15411542Function V_getDet_NominalDistance(fname,detStr) 
    15421543        String fname,detStr 
     
    15471548 
    15481549//this is a DERIVED distance, since the nominal sdd is for the carriage (=LR panels) 
     1550// return value in [cm] 
    15491551Function V_getDet_ActualDistance(fname,detStr) 
    15501552        String fname,detStr 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf

    r1059 r1061  
    401401                                        yctr = V_getDet_beam_center_y_mm(gCurDispType,detStr)    
    402402                                         
    403                                         sdd = V_getDet_ActualDistance(gCurDispType,detStr)      / 100   //written in cm, pass in meters 
     403                                        sdd = V_getDet_ActualDistance(gCurDispType,detStr)              //written in cm, pass in [cm] 
    404404                                        lam = V_getWavelength(gCurDispType)             //A 
    405405//                                      pixSizeX = V_getDet_x_pixel_size(gCurDispType,detStr)           // written mm? need mm 
     
    769769// now part of every tab click 
    770770//// update the status when the tab is clicked                   
    771 //                      STRUCT WMButtonAction sa 
    772 //                      sa.eventCode = 2 
    773 //                      V_StatusButtonProc(sa) 
     771                        STRUCT WMButtonAction sa 
     772                        sa.eventCode = 2 
     773                        V_StatusButtonProc(sa) 
    774774 
    775775                        break 
     
    900900                        Variable curTab = V_value 
    901901                         
     902//                      // fake this, since if the tab was clicked, it hasn't been updated yet and we're off by one 
     903//                      if(ba.eventCode == 3) 
     904//                              curTab += 1 
     905//                              if(curTab == 3) 
     906//                                      curTab = 0 
     907//                              endif 
     908//                      endif 
     909                         
     910                        // 
    902911                        str = "Current data is from "+ type + "\r" 
    903912                        str += "Description = "+V_getSampleDescription(type) + "\r" 
Note: See TracChangeset for help on using the changeset viewer.