Changeset 754
- Timestamp:
- Oct 15, 2010 4:27:43 PM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/Sphere_2D_v40.ipf
r708 r754 187 187 188 188 189 // when I do the quadrature loops I'm calling the AAO with 1-pt waves, so threading 190 // is just a slowdown (by more than a factor of 2 !!) 189 190 //// the threaded version must be specifically written, since 191 //// FUNCREF can't be passed into a threaded calc (structures can't be passed either) 192 // so in this implementation, the smearing is dispatched as threads to a function that 193 // can calculate the function for a range of points in the input qxqyqz. It is important 194 // that the worker calls the un-threaded model function (so write one) and that in the (nord x nord) 195 // loop, vectors of length (nord) are calculated rather than pointwise, since the model 196 // function is AAO. 197 // -- makes things rather messy to code individual functions, but I really see no other way 198 // given the restrictions of what can be passed to threaded functions. 199 // 200 // 201 // The smearing is handled this way since 1D smearing is 20 x 200 pts = 4000 evaluations 202 // and the 2D is (10 x 10) x 16000 pts = 1,600,000 evaluations (if it's done like the 1D, it's 4000x slower) 203 // 191 204 // 192 205 // - the threading gives a clean speedup of 2 for N=2, even for this simple calculation 206 // -- 4.8X speedup for N=8 (4 real cores + 4 virtual cores) 193 207 // 194 208 // nord = 5,10,20 allowed … … 201 215 // Smear_2DModel_PP(Sphere2D_noThread,s,10) 202 216 203 //// the threaded version must be specifically written, since 204 //// FUNCREF can't be passed into a threaded calc (or structures) 217 205 218 //// the last param is nord 206 219 SmearSphere2D_THR(s,10) -
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtils2D_v40.ipf
r747 r754 11 11 // 12 12 // 13 // 13 // - OCT 2010 - added fDoBinning_QxQy2D(folderStr) that takes the QxQyQz data and bins it to I(Q) 14 // 1D result must still be plotted manually, can be automated later. 15 // - for Scaled Image data (QxQy), the function fDoBinning_Scaled2D (in FFT_Cubes) could be 16 // modified and added to this file. It was meant for an FFT slice, but applies to 17 // 2D model calculations (model_lin) 2D data files as well. 14 18 15 19 … … 990 994 991 995 End 996 997 // This routine assumes that the 2D data was loaded with the NCNR loader, so that the 998 // data is in a data folder, and the extensions are known. A more generic form could 999 // be made too, if needed. 1000 // 1001 // X- need error on I(q) 1002 // -- need to set "proper" number of data points (delta and qMax?) 1003 // X- need to remove points at high Q end 1004 // 1005 // -- like the routines in CircSectAve, start with 500 points, and trim after binning is done. 1006 // you'l end up with < 200 points. 1007 // 1008 // the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed 1009 // 1010 //Function fDoBinning_QxQy2D(inten,qx,qy,qz) 1011 Function fDoBinning_QxQy2D(folderStr) 1012 String folderStr 1013 1014 // Wave inten,qx,qy,qz 1015 1016 SetDataFolder $("root:"+folderStr) 1017 1018 WAVE inten = $(folderStr + "_i") 1019 WAVE qx = $(folderStr + "_qx") 1020 WAVE qy = $(folderStr + "_qy") 1021 WAVE qz = $(folderStr + "_qz") 1022 1023 Variable xDim=numpnts(qx),yDim 1024 Variable ii,jj,delQ 1025 Variable qTot,nq,var,avesq,aveisq 1026 Variable binIndex,val 1027 1028 nq = 500 1029 1030 yDim = XDim 1031 Make/O/D/N=(nq) iBin_qxqy,qBin_qxqy,nBin_qxqy,iBin2_qxqy,eBin_qxqy 1032 delQ = abs(sqrt(qx[2]^2+qy[2]^2+qz[2]^2) - sqrt(qx[1]^2+qy[1]^2+qz[1]^2)) //use bins of 1 pixel width 1033 qBin_qxqy[] = p* delQ 1034 SetScale/P x,0,delQ,"",qBin_qxqy //allows easy binning 1035 1036 iBin_qxqy = 0 1037 iBin2_qxqy = 0 1038 eBin_qxqy = 0 1039 nBin_qxqy = 0 //number of intensities added to each bin 1040 1041 for(ii=0;ii<xDim;ii+=1) 1042 qTot = sqrt(qx[ii]^2 + qy[ii]^2+ qz[ii]^2) 1043 binIndex = trunc(x2pnt(qBin_qxqy, qTot)) 1044 val = inten[ii] 1045 if (numType(val)==0) //count only the good points, ignore Nan or Inf 1046 iBin_qxqy[binIndex] += val 1047 iBin2_qxqy[binIndex] += val*val 1048 nBin_qxqy[binIndex] += 1 1049 endif 1050 endfor 1051 1052 //calculate errors, just like in CircSectAve.ipf 1053 for(ii=0;ii<nq;ii+=1) 1054 if(nBin_qxqy[ii] == 0) 1055 //no pixels in annuli, data unknown 1056 iBin_qxqy[ii] = 0 1057 eBin_qxqy[ii] = 1 1058 else 1059 if(nBin_qxqy[ii] <= 1) 1060 //need more than one pixel to determine error 1061 iBin_qxqy[ii] /= nBin_qxqy[ii] 1062 eBin_qxqy[ii] = 1 1063 else 1064 //assume that the intensity in each pixel in annuli is normally 1065 // distributed about mean... 1066 iBin_qxqy[ii] /= nBin_qxqy[ii] 1067 avesq = iBin_qxqy[ii]^2 1068 aveisq = iBin2_qxqy[ii]/nBin_qxqy[ii] 1069 var = aveisq-avesq 1070 if(var<=0) 1071 eBin_qxqy[ii] = 1e-6 1072 else 1073 eBin_qxqy[ii] = sqrt(var/(nBin_qxqy[ii] - 1)) 1074 endif 1075 endif 1076 endif 1077 endfor 1078 1079 // find the last non-zero point, working backwards 1080 val=nq 1081 do 1082 val -= 1 1083 while(nBin_qxqy[val] == 0) 1084 1085 // print val, nBin_qxqy[val] 1086 DeletePoints val, nq-val, iBin_qxqy,qBin_qxqy,nBin_qxqy,iBin2_qxqy,eBin_qxqy 1087 1088 SetDataFolder root: 1089 1090 return(0) 1091 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/Main_USANS.ipf
r749 r754 222 222 // CheckBox UseCurrentData,pos={298,290},size={10,10},proc=UseCurrentDataProc,title="Enable Current Data" 223 223 // CheckBox UseCurrentData,value=0 224 Button USANSFeedback,pos={220,6},size={100,20},proc= U_OpenTracTicketPage,title="Feedback"224 Button USANSFeedback,pos={220,6},size={100,20},proc=OpenTracTicketPage,title="Feedback" 225 225 226 226 EndMacro
Note: See TracChangeset
for help on using the changeset viewer.