Changeset 993 for sans/Dev/trunk/NCNR_User_Procedures
- Timestamp:
- Apr 22, 2016 5:02:30 PM (7 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_BeamCenter.ipf
r992 r993 521 521 End 522 522 523 // 524 // This sets the scale of the data panels to an approximate detector coordinate system with 525 // zero at the center, only for display purposes. It is not exact, and has nothing to do with 526 // the calculation of q-values. 527 // 523 528 // TODO 524 529 // -- some of this is hard-wired in … … 600 605 endfor 601 606 602 603 // nominal values... better to use what's in the file 604 //// 605 // V_RescaleToBeamCenter("RAW","MB",64,55) 606 // V_RescaleToBeamCenter("RAW","MT",64,-8.7) 607 // V_RescaleToBeamCenter("RAW","MR",-8.1,64) 608 // V_RescaleToBeamCenter("RAW","ML",55,64) 609 // V_RescaleToBeamCenter("RAW","FB",64,55) 610 // V_RescaleToBeamCenter("RAW","FT",64,-8.7) 611 // V_RescaleToBeamCenter("RAW","FR",-8.1,64) 612 // V_RescaleToBeamCenter("RAW","FL",55,64) 613 614 607 615 608 return(0) 616 609 end -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Q.ipf
r992 r993 66 66 WAVE det_FR = $(folderPath+instPath+detStr+":det_"+detStr) 67 67 WAVE qTot_FR = $(folderPath+instPath+detStr+":qTot_"+detStr) 68 // WAVE qTot_FR = $("root:Packages:NIST:VSANS:RAW:entry:instrument:detector_FR:qTot_FR") 68 69 69 70 detStr = "FT" … … 75 76 WAVE qTot_FB = $(folderPath+instPath+detStr+":qTot_"+detStr) 76 77 78 79 77 80 FillPanel_wModelData(det_FL,qTot_FL,"FL") 78 81 FillPanel_wModelData(det_FR,qTot_FR,"FR") … … 82 85 SetDataFolder root: 83 86 84 // set any "shadowed" area of the T/B detectors to NaN to get a reali tic87 // set any "shadowed" area of the T/B detectors to NaN to get a realistic 85 88 // view of how much of the detectors are actually collecting data 86 89 // -- I can get the separation L/R from the panel - only this "open" width is visible. … … 175 178 xCtr = nPix_X+(F_LR_sep/2/pixSizeX) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 176 179 yCtr = nPix_Y/2 177 VC_Detector_2Q(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 178 // Print "xy for FL = ",xCtr,yCtr 180 //put these beam center values into the local folder 181 V_putDet_beam_center_x("VCALC","FL",xCtr) 182 V_putDet_beam_center_y("VCALC","FL",yCtr) 183 184 // VC_Detector_2Q(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 185 VC_Detector_2Q_NonLin(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"FL") 186 Print "xy for FL = ",xCtr,yCtr 179 187 180 188 //set the wave scaling for the detector image so that it can be plotted in q-space … … 207 215 208 216 xCtr = -(F_LR_sep/2/pixSizeX)-1 209 yCtr = nPix_Y/2 210 VC_Detector_2Q(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 217 yCtr = nPix_Y/2 218 //put these beam center values into the local folder 219 V_putDet_beam_center_x("VCALC","FR",xCtr) 220 V_putDet_beam_center_y("VCALC","FR",yCtr) 221 // VC_Detector_2Q(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 222 VC_Detector_2Q_NonLin(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"FR") 223 211 224 // Print "xy for FR = ",xCtr,yCtr 212 225 SetScale/I x WaveMin(qx_FR),WaveMax(qx_FR),"", det_FR //this sets the left and right ends of the data scaling … … 235 248 236 249 xCtr = nPix_X/2 237 yCtr = -(F_TB_sep/2/pixSizeY)-1 250 yCtr = -(F_TB_sep/2/pixSizeY)-1 251 //put these beam center values into the local folder 252 V_putDet_beam_center_x("VCALC","FT",xCtr) 253 V_putDet_beam_center_y("VCALC","FT",yCtr) 254 238 255 // global sdd_offset is in (mm), convert to meters here for the Q-calculation 239 VC_Detector_2Q(det_FT,qTot_FT,qx_FT,qy_FT,qz_FT,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) 256 // VC_Detector_2Q(det_FT,qTot_FT,qx_FT,qy_FT,qz_FT,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) 257 VC_Detector_2Q_NonLin(det_FT,qTot_FT,qx_FT,qy_FT,qz_FT,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY,"FT") 258 240 259 // Print "xy for FT = ",xCtr,yCtr 241 260 SetScale/I x WaveMin(qx_FT),WaveMax(qx_FT),"", det_FT //this sets the left and right ends of the data scaling … … 265 284 xCtr = nPix_X/2 266 285 yCtr = nPix_Y+(F_TB_sep/2/pixSizeY) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 286 //put these beam center values into the local folder 287 V_putDet_beam_center_x("VCALC","FB",xCtr) 288 V_putDet_beam_center_y("VCALC","FB",yCtr) 289 267 290 // global sdd_offset is in (mm), convert to meters here for the Q-calculation 268 VC_Detector_2Q(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) 291 // VC_Detector_2Q(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) 292 VC_Detector_2Q_NonLin(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY,"FB") 293 269 294 // Print "xy for FB = ",xCtr,yCtr 270 295 SetScale/I x WaveMin(qx_FB),WaveMax(qx_FB),"", det_FB //this sets the left and right ends of the data scaling … … 572 597 xCtr = nPix_X+(M_LR_sep/2/pixSizeX) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 573 598 yCtr = nPix_Y/2 574 VC_Detector_2Q(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 599 //put these beam center values into the local folder 600 V_putDet_beam_center_x("VCALC","ML",xCtr) 601 V_putDet_beam_center_y("VCALC","ML",yCtr) 602 603 // VC_Detector_2Q(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 604 VC_Detector_2Q_NonLin(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"ML") 605 575 606 // Print "xy for ML = ",xCtr,yCtr 576 607 … … 607 638 xCtr = -(M_LR_sep/2/pixSizeX)-1 608 639 yCtr = nPix_Y/2 609 VC_Detector_2Q(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 640 //put these beam center values into the local folder 641 V_putDet_beam_center_x("VCALC","MR",xCtr) 642 V_putDet_beam_center_y("VCALC","MR",yCtr) 643 644 // VC_Detector_2Q(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 645 VC_Detector_2Q_NonLin(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"MR") 646 610 647 // Print "xy for MR = ",xCtr,yCtr 611 648 SetScale/I x WaveMin(qx_MR),WaveMax(qx_MR),"", det_MR //this sets the left and right ends of the data scaling … … 635 672 xCtr = nPix_X/2 636 673 yCtr = -(M_TB_sep/2/pixSizeY)-1 674 //put these beam center values into the local folder 675 V_putDet_beam_center_x("VCALC","MT",xCtr) 676 V_putDet_beam_center_y("VCALC","MT",yCtr) 677 637 678 // global sdd_offset is in (mm), convert to meters here for the Q-calculation 638 VC_Detector_2Q(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) 679 // VC_Detector_2Q(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) 680 VC_Detector_2Q_NonLin(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY,"MT") 681 639 682 // Print "xy for MT = ",xCtr,yCtr 640 683 SetScale/I x WaveMin(qx_MT),WaveMax(qx_MT),"", det_MT //this sets the left and right ends of the data scaling … … 664 707 xCtr = nPix_X/2 665 708 yCtr = nPix_Y+(M_TB_sep/2/pixSizeY) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 709 //put these beam center values into the local folder 710 V_putDet_beam_center_x("VCALC","MB",xCtr) 711 V_putDet_beam_center_y("VCALC","MB",yCtr) 712 666 713 // global sdd_offset is in (mm), convert to meters here for the Q-calculation 667 VC_Detector_2Q(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) 714 // VC_Detector_2Q(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) 715 VC_Detector_2Q_NonLin(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY,"MB") 716 668 717 // Print "xy for MB = ",xCtr,yCtr 669 718 SetScale/I x WaveMin(qx_MB),WaveMax(qx_MB),"", det_MB //this sets the left and right ends of the data scaling … … 994 1043 xCtr = trunc( DimSize(det_B,0)/2 ) //should be 150/2=75 995 1044 yCtr = trunc( DimSize(det_B,1)/2 ) //should be 150/2=75 996 VC_Detector_2Q(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 1045 //put these beam center values into the local folder 1046 V_putDet_beam_center_x("VCALC","B",xCtr) 1047 V_putDet_beam_center_y("VCALC","B",yCtr) 1048 1049 // VC_Detector_2Q(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 1050 // this will always do the linear calculation, since the real-space distance waves do not exist 1051 VC_Detector_2Q_NonLin(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"B") 1052 997 1053 998 1054 //set the wave scaling for the detector image so that it can be plotted in q-space -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r992 r993 186 186 187 187 188 // for testing, a version that will calculate the q-arrays for VCALC based on whatever nonlinear coefficients 189 // exist in the RAW data folder 190 // 191 // reverts to the "regular" linear detector if waves not found or a flag is set 192 // 193 // need to convert the beam center to mm 194 // need to call the VSANS V_CalcQval routines (these use the real-space distance, not pixel dims) 195 // 196 // TODO: 197 // -- tube width is hard-wired in 198 // 199 // 200 Function VC_Detector_2Q_NonLin(data,qTot,qx,qy,qz,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,detStr) 201 Wave data,qTot,qx,qy,qz 202 Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY 203 String detStr 204 205 String destPath = "root:Packages:NIST:VSANS:RAW" 206 207 Wave/Z data_realDistX = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistX") 208 Wave/Z data_realDistY = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistY") 209 NVAR gUseNonLinearDet = root:Packages:NIST:VSANS:VCALC:gUseNonLinearDet 210 211 if(gUseNonLinearDet && WaveExists(data_realDistX) && WaveExists(data_realDistY)) 212 // convert the beam centers to mm 213 String orientation 214 Variable dimX,dimY,newX,newY 215 dimX = DimSize(data_realDistX,0) 216 dimY = DimSize(data_realDistX,1) 217 if(dimX > dimY) 218 orientation = "horizontal" 219 else 220 orientation = "vertical" 221 endif 222 223 Variable tube_width = 8.4 //mm 224 225 // 226 if(cmpstr(orientation,"vertical")==0) 227 // this is data dimensioned as (Ntubes,Npix) 228 newX = tube_width*xCtr 229 newY = data_realDistY[0][yCtr] 230 else 231 // this is data (horizontal) dimensioned as (Npix,Ntubes) 232 newX = data_realDistX[xCtr][0] 233 newY = tube_width*yCtr 234 endif 235 236 //if detector "B", different calculation for the centers (not tubes) 237 if(cmpstr(detStr,"B")==0) 238 newX = data_realDistX[xCtr][0] 239 newY = data_realDistY[0][yCtr] 240 endif 241 242 // calculate all of the q-values 243 qTot = V_CalcQval(p,q,newX,newY,sdd,lam,data_realDistX,data_realDistY) 244 qx = V_CalcQX(p,q,newX,newY,sdd,lam,data_realDistX,data_realDistY) 245 qy = V_CalcQY(p,q,newX,newY,sdd,lam,data_realDistX,data_realDistY) 246 qz = V_CalcQZ(p,q,newX,newY,sdd,lam,data_realDistX,data_realDistY) 247 248 // Print "det, x_mm, y_mm ",detStr,num2str(newX),num2str(newY) 249 // Print "det, x_pix, y_pix ",detStr,num2str(xCtr),num2str(yCtr) 250 else 251 // do the q-calculation using linear detector 252 VC_Detector_2Q(data,qTot,qx,qy,qz,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 253 endif 254 255 return(0) 256 End 257 258 188 259 ////////////////////// 189 260 // NOTE: The Q calculations are different than what is in GaussUtils in that they take into … … 593 664 // -- figure out what the best location is to put the averaged data? currently @ top level of WORK folder 594 665 // but this is a lousy choice. 595 // 666 // x- binning is now Mask-aware. If mask is not present, all data is used. If data is from VCALC, all data is used 667 // -- Where do I put the solid angle correction? In here as a weight for each point, or later on as 668 // a blanket correction (matrix multiply) for an entire panel? 669 // 670 // folderStr = WORK folder, type = the binning type (may include multiple detectors) 596 671 Function VC_fDoBinning_QxQy2D(folderStr,type) 597 672 String folderStr,type … … 601 676 Variable ii,jj 602 677 Variable qVal,nq,var,avesq,aveisq 603 Variable binIndex,val,isVCALC=0 678 Variable binIndex,val,isVCALC=0,maskMissing 604 679 605 680 String folderPath = "root:Packages:NIST:VSANS:"+folderStr … … 614 689 // since there may be more than one panel to step through. There may be two, there may be four 615 690 // 691 692 // assume that the mask files are missing unless we can find them. If VCALC data, 693 // then the Mask is missing by definition 694 maskMissing = 1 616 695 617 696 strswitch(type) // string switch … … 625 704 Wave inten = V_getDetectorDataW(folderStr,detStr) 626 705 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 706 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 707 if(WaveExists(mask) == 1) 708 maskMissing = 0 709 endif 710 627 711 endif 628 712 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) … … 640 724 Wave inten = V_getDetectorDataW(folderStr,detStr) 641 725 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 726 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 727 if(WaveExists(mask) == 1) 728 maskMissing = 0 729 endif 642 730 endif 643 731 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) … … 655 743 Wave inten = V_getDetectorDataW(folderStr,detStr) 656 744 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 745 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 746 if(WaveExists(mask) == 1) 747 maskMissing = 0 748 endif 657 749 endif 658 750 //TODO: … … 675 767 Wave inten = V_getDetectorDataW(folderStr,detStr) 676 768 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 769 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 770 if(WaveExists(mask) == 1) 771 maskMissing = 0 772 endif 677 773 endif 678 774 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) … … 689 785 Wave inten = V_getDetectorDataW(folderStr,detStr) 690 786 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 787 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 788 if(WaveExists(mask) == 1) 789 maskMissing = 0 790 endif 691 791 endif 692 792 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_B") … … 709 809 Wave inten2 = V_getDetectorDataW(folderStr,"FR") 710 810 Wave iErr2 = V_getDetectorDataErrW(folderStr,"FR") 811 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FL"+":data") 812 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FR"+":data") 813 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1) 814 maskMissing = 0 815 endif 711 816 endif 712 817 NVAR delQ = $(folderPath+instPath+"FL"+":gDelQ_FL") … … 729 834 Wave inten2 = V_getDetectorDataW(folderStr,"FB") 730 835 Wave iErr2 = V_getDetectorDataErrW(folderStr,"FB") 836 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FT"+":data") 837 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FB"+":data") 838 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1) 839 maskMissing = 0 840 endif 731 841 endif 732 842 NVAR delQ = $(folderPath+instPath+"FT"+":gDelQ_FT") … … 757 867 Wave inten4 = V_getDetectorDataW(folderStr,"FB") 758 868 Wave iErr4 = V_getDetectorDataErrW(folderStr,"FB") 869 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FL"+":data") 870 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FR"+":data") 871 Wave/Z mask3 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FT"+":data") 872 Wave/Z mask4 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"FB"+":data") 873 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1 && WaveExists(mask3) == 1 && WaveExists(mask4) == 1) 874 maskMissing = 0 875 endif 759 876 endif 760 877 NVAR delQ = $(folderPath+instPath+"FL"+":gDelQ_FL") … … 779 896 Wave inten2 = V_getDetectorDataW(folderStr,"MR") 780 897 Wave iErr2 = V_getDetectorDataErrW(folderStr,"MR") 898 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"ML"+":data") 899 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MR"+":data") 900 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1) 901 maskMissing = 0 902 endif 781 903 endif 782 904 NVAR delQ = $(folderPath+instPath+"ML"+":gDelQ_ML") … … 799 921 Wave inten2 = V_getDetectorDataW(folderStr,"MB") 800 922 Wave iErr2 = V_getDetectorDataErrW(folderStr,"MB") 923 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MT"+":data") 924 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MB"+":data") 925 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1) 926 maskMissing = 0 927 endif 801 928 endif 802 929 NVAR delQ = $(folderPath+instPath+"MT"+":gDelQ_MT") … … 827 954 Wave inten4 = V_getDetectorDataW(folderStr,"MB") 828 955 Wave iErr4 = V_getDetectorDataErrW(folderStr,"MB") 956 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"ML"+":data") 957 Wave/Z mask2 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MR"+":data") 958 Wave/Z mask3 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MT"+":data") 959 Wave/Z mask4 = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+"MB"+":data") 960 if(WaveExists(mask) == 1 && WaveExists(mask2) == 1 && WaveExists(mask3) == 1 && WaveExists(mask4) == 1) 961 maskMissing = 0 962 endif 829 963 endif 830 964 NVAR delQ = $(folderPath+instPath+"ML"+":gDelQ_ML") … … 922 1056 // this needs to be a double loop now... 923 1057 1058 // if any of the masks don't exist, display the error, and proceed with the averaging, using all data 1059 if(maskMissing == 1) 1060 Print "Mask file not found for at least one detector - so all data is used" 1061 endif 1062 1063 Variable mask_val 924 1064 // use set 1 (no number) only 925 1065 if(nSets >= 1) … … 933 1073 binIndex = trunc(x2pnt(qBin_qxqy, qVal)) 934 1074 val = inten[ii][jj] 935 if (numType(val)==0) //count only the good points, ignore Nan or Inf 1075 1076 if(isVCALC || maskMissing) // mask_val == 1 == keep 1077 mask_val = 1 1078 else 1079 mask_val = mask[ii][jj] 1080 endif 1081 if (numType(val)==0 && mask_val == 1) //count only the good points, ignore Nan or Inf 936 1082 iBin_qxqy[binIndex] += val 937 1083 iBin2_qxqy[binIndex] += val*val … … 955 1101 binIndex = trunc(x2pnt(qBin_qxqy, qVal)) 956 1102 val = inten2[ii][jj] 957 if (numType(val)==0) //count only the good points, ignore Nan or Inf 1103 1104 if(isVCALC || maskMissing) 1105 mask_val = 1 1106 else 1107 mask_val = mask2[ii][jj] 1108 endif 1109 if (numType(val)==0 && mask_val == 1) //count only the good points, ignore Nan or Inf 958 1110 iBin_qxqy[binIndex] += val 959 1111 iBin2_qxqy[binIndex] += val*val … … 977 1129 binIndex = trunc(x2pnt(qBin_qxqy, qVal)) 978 1130 val = inten3[ii][jj] 979 if (numType(val)==0) //count only the good points, ignore Nan or Inf 1131 1132 if(isVCALC || maskMissing) 1133 mask_val = 1 1134 else 1135 mask_val = mask3[ii][jj] 1136 endif 1137 if (numType(val)==0 && mask_val == 1) //count only the good points, ignore Nan or Inf 980 1138 iBin_qxqy[binIndex] += val 981 1139 iBin2_qxqy[binIndex] += val*val … … 996 1154 binIndex = trunc(x2pnt(qBin_qxqy, qVal)) 997 1155 val = inten4[ii][jj] 998 if (numType(val)==0) //count only the good points, ignore Nan or Inf 1156 1157 if(isVCALC || maskMissing) 1158 mask_val = 1 1159 else 1160 mask_val = mask4[ii][jj] 1161 endif 1162 if (numType(val)==0 && mask_val == 1) //count only the good points, ignore Nan or Inf 999 1163 iBin_qxqy[binIndex] += val 1000 1164 iBin2_qxqy[binIndex] += val*val -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_HDF5_VSANS_Utils.ipf
r987 r993 67 67 "Setup_VSANS_DIV_Struct" 68 68 "Save_VSANS_DIV_Nexus" 69 "Setup_VSANS_MASK_Struct" 70 "Save_VSANS_MASK_Nexus" 69 71 "-" 70 72 "Read_Nexus with attributes",Read_Nexus_Xref() //this will read with attributes … … 300 302 301 303 302 304 ////////////////////// MASK FILE 305 306 307 // TODO 308 // currently, there are no dummy fill values or attributes for the fake MASK file 309 // 310 Proc Setup_VSANS_MASK_Struct() 311 312 // lays out the tree and fills with dummy values 313 H_Setup_VSANS_MASK_Structure() 314 315 // writes in the attributes 316 // H_Fill_VSANS_Attributes() 317 318 // fill in with VCALC simulation bits 319 // H_Fill_VSANS_wSim() 320 321 End 322 323 Proc Save_VSANS_MASK_Nexus(fileName) 324 String fileName="Test_VSANS_MASK_file" 325 326 // save as HDF5 (no attributes saved yet) 327 Save_VSANS_file("root:VSANS_MASK_file", fileName+".h5") 328 329 // read in a data file using the gateway-- reads from the home path 330 H_HDF5Gate_Read_Raw(fileName+".h5") 331 332 // after reading in a "partial" file using the gateway (to generate the xref) 333 // Save the xref to disk (for later use) 334 Save_HDF5___xref("root:"+fileName,"HDF5___xref") 335 336 // after you've generated the HDF5___xref, load it in and copy it 337 // to the necessary folder location. 338 Copy_HDF5___xref("root:VSANS_MASK_file", "HDF5___xref") 339 340 // writes out the contents of a data folder using the gateway 341 H_HDF5Gate_Write_Raw("root:VSANS_MASK_file", fileName+".h5") 342 343 // re-load the data file using the gateway-- reads from the home path 344 // now with attributes 345 H_HDF5Gate_Read_Raw(fileName+".h5") 346 347 End 348 349 ////////////// fake MASK file tests 350 // 351 // 352 // Make/O/T/N=1 file_name = "VSANS_MASK_test.h5" 353 // 354 // simple generation of a fake MASK file. for sans, nothing other than the creation date was written to the 355 // file header. nothing more is needed (possibly) 356 // 357 // 358 // TODO -- make the number of pixels GLOBAL 359 // TODO -- there will be lots of work to do to develop the procedures necessary to actually generate the 360 // 9 data sets to become the MASK file contents. More complexity here than for the simple SANS case. 361 // 362 // TODO -- this is currently random 0|1 values, need to write an editor 363 // 364 // currently set up to use 0 = exclude and 1 = keep 365 // 366 Proc H_Setup_VSANS_MASK_Structure() 367 368 NewDataFolder/O/S root:VSANS_MASK_file 369 370 NewDataFolder/O/S root:VSANS_MASK_file:entry 371 Make/O/T/N=1 title = "This is a fake MASK file for VSANS" 372 Make/O/T/N=1 start_date = "2015-02-28T08:15:30-5:00" 373 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument 374 Make/O/T/N=1 name = "NG3_VSANS" 375 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_B 376 Make/O/I/N=(150,150) data = 1 377 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MR 378 Make/O/I/N=(48,128) data = 1 379 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_ML 380 Make/O/I/N=(48,128) data = 1 381 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MT 382 Make/O/I/N=(128,48) data = 1 383 data[0,49][] = 0 384 data[78,127][] = 0 385 data[50,77][] = 1 386 387 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MB 388 Make/O/I/N=(128,48) data = 1 389 data[0,49][] = 0 390 data[78,127][] = 0 391 data[50,77][] = 1 392 393 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FR 394 Make/O/I/N=(48,128) data = 1 395 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FL 396 Make/O/I/N=(48,128) data = 1 397 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FT 398 Make/O/I/N=(128,48) data = 1 399 data[0,49][] = 0 400 data[78,127][] = 0 401 data[50,77][] = 1 402 403 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FB 404 Make/O/I/N=(128,48) data = 1 405 data[0,49][] = 0 406 data[78,127][] = 0 407 data[50,77][] = 1 408 409 SetDataFolder root: 410 411 End 303 412 304 413 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_UtilityProcedures.ipf
r983 r993 406 406 case "MT": 407 407 case "MB": 408 NVAR sdd_offset = gMiddle_SDDOffset //T/B are 30 cm farther back408 NVAR sdd_offset = gMiddle_SDDOffset //T/B are 300 mm farther back 409 409 break 410 410 … … 432 432 // -- all of this needs to be done. There's nothing here... 433 433 // 434 435 436 437 438 //////// function to take VCALC information and 439 // fill in the simulated information as needed to make a "fake" data file 440 // 441 // TODO: 442 // -- identify all of the necessary bits to change 443 // -- maybe want a panel to make it easier to decide what inputs to change in the file 444 // -- decide if it's better to write wholesale, or as individual waves 445 // 446 Macro Copy_VCALC_to_VSANSFile() 447 448 String fileName = V_DoSaveFileDialog("pick the file to write to") 449 print fileName 450 // 451 if(strlen(fileName) > 0) 452 writeVCALC_to_file(fileName) 453 endif 454 End 455 456 // 457 // TODO -- fill this in as needed to get fake data that's different 458 // 459 Function writeVCALC_to_file(fileName) 460 String fileName 461 462 463 // the detectors, all 9 + the correct SDD (that accounts for the offset of T/B panels 464 // the data itself (as INT32) 465 // the front SDD (correct units) 466 // the middle SDD (correct units) 467 // the back SDD (correct units) 468 Variable ii,val 469 String detStr 470 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 471 detStr = StringFromList(ii, ksDetectorListAll, ";") 472 Duplicate/O $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) tmpData 473 Redimension/I tmpData 474 tmpData = (tmpData == 2147483647) ? 0 : tmpData //the NaN "mask" in the sim data (T/B only)shows up as an ugly integer 475 V_writeDetectorData(fileName,detStr,tmpData) 476 477 val = VCALC_getTopBottomSDDOffset(detStr)/10 + VCALC_getSDD(detStr)*100 // make sure value is in cm 478 print val 479 V_writeDet_distance(fileName,detStr,val) 480 481 // x and y pixel sizes for each detector should be correct in the "base" file - but if not... 482 //Function VCALC_getPixSizeX(type) // returns the pixel X size, in [cm] 483 //Function VCALC_getPixSizeY(type) 484 V_writeDet_x_pixel_size(fileName,detStr,VCALC_getPixSizeX(detStr)*10) // data file is expecting mm 485 V_writeDet_y_pixel_size(fileName,detStr,VCALC_getPixSizeY(detStr)*10) 486 487 // write out the xCtr and yCtr (pixels) that was used in the q-calculation, done in VC_CalculateQFrontPanels() 488 V_writeDet_beam_center_x(fileName,detStr,V_getDet_beam_center_x("VCALC",detStr)) 489 V_writeDet_beam_center_y(fileName,detStr,V_getDet_beam_center_y("VCALC",detStr)) 490 491 492 493 // the calibration data for each detector (except B) is already correct in the "base" file 494 //V_writeDetTube_spatialCalib(fname,detStr,inW) 495 // and for "B" 496 //V_writeDet_cal_x(fname,detStr,inW) 497 //V_writeDet_cal_y(fname,detStr,inW) 498 499 500 // the dead time for each detector is already correct in the "base" file 501 // V_writeDetector_deadtime(fname,detStr,inW) 502 // TODO: need a new, separate function to write the single deadtime value in/out of "B" 503 504 endfor 505 506 507 //? other detector geometry - lateral separation? 508 509 // the wavelength 510 // Variable lam = V_getWavelength("VCALC") //doesn't work, the corresponding folder in VCALC has not been defined 511 V_writeWavelength(fileName,VCALC_getWavelength()) 512 513 // description of the sample 514 515 // sample information 516 // name, title, etc 517 518 // fake the information about the count setup, so I have different numbers to read 519 // count time = fake time of 100 s 520 V_writeCount_time(fileName,100) 521 522 // monitor count (= imon) 523 // returns the number of neutrons on the sample 524 //Function VCALC_getImon() 525 526 // ?? anything else that I'd like to see on the catalog - I could change them here to see different values 527 // different collimation types? 528 // 529 530 return(0) 531 end 532 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf
r992 r993 667 667 668 668 Variable/G root:Packages:NIST:VSANS:VCALC:gVCALC_Active = 1 669 Variable/G root:Packages:NIST:VSANS:VCALC:gUseNonLinearDet = 0 //if == 1, use RAW non-linear corrections 669 670 670 671 SetDataFolder root:Packages:NIST:VSANS:VCALC … … 726 727 // Variable/G gFront_B_nPix_Y = 48 // == number of tubes 727 728 729 // pixel beam center - HDF style 730 Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_x = 55 // == x beam center, in pixels 731 Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_y = 64 // == y beam center, in pixels 732 Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_x = -8 733 Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_y = 64 734 Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_x = 64 735 Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_y = -8 736 Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_x = 64 737 Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_y = 55 728 738 729 739 … … 781 791 // Variable/G gMiddle_B_nPix_Y = 48 // == number of tubes 782 792 793 // pixel beam center - HDF style 794 Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_x = 55 // == x beam center, in pixels 795 Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_y = 64 // == y beam center, in pixels 796 Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_x = -8 797 Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_y = 64 798 Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_x = 64 799 Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_y = -8 800 Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_x = 64 801 Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_y = 55 783 802 784 803 … … 798 817 // Variable/G gBack_nPix_X = 150 799 818 // Variable/G gBack_nPix_Y = 150 819 820 // pixel beam center - HDF style 821 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 75 // == x beam center, in pixels 822 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 75 // == y beam center, in pixels 800 823 801 824 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r984 r993 55 55 // 1D binning, combining 56 56 #include "V_IQ_Utilities" 57 58 // testing procedures 59 #include "V_Testing_Data_Procs" 60 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf
r992 r993 407 407 String type 408 408 409 SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B409 // SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B 410 410 411 411 Variable binType -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r992 r993 59 59 sumTubes /= ctTime //now count rate per tube 60 60 61 dataW[][] = dataW[p][q]/(1-sumTubes[p] [0]*dtW[p]) //correct the data61 dataW[][] = dataW[p][q]/(1-sumTubes[p]*dtW[p]) //correct the data 62 62 63 63 elseif(cmpstr(orientation,"horizontal")==0) … … 67 67 sumTubes /= ctTime 68 68 69 dataW[][] = dataW[p][q]/(1-sumTubes[ 0][q]*dtW[q])69 dataW[][] = dataW[p][q]/(1-sumTubes[q]*dtW[q]) 70 70 71 71 else … … 76 76 end 77 77 78 // test function 79 Function testDTCor() 80 81 String detStr = "" 82 String fname = "RAW" 83 Variable ctTime 84 85 detStr = "FR" 86 Wave w = V_getDetectorDataW(fname,detStr) 87 Wave w_err = V_getDetectorDataErrW(fname,detStr) 88 Wave w_dt = V_getDetector_deadtime(fname,detStr) 89 90 ctTime = V_getCount_time(fname) 91 92 // ctTime = 10 93 DeadTimeCorrectionTubes(w,w_err,w_dt,ctTime) 94 95 End 96 97 78 98 // 79 99 // Non-linear data correction 80 100 // 101 // DOES NOT modify the data, only calculates the spatial relationship 102 // 81 103 // input is the data array (N tubes x M pixels) 82 104 // input of N x M array of quadratic coefficients … … 191 213 // calculate the actual value 192 214 // 193 // -- distance in the lateral direction is based on tube width, which is well known215 // -- distance in the lateral direction is based on tube width, which is a fixed parameter 194 216 // 195 217 // … … 310 332 // -- only for the tube, not the Back det 311 333 312 DoAlert 0, "re-do this and do a better job of filling the fake calibration data" 313 314 fMakeFakeCalibrationWaves() 334 // DoAlert 0, "re-do this and do a better job of filling the fake calibration data" 335 336 DoAlert 0, "Calibration waves are read in from the data file" 337 338 // fMakeFakeCalibrationWaves() 315 339 End 316 340 … … 1030 1054 // TODO: 1031 1055 // -- DoAlert 0,"This has not yet been updated for VSANS" 1056 // -- how is the error propagation handled? 1032 1057 // 1033 1058 //function will divide the contents of "workType" folder with the contents of -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r992 r993 21 21 Strconstant ksBaseDFPath = "root:Packages:NIST:VSANS:RawVSANS:" 22 22 23 // the list of WORK Folders 24 Strconstant ksWorkFolderList = "RAW;SAM;EMP;BGD;COR;DIV;ABS;MSK;CAL;STO;SUB;DRK;ADJ;VCALC;RawVSANS;" 25 23 26 24 27 // passing null file string presents a dialog 25 28 Macro LoadFakeDIVData() 26 29 V_LoadHDF5Data("","DIV") 30 End 31 32 // passing null file string presents a dialog 33 Macro LoadFakeMASKData() 34 V_LoadHDF5Data("","MSK") 27 35 End 28 36 … … 39 47 // This is a fake since I don't have anything close to correct fake data yet. (1/29/16) 40 48 // 41 // TODO: -- is there an extra "entry" heading? Am I adding this by mistake by setting base_name="entry" for RAW data?42 // -- as dumb as it is -- do I just leave it now, or break everything. On the plus side, removing the extra "entry"49 // DONE: x- is there an extra "entry" heading? Am I adding this by mistake by setting base_name="entry" for RAW data? 50 // x- as dumb as it is -- do I just leave it now, or break everything. On the plus side, removing the extra "entry" 43 51 // layer may catch a lot of the hard-wired junk that is present... 52 // extra entry layer is no longer generated for any WORK folders 53 // 44 54 Function V_LoadHDF5Data(file,folder) 45 55 String file,folder … … 52 62 destPath = "root:Packages:NIST:VSANS:"+folder 53 63 54 if(cmpstr(folder,"RAW")==0) 55 // base_name="entry" 56 base_name="RAW" // this acts as a flag to remove the duplicate "entry" level 57 else 58 // null will use the file name as the top level (above entry) 59 base_name="" //TODO -- remove this / change behavior in V_LoadHDF5_NoAtt() 60 endif 61 62 Variable err= V_LoadHDF5_NoAtt(file,base_name) // reads into current folder 64 Variable err= V_LoadHDF5_NoAtt(file,folder) // reads into current folder 63 65 64 66 // if RAW data, then generate the errors and linear data copy … … 71 73 72 74 // TODO -- once I get "real" data, get rid of this call to force the data to be proper dimensions. 73 V_RedimFakeData() 74 75 // makes data error and linear copy -- DP waves if V_RedimFakeData() called above 75 // V_RedimFakeData() 76 77 V_MakeDataWaves_DP(folder) 78 // V_FakeBeamCenters() 79 // V_FakeScaleToCenter() 80 81 82 // makes data error and linear copy -- DP waves if V_MakeDataWaves_DP() called above 76 83 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 77 84 detStr = StringFromList(ii, ksDetectorListAll, ";") … … 79 86 endfor 80 87 81 82 // TODO -- for the "real" data, may need a step in here to convert integer detector data to DP, or I'll83 // get really odd results from the calculations, and may not even notice.84 // !!!! Where do I actually do this? - this is currently done in Raw_to_work()85 // -- is is better to do here, right as the data is loaded?86 // TODO -- some of this is done in V_RedimFakeData() above - which will disappear once I get real data87 88 89 88 // TODO 90 89 // -- get rid of these fake calibration waves as "real" ones are filled in by NICE 91 92 Execute "MakeFakeCalibrationWaves()"90 // (currently does nothing) 91 // Execute "MakeFakeCalibrationWaves()" 93 92 94 93 // fMakeFakeCalibrationWaves() //skips the alert … … 149 148 End 150 149 150 // fname is the folder = "RAW" 151 Function V_MakeDataWaves_DP(fname) 152 String fname 153 154 Variable ii 155 String detStr 156 157 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 158 detStr = StringFromList(ii, ksDetectorListAll, ";") 159 Wave w = V_getDetectorDataW(fname,detStr) 160 // Wave w_err = V_getDetectorDataErrW(fname,detStr) 161 Redimension/D w 162 // Redimension/D w_err 163 endfor 164 165 return(0) 166 End 167 168 169 151 170 // 152 171 // TODO -- this is all FAKED since all the data arrays are written to hdf as (1,128,128) … … 155 174 // the SetScale parts may be useful later. 156 175 // 176 // This is NOT CALLED anymore. 177 // the rescaling (SetScale) of the data sets is still done separately to a "fake" beam center 157 178 Function V_RedimFakeData() 158 179 … … 295 316 V_putDet_beam_center_y("RAW","B",75) 296 317 297 298 318 V_putDet_beam_center_x("RAW","MB",64) 299 319 V_putDet_beam_center_y("RAW","MB",55) … … 315 335 316 336 317 318 319 320 321 337 V_RescaleToBeamCenter("RAW","MB",64,55) 322 338 V_RescaleToBeamCenter("RAW","MT",64,-8.7) … … 388 404 389 405 // read the data (too bad that HDF5LoadGroup does not read the attributes) 390 if(cmpstr(base_name,"") == 0) 406 // if(cmpstr(base_name,"") == 0) 407 // base_name = StringFromList(0,FileName,".") 408 // endif 409 410 // if base_name is from my list of WORK folders, then base_name = "" 411 // use a stringSwitch? WhichListItem? 412 Variable isFolder = WhichListItem(base_name,ksWorkFolderList) 413 if(isFolder != -1) 414 base_name = "" 415 else 391 416 base_name = StringFromList(0,FileName,".") 392 417 endif 393 if(cmpstr(base_name,"RAW") == 0)394 base_name = ""395 endif396 //base_name = "entry"397 418 398 419 HDF5LoadGroup/Z/L=7/O/R/T=$base_name :, fileID, hdf5Path // recursive … … 856 877 857 878 858 859 860 //////// function to take VCALC information and861 // fill in the simulated information as needed to make a "fake" data file862 //863 // TODO:864 // -- identify all of the necessary bits to change865 // -- maybe want a panel to make it easier to decide what inputs to change in the file866 // -- decide if it's better to write wholesale, or as individual waves867 //868 Macro Copy_VCALC_to_VSANSFile()869 870 String fileName = V_DoSaveFileDialog("pick the file to write to")871 print fileName872 //873 if(strlen(fileName) > 0)874 writeVCALC_to_file(fileName)875 endif876 End877 878 //879 // TODO -- fill this in as needed to get fake data that's different880 //881 Function writeVCALC_to_file(fileName)882 String fileName883 884 885 // the detectors, all 9 + the correct SDD (that accounts for the offset of T/B panels886 // the data itself (as INT32)887 // the front SDD (correct units)888 // the middle SDD (correct units)889 // the back SDD (correct units)890 Variable ii,val891 String detStr892 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1)893 detStr = StringFromList(ii, ksDetectorListAll, ";")894 Duplicate/O $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) tmpData895 Redimension/I tmpData896 tmpData = (tmpData == 2147483647) ? 0 : tmpData //the NaN "mask" in the sim data (T/B only)shows up as an ugly integer897 V_writeDetectorData(fileName,detStr,tmpData)898 899 val = VCALC_getTopBottomSDDOffset(detStr)/10 + VCALC_getSDD(detStr)*100 // make sure value is in cm900 print val901 V_writeDet_distance(fileName,detStr,val)902 903 // x and y pixel sizes for each detector904 //Function VCALC_getPixSizeX(type) // returns the pixel X size, in [cm]905 //Function VCALC_getPixSizeY(type)906 V_writeDet_x_pixel_size(fileName,detStr,VCALC_getPixSizeX(detStr)*10) // data file is expecting mm907 V_writeDet_y_pixel_size(fileName,detStr,VCALC_getPixSizeY(detStr)*10)908 909 // the calibration data for each detector910 //V_writeDetTube_spatialCalib(fname,detStr,inW)911 // and for "B"912 //V_writeDet_cal_x(fname,detStr,inW)913 //V_writeDet_cal_y(fname,detStr,inW)914 915 916 // the dead time for each detector917 // V_writeDetector_deadtime(fname,detStr,inW)918 // TODO: need a new, separate function to write the single deadtime value in/out of "B"919 920 endfor921 922 // TODO testing - delete this923 V_writeDet_beam_center_x(fileName,detStr,321)924 925 926 927 //? other detector geometry - lateral separation?928 929 // the wavelength930 // Variable lam = V_getWavelength("VCALC") //doesn't work, the corresponding folder in VCALC has not been defined931 V_writeWavelength(fileName,VCALC_getWavelength())932 933 // description of the sample934 935 // sample information936 // name, title, etc937 938 // fake the information about the count setup, so I have different numbers to read939 // count time = fake940 941 // monitor count (= imon)942 // returns the number of neutrons on the sample943 //Function VCALC_getImon()944 945 // ?? anything else that I'd like to see on the catalog - I could change them here to see different values946 // different collimation types?947 //948 949 return(0)950 end951 952 953 954 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r990 r993 815 815 //end 816 816 817 // TODO: this may not exist for VSANS???818 Function V_getVS_tilt(fname)819 String fname820 821 String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"822 return(V_getRealValueFromHDF5(fname,path))823 end817 //// DONE - this does not exist for VSANS - per JGB 4/2016 818 //Function V_getVS_tilt(fname) 819 // String fname 820 // 821 // String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt" 822 // return(V_getRealValueFromHDF5(fname,path)) 823 //end 824 824 825 825 Function V_getVSWavelength(fname) … … 1303 1303 //TODO 1304 1304 // 1305 // x and y center in mm is currently not part of the N Exus definition1305 // x and y center in mm is currently not part of the Nexus definition 1306 1306 // does it need to be? 1307 1307 // these lookups will fail if they have not been generated locally! … … 1315 1315 //TODO 1316 1316 // 1317 // x and y center in mm is currently not part of the N Exus definition1317 // x and y center in mm is currently not part of the Nexus definition 1318 1318 // does it need to be? 1319 1319 // these lookups will fail if they have not been generated locally! -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r992 r993 2108 2108 end 2109 2109 2110 // TODO -- this may not exist for VSANS2111 Function V_writeVS_tilt(fname,val)2112 String fname2113 Variable val2114 2115 // String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"2116 2117 Make/O/D/N=1 wTmpWrite2118 // Make/O/R/N=1 wTmpWrite2119 String groupName = "/entry/instrument/beam/monochromator/velocity_selector"2120 String varName = "vs_tilt"2121 wTmpWrite[0] = val2122 2123 variable err2124 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite)2125 if(err)2126 Print "HDF write err = ",err2127 endif2128 // now be sure to kill the data folder to force a re-read of the data next time this file is read in2129 // err = V_KillNamedDataFolder(fname)2130 // if(err)2131 // Print "DataFolder kill err = ",err2132 // endif2133 return(err)2134 end2110 //// DONE - this does not exist for VSANS - per JGB 4/2016 2111 //Function V_writeVS_tilt(fname,val) 2112 // String fname 2113 // Variable val 2114 // 2115 //// String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt" 2116 // 2117 // Make/O/D/N=1 wTmpWrite 2118 //// Make/O/R/N=1 wTmpWrite 2119 // String groupName = "/entry/instrument/beam/monochromator/velocity_selector" 2120 // String varName = "vs_tilt" 2121 // wTmpWrite[0] = val 2122 // 2123 // variable err 2124 // err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 2125 // if(err) 2126 // Print "HDF write err = ",err 2127 // endif 2128 // // now be sure to kill the data folder to force a re-read of the data next time this file is read in 2129 //// err = V_KillNamedDataFolder(fname) 2130 //// if(err) 2131 //// Print "DataFolder kill err = ",err 2132 //// endif 2133 // return(err) 2134 //end 2135 2135 2136 2136 Function V_writeVSWavelength(fname,val) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf
r992 r993 160 160 161 161 // lookup waves for log and linear display of images 162 // this is used for the main data display. With this, I can use the original 163 // detector data (no copy) and the zeros in the data set are tolerated when displaying 164 // on log scale 162 165 SetDataFolder root:Packages:NIST:VSANS:Globals 163 166 Variable num,val,offset -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r984 r993 146 146 End 147 147 148 // TODO -- fill in with a proper reader that will display the mask(s) 148 149 Proc ReadMask_MainButtonProc(ctrlName) : ButtonControl 149 150 String ctrlName 150 151 151 ReadMask() 152 DoAlert 0, "Loading FAKE MASK data" 153 LoadFakeMaskData() 152 154 End 153 155 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf
r992 r993 54 54 FakeTabClick(1) 55 55 FakeTabClick(0) 56 57 // either clear the status, or fake a click 58 // root:Packages:NIST:VSANS:Globals:gStatusText = "status info box" 59 60 FakeStatusButtonClick() 61 62 56 63 // DoWindow/T VSANS_Data,type + " VSANS_Data" 57 64 … … 79 86 String/G gCurTitle = "" 80 87 String/G gCurDispType = "" 88 String/G gStatusText = "status info box" 81 89 82 90 SetDataFolder root: … … 129 137 130 138 TitleBox title_file,pos={606,178},size={76,20},variable= file_name 131 TitleBox title_status,pos={606,210},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gCurDispFile 139 TitleBox title_dataPresent,pos={606,210},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gCurDispFile 140 TitleBox title_status,pos={606,240},size={200,200},variable= root:Packages:NIST:VSANS:Globals:gStatusText 132 141 133 142 Button button_tagFile,pos={603,412},size={70,20},proc=TagFileButtonProc,title="Tag File" … … 554 563 End 555 564 565 // fake status button click 566 Function FakeStatusButtonClick() 567 568 STRUCT WMButtonAction ba 569 ba.eventCode = 2 570 StatusButtonProc(ba) 571 572 return(0) 573 End 556 574 557 575 // fake click on each tab to populate the data … … 678 696 // 679 697 // gets the status of the currently displayed file and dumps it to the panel (not the cmd window) 680 // - lots to decide here about what is the important stuff to display. There's a lot more information now698 // - lots to decide here about what is the important stuff to display. There's a lot more information for VSANS 681 699 // 682 700 Function StatusButtonProc(ba) : ButtonControl … … 686 704 case 2: // mouse up 687 705 // click code here 706 707 // figure out wether to display per carraige, or the whole file 708 SVAR str = root:Packages:NIST:VSANS:Globals:gStatusText 709 SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType //what folder 710 // which tab active 711 ControlInfo/W=VSANS_Data tab0 712 Variable curTab = V_value 713 714 str = "Current data is from "+ type + "\r" 715 str += "Description = "+V_getSampleDescription(type) + "\r" 716 str += "Wavelength is "+num2str(V_getWavelength(type)) + " A \r" 717 if(curTab == 2) 718 str += "SDD B = "+num2str(V_getDet_distance(type,"B")) + " cm \r" //V_getDet_distance(fname,detStr) 719 endif 720 if(curTab == 1) 721 str += "SDD ML = "+num2str(V_getDet_distance(type,"ML")) + " cm \r" 722 str += "SDD MR = "+num2str(V_getDet_distance(type,"MR")) + " cm \r" 723 str += "SDD MT = "+num2str(V_getDet_distance(type,"MT")) + " cm \r" 724 str += "SDD MB = "+num2str(V_getDet_distance(type,"MB")) + " cm \r" 725 endif 726 if(curTab == 0) 727 str += "SDD FL = "+num2str(V_getDet_distance(type,"FL")) + " cm \r" 728 str += "SDD FR = "+num2str(V_getDet_distance(type,"FR")) + " cm \r" 729 str += "SDD FT = "+num2str(V_getDet_distance(type,"FT")) + " cm \r" 730 str += "SDD FB = "+num2str(V_getDet_distance(type,"FB")) + " cm \r" 731 endif 732 733 734 735 736 688 737 break 689 738 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r992 r993 416 416 // (2) non-linear correction 417 417 // TODO: 418 // -- currently, the "B" detector is skipped418 // x- currently, the "B" detector is skipped 419 419 // -- document what is generated here: 420 420 // **in each detector folder: data_realDistX and data_realDistY (2D waves of the mm? position of the pixel) … … 422 422 // data to be properly displayed, but without all of the (complete) set of corrections 423 423 // * the corrected distances are calculated into arrays, but nothing is done with them yet 424 // * there is enough information now to calculate the q-arrays -other corrections modify the data 424 // * there is enough information now to calculate the q-arrays 425 // -other corrections modify the data, this does NOT 425 426 NVAR gDoNonLinearCor = root:Packages:NIST:VSANS:Globals:gDoNonLinearCor 426 427 // generate a distance matrix for each of the detectors … … 485 486 // -- B detector is a special case (do separately, then loop over NoB) 486 487 NVAR gDoDeadTimeCor = root:Packages:NIST:VSANS:Globals:gDoDeadTimeCor 487 ctTime = V_getCount_time(fname)488 488 if (gDoDeadTimeCor == 1) 489 489 Print "Doing DeadTime correction"// for "+ detStr … … 492 492 Wave w = V_getDetectorDataW(fname,detStr) 493 493 Wave w_err = V_getDetectorDataErrW(fname,detStr) 494 494 ctTime = V_getCount_time(fname) 495 495 496 if(cmpstr(detStr,"B") == 0) 496 497 Variable b_dt = V_getDetector_deadtime_B(fname,detStr) … … 510 511 511 512 else 513 // do the corrections for 8 tube panels 514 512 515 Wave w_dt = V_getDetector_deadtime(fname,detStr) 513 // do the corrections for 8 tube panels514 516 // DeadTimeCorrectionTubes(w,w_err,w_dt,ctTime) 517 515 518 516 519 endif
Note: See TracChangeset
for help on using the changeset viewer.