- Timestamp:
- Apr 30, 2019 12:17:29 PM (4 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Combine_1D.ipf
r1099 r1148 72 72 Button AllQ,help={"Show the full q-range of the dataset"} 73 73 74 Button button1,pos={225,36},size={1 00,20},proc=V_TrimWaves2StringButton,title="Wave 2 Str"74 Button button1,pos={225,36},size={140,20},proc=V_TrimWaves2StringButton,title="Save Trim Points" 75 75 Button button1,help={"Convert the waves to global strings"} 76 76 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf
r1144 r1148 733 733 Button SortLambdaButton, pos={25,188}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Lambda" 734 734 Button SortCountTimButton, pos={25,218}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Count Time" 735 Button Sort TotalCountsButton, pos={25,248}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Total Counts"736 Button SortCountRate Button, pos={25,278}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Count Rate"735 Button SortSDDFButton, pos={25,248}, size={140,24},proc=V_CatVSANSTable_SortProc,title="SDD F" 736 Button SortCountRateFButton, pos={25,278}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Count Rate F" 737 737 Button SortMonitorCountsButton, pos={25,308}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Monitor Counts" 738 738 Button SortTransmissionButton, pos={25,338}, size={140,24},proc=V_CatVSANSTable_SortProc,title="Transmission" … … 854 854 break 855 855 856 case "Sort TotalCountsButton":856 case "SortSDDFButton": 857 857 // Sort GTotCnts, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR 858 858 // Sort GTotCnts, GPurpose, GFilenames, GLabels, GDateTime, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GNumAttens, GRot, GTemp, GField, GMCR, GIntent, G_ID 859 sortKey = " TotCnts"860 861 break 862 863 case "SortCountRate Button":859 sortKey = "SDD_F" 860 861 break 862 863 case "SortCountRateFButton": 864 864 // Sort GCntRate, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR 865 865 // Sort GCntRate, GPurpose, GFilenames, GLabels, GDateTime, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GNumAttens, GRot, GTemp, GField, GMCR, GIntent, G_ID 866 sortKey = "CntRate "866 sortKey = "CntRate_F" 867 867 868 868 break … … 890 890 891 891 //do the sort 892 sprintf cmd, "Sort %s, %s", sortKey,list 892 // sprintf cmd, "Sort %s, %s", sortKey,list 893 // use braces and second key to keep anything with the same first "key" value in numerical run number order 894 sprintf cmd, "Sort {%s,Filenames} %s", sortKey,list 893 895 // Print cmd // For debugging 894 896 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1134 r1148 1089 1089 Variable/G root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle = 30 1090 1090 Variable/G root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ = 10 1091 1092 // check for a mask, if not present, generate a default mask 1093 String str="FT" 1094 wave/Z maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 1095 if(!WaveExists(maskW)) 1096 V_GenerateDefaultMask() 1097 endif 1091 1098 1092 1099 Execute "V_Display_Det_Panels()" … … 1129 1136 SetVariable setvar1,limits={0,1,0.001},value=root:Packages:NIST:VSANS:Globals:Mask:gAnnularDQ 1130 1137 SetVariable setvar2,pos={200,40},size={140,23},title="Sector Angle (deg)" 1131 SetVariable setvar2,limits={ 0,359,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle1138 SetVariable setvar2,limits={-90,90,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle 1132 1139 SetVariable setvar3,pos={200,70},size={140,23},title="Sector (+/-) (deg)" 1133 SetVariable setvar3,limits={0, 359,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ1140 SetVariable setvar3,limits={0,90,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ 1134 1141 1135 1142 PopupMenu popup4,pos={200,100},size={90,23.00},title="Sector Side(s)"//,proc=V_DummyPopMenuProc -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r1146 r1148 54 54 "Patch NumberOfGuides_SSD_Aperture ",V_Patch_Guide_SSD_Aperture() 55 55 "Patch Beam Stop",V_Patch_BeamStop() 56 "Patch Sample Aperture",V_Patch_SampleAperture2() 56 57 End 57 58 SubMenu "File Tests" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1142 r1148 2941 2941 V_fPatch_Guide_SSD_Aperture(lo,hi,numGuideStr,sourceDiam_mm) 2942 2942 End 2943 2944 2943 2945 2944 2946 // simple utility to patch all three at once, since they are all linked and typically … … 3101 3103 3102 3104 3103 3105 Proc V_Patch_SampleAperture2(lo,hi,ShapeStr,diam,width,height) 3106 Variable lo,hi 3107 String shapeStr="CIRCLE" 3108 Variable diam,width,height 3109 3110 V_fPatch_SampleAperture2(lo,hi,ShapeStr,diam,width,height) 3111 End 3112 3113 // 3114 // lo is the first file number 3115 // hi is the last file number (inclusive) 3116 // 3117 // Patches sample aperture (2), the external aperture 3118 // 3119 // dimensions are expected to be in [cm] 3120 // 3121 Function V_fPatch_SampleAperture2(lo,hi,ShapeStr,diam,width,height) 3122 Variable lo,hi 3123 String ShapeStr 3124 Variable diam,width,height 3125 3126 Variable jj 3127 String fname,detStr 3128 3129 3130 //loop over all files 3131 for(jj=lo;jj<=hi;jj+=1) 3132 fname = V_FindFileFromRunNumber(jj) 3133 if(strlen(fname) != 0) 3134 3135 V_writeSampleAp2_shape(fname,ShapeStr) 3136 if(cmpstr("CIRCLE",ShapeStr)==0) 3137 V_writeSampleAp2_size(fname,diam) 3138 else 3139 //RECTANGLE 3140 V_writeSampleAp2_height(fname,height) 3141 V_writeSampleAp2_width(fname,width) 3142 endif 3143 3144 else 3145 printf "run number %d not found\r",jj 3146 endif 3147 endfor 3148 3149 3150 return(0) 3151 End 3152 3153 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Sector_Average.ipf
r1126 r1148 39 39 // 0 = keep the point 40 40 // 1 = yes, mask the point 41 // 42 // 43 // phiCtr is in the range (-90,90) degrees 44 // delta is in the range (0,90) for a total width of 2*delta = 180 degrees 45 // 41 46 Function V_MarkSectorOverlayPixels(phi,overlay,phiCtr,delta,side) 42 47 Wave phi,overlay … … 53 58 Variable yDim=DimSize(phi, 1) 54 59 55 Variable ii,jj,exclude,mirror_phiCtr,crossZero 56 57 // does the +- delta cross 0? 58 crossZero = 0 59 if((phiCtr - delta) < 0) 60 crossZero = 1 61 endif 62 if((phiCtr + delta) > 2*pi) 63 crossZero = 1 64 endif 65 // if "both", what is the mirror_phiCtr? 66 if(cmpstr(side,"both")==0) 67 if(phiCtr < pi) 68 mirror_phiCtr = phiCtr + pi 69 else 70 mirror_phiCtr = phiCtr - pi 71 endif 72 endif 73 60 Variable ii,jj,exclude,mirror_phiCtr,crossZero,keepPix 61 74 62 // initialize the mask to == 1 == exclude everything 75 63 overlay = 1 76 64 77 78 65 // now give every opportunity to keep pixel in 66 // comparisons use a modified phiCtr to match the definition of the phi field (0= +x-axis) 67 // 79 68 for(ii=0;ii<xDim;ii+=1) 80 69 for(jj=0;jj<yDim;jj+=1) 81 70 //qTot = sqrt(qx[ii]^2 + qy[ii]^2+ qz[ii]^2) 82 71 phiVal = phi[ii][jj] 83 exclude = 1 84 85 // sector as defined 86 if(V_CloseEnough(phiVal,phiCtr,delta)) 87 exclude = 0 72 keepPix = 0 //start with not keeping 73 74 // if within the right or left, flag to keep the pixel 75 if(cmpstr(side,"right")==0) 76 //right, when 0->pi/2 77 if(V_CloseEnough(phiVal,phiCtr,delta)) 78 keepPix = 1 79 endif 80 // condition here to get the 3pi/2 -> 2pi region 81 if(V_CloseEnough(phiVal,phiCtr+2*pi,delta)) 82 keepPix = 1 83 endif 88 84 endif 89 //if sector crosses zero, pick up the rest of the sector 90 if(crossZero) 91 if(V_CloseEnough(phiVal-2*pi,phiCtr,delta)) 92 exclude = 0 93 endif 94 if(V_CloseEnough(phiVal+2*pi,phiCtr,delta)) 95 exclude = 0 85 86 if(cmpstr(side,"left")==0) 87 if(V_CloseEnough(phiVal,phiCtr+pi,delta)) 88 keepPix = 1 96 89 endif 97 90 endif 98 99 // mirror phi if needed 100 if(cmpstr(side,"both")==0) 101 if(V_CloseEnough(phiVal,mirror_phiCtr,delta)) 102 exclude = 0 103 endif 91 92 // both sides, duplicates the conditions above 93 if(cmpstr(side,"both")==0) 94 //right, when 0->pi/2 95 if(V_CloseEnough(phiVal,phiCtr,delta)) 96 keepPix = 1 97 endif 98 // right, when 3pi/2 -> 2pi 99 if(V_CloseEnough(phiVal,phiCtr+2*pi,delta)) 100 keepPix = 1 101 endif 102 103 //left 104 if(V_CloseEnough(phiVal,phiCtr+pi,delta)) 105 keepPix = 1 106 endif 107 104 108 endif 105 109 106 // if only right or left, exclude everything as needed 107 if(cmpstr(side,"right")==0) 108 //if phi is actually on the left 109 if(phiCtr > pi/2 && phiCtr < 3*pi/2) 110 exclude = 1 111 endif 110 // set the mask value (entire overlay initialized to 1 to start) 111 if(keepPix > 0) 112 overlay[ii][jj] = 0 112 113 endif 113 if(cmpstr(side,"left")==0) 114 //if phi is actually on the right 115 if( (phiCtr > 0 && phiCtr < pi/2) || (phiCtr > 3*pi/2 && phiCtr < 2*pi) ) 116 exclude = 1 117 endif 118 endif 119 120 // set the mask value 121 overlay[ii][jj] = exclude 114 122 115 endfor 123 116 endfor … … 657 650 endif 658 651 659 phiVal = phi[ii][jj] 660 isIn = V_CloseEnough(phiVal,phi_rad,dphi_rad) // 0 | 1 test within the sector? 661 662 //check if pixel lies within allowed sector(s) 663 if(cmpstr(side,"both")==0) //both sectors 664 // don't change anything (use any pixels in the sector range) 665 else 666 if(cmpstr(side,"left")==0) // want "left" side of detector sector only 667 if(phiVal > pi/2 && phiVal < 3*pi/2) 668 //it's the left, do nothing 669 else 670 isIn = 0 //ignore the pixel 671 endif 672 else 673 // want the right side only 674 if(phiVal > pi/2 && phiVal < 3*pi/2) 675 //it's the left, ignore the pixel 676 isIn = 0 677 else 678 //it's in the right, do nothing 679 endif 680 // 681 Endif 682 Endif //allowable "side" 683 684 685 if (numType(val)==0 && mask_val == 0 && isIn) //count only the good points, in the sector, and ignore Nan or Inf 652 phiVal = phi[ii][jj] 653 isIn = 0 // start with exclude, now see if it's a keeper 654 655 // if within the right or left, flag to keep the pixel 656 if(cmpstr(side,"right")==0) 657 //right, when 0->pi/2 658 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 659 isIn = 1 660 endif 661 // condition here to get the 3pi/2 -> 2pi region 662 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 663 isIn = 1 664 endif 665 endif 666 667 if(cmpstr(side,"left")==0) 668 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 669 isIn = 1 670 endif 671 endif 672 673 // both sides, duplicates the conditions above 674 if(cmpstr(side,"both")==0) 675 //right, when 0->pi/2 676 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 677 isIn = 1 678 endif 679 // right, when 3pi/2 -> 2pi 680 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 681 isIn = 1 682 endif 683 684 //left 685 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 686 isIn = 1 687 endif 688 689 endif //end the check of phiVal within sector and side 690 691 692 if (numType(val)==0 && mask_val == 0 && isIn > 0) //count only the good points, in the sector, and ignore Nan or Inf 686 693 iBin_qxqy[binIndex] += val 687 694 iBin2_qxqy[binIndex] += val*val … … 715 722 716 723 phiVal = phi2[ii][jj] 717 isIn = V_CloseEnough(phiVal,phi_rad,dphi_rad) // 0 | 1 test within the sector? 718 719 //check if pixel lies within allowed sector(s) 720 if(cmpstr(side,"both")==0) //both sectors 721 // don't change anything (use any pixels in the sector range) 722 else 723 if(cmpstr(side,"left")==0) // want "left" side of detector sector only 724 if(phiVal > pi/2 && phiVal < 3*pi/2) 725 //it's the left, do nothing 726 else 727 isIn = 0 //ignore the pixel 728 endif 729 else 730 // want the right side only 731 if(phiVal > pi/2 && phiVal < 3*pi/2) 732 //it's the left, ignore the pixel 733 isIn = 0 734 else 735 //it's in the right, do nothing 736 endif 737 // 738 Endif 739 Endif //allowable "side" 740 741 742 if (numType(val)==0 && mask_val == 0 && isIn) //count only the good points, ignore Nan or Inf 724 isIn = 0 // start with exclude, now see if it's a keeper 725 726 // if within the right or left, flag to keep the pixel 727 if(cmpstr(side,"right")==0) 728 //right, when 0->pi/2 729 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 730 isIn = 1 731 endif 732 // condition here to get the 3pi/2 -> 2pi region 733 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 734 isIn = 1 735 endif 736 endif 737 738 if(cmpstr(side,"left")==0) 739 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 740 isIn = 1 741 endif 742 endif 743 744 // both sides, duplicates the conditions above 745 if(cmpstr(side,"both")==0) 746 //right, when 0->pi/2 747 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 748 isIn = 1 749 endif 750 // right, when 3pi/2 -> 2pi 751 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 752 isIn = 1 753 endif 754 755 //left 756 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 757 isIn = 1 758 endif 759 760 endif //end the check of phiVal within sector and side 761 762 763 if (numType(val)==0 && mask_val == 0 && isIn > 0) //count only the good points, ignore Nan or Inf 743 764 iBin_qxqy[binIndex] += val 744 765 iBin2_qxqy[binIndex] += val*val … … 770 791 771 792 phiVal = phi3[ii][jj] 772 isIn = V_CloseEnough(phiVal,phi_rad,dphi_rad) // 0 | 1 test within the sector? 773 774 //check if pixel lies within allowed sector(s) 775 if(cmpstr(side,"both")==0) //both sectors 776 // don't change anything (use any pixels in the sector range) 777 else 778 if(cmpstr(side,"left")==0) // want "left" side of detector sector only 779 if(phiVal > pi/2 && phiVal < 3*pi/2) 780 //it's the left, do nothing 781 else 782 isIn = 0 //ignore the pixel 783 endif 784 else 785 // want the right side only 786 if(phiVal > pi/2 && phiVal < 3*pi/2) 787 //it's the left, ignore the pixel 788 isIn = 0 789 else 790 //it's in the right, do nothing 791 endif 792 // 793 Endif 794 Endif //allowable "side" 795 796 if (numType(val)==0 && mask_val == 0 && isIn) //count only the good points, ignore Nan or Inf 793 isIn = 0 // start with exclude, now see if it's a keeper 794 795 // if within the right or left, flag to keep the pixel 796 if(cmpstr(side,"right")==0) 797 //right, when 0->pi/2 798 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 799 isIn = 1 800 endif 801 // condition here to get the 3pi/2 -> 2pi region 802 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 803 isIn = 1 804 endif 805 endif 806 807 if(cmpstr(side,"left")==0) 808 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 809 isIn = 1 810 endif 811 endif 812 813 // both sides, duplicates the conditions above 814 if(cmpstr(side,"both")==0) 815 //right, when 0->pi/2 816 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 817 isIn = 1 818 endif 819 // right, when 3pi/2 -> 2pi 820 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 821 isIn = 1 822 endif 823 824 //left 825 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 826 isIn = 1 827 endif 828 829 endif //end the check of phiVal within sector and side 830 831 if (numType(val)==0 && mask_val == 0 && isIn > 0) //count only the good points, ignore Nan or Inf 797 832 iBin_qxqy[binIndex] += val 798 833 iBin2_qxqy[binIndex] += val*val … … 821 856 822 857 phiVal = phi4[ii][jj] 823 isIn = V_CloseEnough(phiVal,phi_rad,dphi_rad) // 0 | 1 test within the sector? 824 825 //check if pixel lies within allowed sector(s) 826 if(cmpstr(side,"both")==0) //both sectors 827 // don't change anything (use any pixels in the sector range) 828 else 829 if(cmpstr(side,"left")==0) // want "left" side of detector sector only 830 if(phiVal > pi/2 && phiVal < 3*pi/2) 831 //it's the left, do nothing 832 else 833 isIn = 0 //ignore the pixel 834 endif 835 else 836 // want the right side only 837 if(phiVal > pi/2 && phiVal < 3*pi/2) 838 //it's the left, ignore the pixel 839 isIn = 0 840 else 841 //it's in the right, do nothing 842 endif 843 // 844 Endif 845 Endif //allowable "side" 846 847 if (numType(val)==0 && mask_val == 0 && isIn) //count only the good points, ignore Nan or Inf 858 isIn = 0 // start with exclude, now see if it's a keeper 859 860 // if within the right or left, flag to keep the pixel 861 if(cmpstr(side,"right")==0) 862 //right, when 0->pi/2 863 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 864 isIn = 1 865 endif 866 // condition here to get the 3pi/2 -> 2pi region 867 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 868 isIn = 1 869 endif 870 endif 871 872 if(cmpstr(side,"left")==0) 873 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 874 isIn = 1 875 endif 876 endif 877 878 // both sides, duplicates the conditions above 879 if(cmpstr(side,"both")==0) 880 //right, when 0->pi/2 881 if(V_CloseEnough(phiVal,phi_rad,dphi_rad)) 882 isIn = 1 883 endif 884 // right, when 3pi/2 -> 2pi 885 if(V_CloseEnough(phiVal,phi_rad+2*pi,dphi_rad)) 886 isIn = 1 887 endif 888 889 //left 890 if(V_CloseEnough(phiVal,phi_rad+pi,dphi_rad)) 891 isIn = 1 892 endif 893 894 endif //end the check of phiVal within sector and side 895 896 if (numType(val)==0 && mask_val == 0 && isIn > 0) //count only the good points, ignore Nan or Inf 848 897 iBin_qxqy[binIndex] += val 849 898 iBin2_qxqy[binIndex] += val*val
Note: See TracChangeset
for help on using the changeset viewer.