Ignore:
Timestamp:
May 9, 2017 1:56:29 PM (5 years ago)
Author:
srkline
Message:

Adding procedures to allow trimming of data sets before concatenation. This is different than SANS, since the trimming and scaling choices must be made before reduction is done, since they must be part of the reduction protocol - as all data sets I(q) are part of the same data file.

How this is handled is still very much a work in progress...

File:
1 edited

Legend:

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

    r1037 r1038  
    3535 
    3636Strconstant ksPanelBinTypeList = "B;FT;FB;FL;FR;MT;MB;ML;MR;FTB;FLR;MTB;MLR;FLRTB;MLRTB;" 
    37  
     37Strconstant ksBinTrimBegDefault = "B=5;FT=6;FB=6;FL=6;FR=6;MT=6;MB=6;ML=6;MR=6;FTB=7;FLR=7;MTB=7;MLR=7;FLRTB=8;MLRTB=8;" 
     38Strconstant ksBinTrimEndDefault = "B=10;FT=9;FB=9;FL=9;FR=9;MT=9;MB=9;ML=9;MR=9;FTB=8;FLR=8;MTB=8;MLR=8;FLRTB=7;MLRTB=7;" 
     39 
     40 
     41////////////////// 
    3842Strconstant ksBinTypeStr = "One;Two;Four;Slit Mode;" 
    3943Strconstant ksBinType1 = "B;FT;FB;FL;FR;MT;MB;ML;MR;"           //these are the "active" extensions 
     
    4145Strconstant ksBinType3 = "B;FLRTB;MLRTB;" 
    4246Strconstant ksBinType4 = "B;FT;FB;FL;FR;MT;MB;ML;MR;" 
    43  
    44  
     47/////////////////// 
     48// 
    4549// NOTE 
    4650// this is the master conversion function 
     
    450454                Wave/Z s_mr = eBin_qxqy_MR 
    451455                Wave/Z s_b = eBin_qxqy_B 
     456 
     457 
    452458                                 
    453459                DeletePoints 0,nBeg, q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b 
     
    892898 
    893899 
     900Macro V_Load_Data_ITX() 
     901        V_Load_itx("","",0,0) 
     902end 
     903 
    894904// TODO 
    895905// -- fill in 
     
    9901000        return(0) 
    9911001End 
     1002 
     1003 
     1004// given strings of the number of points to remove, loop over the detectors 
     1005Function V_Trim1DDataStr(folderStr,binType,nBegStr,nEndStr) 
     1006        String folderStr 
     1007        Variable binType 
     1008        String nBegStr,nEndStr 
     1009         
     1010        String detListStr 
     1011        if(binType == 1) 
     1012                detListStr = ksBinType1 
     1013        endif 
     1014        if(binType == 2) 
     1015                detListStr = ksBinType2 
     1016        endif 
     1017        if(binType == 3) 
     1018                detListStr = ksBinType3 
     1019        endif 
     1020        if(binType == 4) 
     1021                detListStr = ksBinType4 
     1022        endif 
     1023        if(strlen(detListStr)==0) 
     1024                return(0) 
     1025        endif 
     1026         
     1027        //use default values if null string passed in 
     1028        if(strlen(nBegStr)==0) 
     1029                nBegStr = ksBinTrimBegDefault 
     1030                nEndStr = ksBinTrimEndDefault 
     1031        endif    
     1032 
     1033        Variable num, ii,nBeg,nEnd 
     1034        String item,detstr 
     1035         
     1036        num = ItemsInList(detListStr) 
     1037        for(ii=0;ii<num;ii+=1) 
     1038                detStr = StringFromList(ii, detListStr) 
     1039                nBeg = NumberByKey(detStr, nBegStr,"=",";") 
     1040                nEnd = NumberByKey(detStr, nEndStr,"=",";") 
     1041                V_TrimOneSet(folderStr,detStr,nBeg,nEnd) 
     1042        endfor 
     1043 
     1044        return(0) 
     1045End 
     1046 
     1047// TODO 
     1048// -- make this resolution-aware 
     1049// 
     1050Function V_TrimOneSet(folderStr,detStr,nBeg,nEnd) 
     1051        String folderStr,detStr 
     1052        Variable nBeg,nEnd 
     1053         
     1054        SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr) 
     1055 
     1056        Printf "%d points removed from beginning, %d points from the end  of %s \r",nbeg,nend,detStr 
     1057 
     1058// TODO  
     1059// for each binType block: 
     1060// --declare the waves 
     1061// --make a copy of the waves?? 
     1062//      //--Break out resolution wave into separate waves 
     1063// --delete the beginning points from everything 
     1064        // --trim off the last nEnd points from everything 
     1065//      --DeletePoints num-nEnd,nEnd, qw,iw,sw 
     1066//      // --delete all points where the shadow is < 0.98 
     1067////--Put resolution contents back??? 
     1068 
     1069                Wave/Z qw = $("qBin_qxqy_"+detStr) 
     1070                Wave/Z iw = $("iBin_qxqy_"+detStr) 
     1071                Wave/Z ew = $("eBin_qxqy_"+detStr) 
     1072 
     1073                         
     1074                DeletePoints 0,nBeg, qw,iw,ew 
     1075 
     1076                Variable npt 
     1077                npt = numpnts(qw)  
     1078                DeletePoints npt-nEnd,nEnd, qw,iw,ew 
     1079         
     1080        return(0) 
     1081End 
Note: See TracChangeset for help on using the changeset viewer.