Changeset 1059
- Timestamp:
- Jul 27, 2017 3:07:06 PM (6 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Annular.ipf
r1057 r1059 6 6 // 7 7 // As for SANS, needs a Q-center and Q-delta to define the annular ring, 8 // and the number of bins to divide the 360 circle8 // and the number of bins to divide the 360 degree circle 9 9 // 10 10 // … … 16 16 // -- integrate this with the protocol 17 17 // -- integrate this with a more general "average panel" 18 // -- draw the q-center and width on the image (as a contour?) 19 18 // -- draw the q-center and width on the image (as a contour? - if no, use a draw layer...) 19 // Can I "flag" the pixels that contribute to the annualr average, and overlay them like a 20 // Mask(translucent?), like a "thresholding" operation, but act on the Q-value, not the Z- value. 21 22 // 23 // 20 24 Proc Annular_Binning(folderStr,detGroup,qCtr_Ann,qWidth) 21 25 String folderStr="SAM",detGroup="F" … … 23 27 24 28 V_QBinAllPanels_Annular(folderStr,detGroup,qCtr_Ann,qWidth) 25 26 Phi_Graph(folderStr)27 29 30 V_Phi_Graph_Proc(folderStr,detGroup) 31 28 32 End 29 33 … … 50 54 // done a lot faster, but... 51 55 52 53 56 // TODO 54 57 // detStr = "FLRTB" or "MLRTB", depending which panel the q-ring is centered on/ … … 58 61 59 62 60 61 62 63 return(0) 63 64 End 64 65 65 Window Phi_graph(folderStr) : Graph 66 String folderStr 66 Proc V_Phi_Graph_Proc(folderStr,detGroup) 67 String folderStr,detGroup 67 68 68 69 PauseUpdate; Silent 1 // building window... 69 70 String fldrSav0= GetDataFolder(1) 70 71 SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr) 71 Display /W=(35,45,572,419) /K=1 iBin_qxqy_FLRTB vs phiBin_qxqy_FLRTB 72 ModifyGraph mode=4 73 ModifyGraph marker=19 74 ErrorBars iBin_qxqy_FLRTB Y,wave=(eBin_qxqy_FLRTB,eBin_qxqy_FLRTB) 72 73 DoWindow/F V_Phi_Graph 74 if(V_flag == 0) 75 Display /W=(35,45,572,419)/N=V_Phi_Graph /K=1 76 else 77 RemoveFromGraph/Z iPhiBin_qxqy_FLRTB 78 RemoveFromGraph/Z iPhiBin_qxqy_MLRTB 79 endif 80 81 if(cmpstr(detGroup,"F") == 0) 82 AppendToGraph iPhiBin_qxqy_FLRTB vs phiBin_qxqy_FLRTB 83 // Display /W=(35,45,572,419)/N=V_Phi_Graph /K=1 iPhiBin_qxqy_FLRTB vs phiBin_qxqy_FLRTB 84 ModifyGraph mode=4 85 ModifyGraph marker=19 86 ErrorBars iPhiBin_qxqy_FLRTB Y,wave=(ePhiBin_qxqy_FLRTB,ePhiBin_qxqy_FLRTB) 87 Label left "Counts" 88 Label bottom "Phi (degrees)" 89 Legend 90 else 91 AppendToGraph iPhiBin_qxqy_MLRTB vs phiBin_qxqy_MLRTB 92 ModifyGraph mode=4 93 ModifyGraph marker=19 94 ErrorBars iPhiBin_qxqy_MLRTB Y,wave=(ePhiBin_qxqy_MLRTB,ePhiBin_qxqy_MLRTB) 95 Label left "Counts" 96 Label bottom "Phi (degrees)" 97 Legend 98 endif 75 99 76 100 … … 272 296 //******TODO****** -- where to put the averaged data -- right now, folderStr is forced to "" 273 297 // SetDataFolder $("root:"+folderStr) //should already be here, but make sure... 274 Make/O/D/N=(nq) $(folderPath+":"+"i Bin_qxqy"+"_"+type)298 Make/O/D/N=(nq) $(folderPath+":"+"iPhiBin_qxqy"+"_"+type) 275 299 // Make/O/D/N=(nq) $(folderPath+":"+"qBin_qxqy"+"_"+type) 276 300 Make/O/D/N=(nq) $(folderPath+":"+"phiBin_qxqy"+"_"+type) 277 Make/O/D/N=(nq) $(folderPath+":"+"n Bin_qxqy"+"_"+type)278 Make/O/D/N=(nq) $(folderPath+":"+"i Bin2_qxqy"+"_"+type)279 Make/O/D/N=(nq) $(folderPath+":"+"e Bin_qxqy"+"_"+type)280 Make/O/D/N=(nq) $(folderPath+":"+"e Bin2D_qxqy"+"_"+type)281 282 Wave i Bin_qxqy = $(folderPath+":"+"iBin_qxqy_"+type)301 Make/O/D/N=(nq) $(folderPath+":"+"nPhiBin_qxqy"+"_"+type) 302 Make/O/D/N=(nq) $(folderPath+":"+"iPhiBin2_qxqy"+"_"+type) 303 Make/O/D/N=(nq) $(folderPath+":"+"ePhiBin_qxqy"+"_"+type) 304 Make/O/D/N=(nq) $(folderPath+":"+"ePhiBin2D_qxqy"+"_"+type) 305 306 Wave iPhiBin_qxqy = $(folderPath+":"+"iPhiBin_qxqy_"+type) 283 307 // Wave qBin_qxqy = $(folderPath+":"+"qBin_qxqy"+"_"+type) 284 308 Wave phiBin_qxqy = $(folderPath+":"+"phiBin_qxqy"+"_"+type) 285 Wave n Bin_qxqy = $(folderPath+":"+"nBin_qxqy"+"_"+type)286 Wave i Bin2_qxqy = $(folderPath+":"+"iBin2_qxqy"+"_"+type)287 Wave e Bin_qxqy = $(folderPath+":"+"eBin_qxqy"+"_"+type)288 Wave e Bin2D_qxqy = $(folderPath+":"+"eBin2D_qxqy"+"_"+type)309 Wave nPhiBin_qxqy = $(folderPath+":"+"nPhiBin_qxqy"+"_"+type) 310 Wave iPhiBin2_qxqy = $(folderPath+":"+"iPhiBin2_qxqy"+"_"+type) 311 Wave ePhiBin_qxqy = $(folderPath+":"+"ePhiBin_qxqy"+"_"+type) 312 Wave ePhiBin2D_qxqy = $(folderPath+":"+"ePhiBin2D_qxqy"+"_"+type) 289 313 290 314 … … 305 329 306 330 307 i Bin_qxqy = 0308 i Bin2_qxqy = 0309 e Bin_qxqy = 0310 e Bin2D_qxqy = 0311 n Bin_qxqy = 0 //number of intensities added to each bin331 iPhiBin_qxqy = 0 332 iPhiBin2_qxqy = 0 333 ePhiBin_qxqy = 0 334 ePhiBin2D_qxqy = 0 335 nPhiBin_qxqy = 0 //number of intensities added to each bin 312 336 313 337 … … 359 383 endif 360 384 if (numType(val)==0 && mask_val == 0) //count only the good points, ignore Nan or Inf 361 i Bin_qxqy[iphi-1] += val362 i Bin2_qxqy[iphi-1] += val*val363 e Bin2D_qxqy[iphi-1] += iErr[ii][jj]*iErr[ii][jj]364 n Bin_qxqy[iphi-1] += 1385 iPhiBin_qxqy[iphi-1] += val 386 iPhiBin2_qxqy[iphi-1] += val*val 387 ePhiBin2D_qxqy[iphi-1] += iErr[ii][jj]*iErr[ii][jj] 388 nPhiBin_qxqy[iphi-1] += 1 365 389 endif 366 390 … … 405 429 endif 406 430 if (numType(val)==0 && mask_val == 0) //count only the good points, ignore Nan or Inf 407 i Bin_qxqy[iphi-1] += val408 i Bin2_qxqy[iphi-1] += val*val409 e Bin2D_qxqy[iphi-1] += iErr2[ii][jj]*iErr2[ii][jj]410 n Bin_qxqy[iphi-1] += 1431 iPhiBin_qxqy[iphi-1] += val 432 iPhiBin2_qxqy[iphi-1] += val*val 433 ePhiBin2D_qxqy[iphi-1] += iErr2[ii][jj]*iErr2[ii][jj] 434 nPhiBin_qxqy[iphi-1] += 1 411 435 endif 412 436 … … 452 476 endif 453 477 if (numType(val)==0 && mask_val == 0) //count only the good points, ignore Nan or Inf 454 i Bin_qxqy[iphi-1] += val455 i Bin2_qxqy[iphi-1] += val*val456 e Bin2D_qxqy[iphi-1] += iErr3[ii][jj]*iErr3[ii][jj]457 n Bin_qxqy[iphi-1] += 1478 iPhiBin_qxqy[iphi-1] += val 479 iPhiBin2_qxqy[iphi-1] += val*val 480 ePhiBin2D_qxqy[iphi-1] += iErr3[ii][jj]*iErr3[ii][jj] 481 nPhiBin_qxqy[iphi-1] += 1 458 482 endif 459 483 … … 496 520 endif 497 521 if (numType(val)==0 && mask_val == 0) //count only the good points, ignore Nan or Inf 498 i Bin_qxqy[iphi-1] += val499 i Bin2_qxqy[iphi-1] += val*val500 e Bin2D_qxqy[iphi-1] += iErr4[ii][jj]*iErr4[ii][jj]501 n Bin_qxqy[iphi-1] += 1522 iPhiBin_qxqy[iphi-1] += val 523 iPhiBin2_qxqy[iphi-1] += val*val 524 ePhiBin2D_qxqy[iphi-1] += iErr4[ii][jj]*iErr4[ii][jj] 525 nPhiBin_qxqy[iphi-1] += 1 502 526 endif 503 527 … … 520 544 phiBin_qxqy[ii] = dphi*ii 521 545 522 if(n Bin_qxqy[ii] == 0)546 if(nPhiBin_qxqy[ii] == 0) 523 547 //no pixels in annuli, data unknown 524 i Bin_qxqy[ii] = 0525 e Bin_qxqy[ii] = 1526 e Bin2D_qxqy[ii] = NaN548 iPhiBin_qxqy[ii] = 0 549 ePhiBin_qxqy[ii] = 1 550 ePhiBin2D_qxqy[ii] = NaN 527 551 else 528 if(n Bin_qxqy[ii] <= 1)552 if(nPhiBin_qxqy[ii] <= 1) 529 553 //need more than one pixel to determine error 530 i Bin_qxqy[ii] /= nBin_qxqy[ii]531 e Bin_qxqy[ii] = 1532 e Bin2D_qxqy[ii] /= (nBin_qxqy[ii])^2554 iPhiBin_qxqy[ii] /= nPhiBin_qxqy[ii] 555 ePhiBin_qxqy[ii] = 1 556 ePhiBin2D_qxqy[ii] /= (nPhiBin_qxqy[ii])^2 533 557 else 534 558 //assume that the intensity in each pixel in annuli is normally distributed about mean... 535 559 // -- this is correctly calculating the error as the standard error of the mean, as 536 560 // was always done for SANS as well. 537 i Bin_qxqy[ii] /= nBin_qxqy[ii]538 avesq = i Bin_qxqy[ii]^2539 aveisq = i Bin2_qxqy[ii]/nBin_qxqy[ii]561 iPhiBin_qxqy[ii] /= nPhiBin_qxqy[ii] 562 avesq = iPhiBin_qxqy[ii]^2 563 aveisq = iPhiBin2_qxqy[ii]/nPhiBin_qxqy[ii] 540 564 var = aveisq-avesq 541 565 if(var<=0) 542 e Bin_qxqy[ii] = 1e-6566 ePhiBin_qxqy[ii] = 1e-6 543 567 else 544 e Bin_qxqy[ii] = sqrt(var/(nBin_qxqy[ii] - 1))568 ePhiBin_qxqy[ii] = sqrt(var/(nPhiBin_qxqy[ii] - 1)) 545 569 endif 546 570 // and calculate as it is propagated pixel-by-pixel 547 e Bin2D_qxqy[ii] /= (nBin_qxqy[ii])^2571 ePhiBin2D_qxqy[ii] /= (nPhiBin_qxqy[ii])^2 548 572 endif 549 573 endif 550 574 endfor 551 575 552 e Bin2D_qxqy = sqrt(eBin2D_qxqy) // as equation (3) of John's memo576 ePhiBin2D_qxqy = sqrt(ePhiBin2D_qxqy) // as equation (3) of John's memo 553 577 554 578 // find the last non-zero point, working backwards … … 556 580 do 557 581 val -= 1 558 while((n Bin_qxqy[val] == 0) && val > 0)559 560 // print val, n Bin_qxqy[val]561 DeletePoints val, nq-val, i Bin_qxqy,phiBin_qxqy,nBin_qxqy,iBin2_qxqy,eBin_qxqy,eBin2D_qxqy582 while((nPhiBin_qxqy[val] == 0) && val > 0) 583 584 // print val, nPhiBin_qxqy[val] 585 DeletePoints val, nq-val, iPhiBin_qxqy,phiBin_qxqy,nPhiBin_qxqy,iPhiBin2_qxqy,ePhiBin_qxqy,ePhiBin2D_qxqy 562 586 563 587 if(val == 0) … … 572 596 do 573 597 val += 1 574 while(n Bin_qxqy[val] == 0)575 DeletePoints 0, val, i Bin_qxqy,phiBin_qxqy,nBin_qxqy,iBin2_qxqy,eBin_qxqy,eBin2D_qxqy598 while(nPhiBin_qxqy[val] == 0) 599 DeletePoints 0, val, iPhiBin_qxqy,phiBin_qxqy,nPhiBin_qxqy,iPhiBin2_qxqy,ePhiBin_qxqy,ePhiBin2D_qxqy 576 600 577 601 // ?? there still may be a point in the q-range that gets zero pixel contribution - so search this out and get rid of it 578 val = numpnts(n Bin_qxqy)-1602 val = numpnts(nPhiBin_qxqy)-1 579 603 do 580 if(n Bin_qxqy[val] == 0)581 DeletePoints val, 1, i Bin_qxqy,phiBin_qxqy,nBin_qxqy,iBin2_qxqy,eBin_qxqy,eBin2D_qxqy604 if(nPhiBin_qxqy[val] == 0) 605 DeletePoints val, 1, iPhiBin_qxqy,phiBin_qxqy,nPhiBin_qxqy,iPhiBin2_qxqy,ePhiBin_qxqy,ePhiBin2D_qxqy 582 606 endif 583 607 val -= 1 … … 627 651 if(cmpstr(detGroup,"F") == 0) 628 652 Wave/Z pw = phiBin_qxqy_FLRTB 629 Wave/Z iw = i Bin_qxqy_FLRTB630 Wave/Z sw = e Bin_qxqy_FLRTB653 Wave/Z iw = iPhiBin_qxqy_FLRTB 654 Wave/Z sw = ePhiBin_qxqy_FLRTB 631 655 else 632 656 Wave/Z pw = phiBin_qxqy_MLRTB 633 Wave/Z iw = i Bin_qxqy_MLRTB634 Wave/Z sw = e Bin_qxqy_MLRTB657 Wave/Z iw = iPhiBin_qxqy_MLRTB 658 Wave/Z sw = ePhiBin_qxqy_MLRTB 635 659 endif 636 660 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf
r1055 r1059 172 172 Button button_tab_p,pos={648,81},size={50,20},proc=V_Tab_p_ButtonProc,title="Tab >" 173 173 Button button_isolate,pos={606,114},size={70,20},proc=V_IsolateButtonProc,title="Isolate" 174 Button button_toWork,pos={770,113},size={70,20},proc=V_ToWorkFileButtonProc,title="to WORK" 174 Button button_toWork,pos={770,146},size={90,20},proc=V_ToWorkFileButtonProc,title="to WORK" 175 Button button_annular,pos={770,114},size={90,20},proc=V_annularAvgButtonProc,title="Annular Avg" 175 176 176 177 TitleBox title_file,pos={606,178},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gLastLoadedFile … … 855 856 End 856 857 858 859 // 860 // TODO: 861 // -- simply calls the missing parameter dialog to do the average. 862 // see the file V_IQ_Annular.ipf for all of the features yet to be added. 863 // 864 // -- currently just the graph, no controls 865 // -- this re-bins the data every time by calling V_QBinAllPanels(folderStr,binType) from inside V_BinningModePopup() 866 Function V_annularAvgButtonProc(ba) : ButtonControl 867 STRUCT WMButtonAction &ba 868 869 switch( ba.eventCode ) 870 case 2: // mouse up 871 // click code here 872 873 Execute "Annular_Binning()" 874 875 break 876 case -1: // control being killed 877 break 878 endswitch 879 880 return 0 881 End 882 857 883 // TODO 858 884 //
Note: See TracChangeset
for help on using the changeset viewer.