Changeset 353 for sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis
- Timestamp:
- May 6, 2008 2:39:24 PM (15 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/GaussUtils_v40.ipf
r325 r353 756 756 Return(0) 757 757 else 758 weightStr = "gauss5wt" 759 zStr = "gauss5z" 760 761 // if wt,z waves don't exist, create them (only check for weight, should really check for both) 762 if (WaveExists($weightStr) == 0) // wave reference is not valid, 763 Make/D/N=(nord) $weightStr,$zStr 764 Wave weightW = $weightStr 765 Wave abscissW = $zStr // wave references to pass 766 Make5GaussPoints(weightW,abscissW) 767 else 768 if(exists(weightStr) > 1) 769 Abort "wave name is already in use" //executed only if name is in use elsewhere 770 endif 771 Wave weightW = $weightStr 772 Wave abscissW = $zStr // create the wave references 773 endif 774 775 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 776 Return (0) 777 endif 778 779 End 780 781 //resolution smearing, using only 10 Gauss points 782 // 783 // 784 Function Smear_Model_10(fcn,w,x,answer,resW) 785 FUNCREF SANSModelAAO_proto fcn 786 Wave w //coefficients of function fcn(w,x) 787 Wave x //x-value (q) for the calculation 788 Wave answer // ywave for calculation result 789 Wave resW // Nx4 or NxN matrix of resolution 790 791 String weightStr,zStr 792 Variable nord=10 793 794 if (dimsize(resW,1) > 4) 795 if(dimsize(resW,1) != dimsize(answer,0) ) 796 Abort "ResW and answer are different dimensions - (res,ans)"+num2str(dimsize(resW,1))+","+num2str(dimsize(answer,0)) 797 endif 798 //USANS Weighting matrix is present. 799 fcn(w,answer,x) 800 801 MatrixOP/O answer = resW x answer 802 //Duplicate/O answer,tmpMat 803 //MatrixOP/O answer = resW x tmpMat 804 Return(0) 805 else 806 weightStr = "gauss10wt" 807 zStr = "gauss10z" 808 809 // if wt,z waves don't exist, create them (only check for weight, should really check for both) 810 if (WaveExists($weightStr) == 0) // wave reference is not valid, 811 Make/D/N=(nord) $weightStr,$zStr 812 Wave weightW = $weightStr 813 Wave abscissW = $zStr // wave references to pass 814 Make10GaussPoints(weightW,abscissW) 815 else 816 if(exists(weightStr) > 1) 817 Abort "wave name is already in use" //executed only if name is in use elsewhere 818 endif 819 Wave weightW = $weightStr 820 Wave abscissW = $zStr // create the wave references 821 endif 822 823 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 824 Return (0) 825 endif 826 827 End 828 829 // 830 //Smear_Model_20(SphereForm,s.coefW,s.yW,s.xW,s.resW) 831 // 832 // Wave sigq //std dev of resolution fn 833 // Wave qbar //mean q-value 834 // Wave shad //beamstop shadow factor 835 // Wave qvals //q-values where R(q) is known 836 // 837 Function Smear_Model_20(fcn,w,x,answer,resW) 838 FUNCREF SANSModelAAO_proto fcn 839 Wave w //coefficients of function fcn(w,x) 840 Wave x //x-value (q) for the calculation 841 Wave answer // ywave for calculation result 842 Wave resW // Nx4 or NxN matrix of resolution 843 NVAR useTrap = root:Packages:NIST:USANSUseTrap 844 845 String weightStr,zStr 846 Variable nord=20 847 848 if (dimsize(resW,1) > 4 && useTrap != 1) 849 if(dimsize(resW,1) != dimsize(answer,0) ) 850 Abort "ResW and answer are different dimensions - (res,ans)"+num2str(dimsize(resW,1))+","+num2str(dimsize(answer,0)) 851 endif 852 //USANS Weighting matrix is present. 853 fcn(w,answer,x) 854 855 MatrixOP/O answer = resW x answer 856 //Duplicate/O answer,tmpMat 857 //MatrixOP/O answer = resW x tmpMat 858 Return(0) 859 else 758 860 weightStr = "gauss20wt" 759 861 zStr = "gauss20z" … … 778 880 779 881 End 780 781 //resolution smearing, using only 10 Gauss points782 //783 //784 Function Smear_Model_10(fcn,w,x,answer,resW)785 FUNCREF SANSModelAAO_proto fcn786 Wave w //coefficients of function fcn(w,x)787 Wave x //x-value (q) for the calculation788 Wave answer // ywave for calculation result789 Wave resW // Nx4 or NxN matrix of resolution790 791 String weightStr,zStr792 Variable nord=10793 794 if (dimsize(resW,1) > 4)795 if(dimsize(resW,1) != dimsize(answer,0) )796 Abort "ResW and answer are different dimensions - (res,ans)"+num2str(dimsize(resW,1))+","+num2str(dimsize(answer,0))797 endif798 //USANS Weighting matrix is present.799 fcn(w,answer,x)800 801 MatrixOP/O answer = resW x answer802 //Duplicate/O answer,tmpMat803 //MatrixOP/O answer = resW x tmpMat804 Return(0)805 else806 weightStr = "gauss20wt"807 zStr = "gauss20z"808 809 // if wt,z waves don't exist, create them (only check for weight, should really check for both)810 if (WaveExists($weightStr) == 0) // wave reference is not valid,811 Make/D/N=(nord) $weightStr,$zStr812 Wave weightW = $weightStr813 Wave abscissW = $zStr // wave references to pass814 Make20GaussPoints(weightW,abscissW)815 else816 if(exists(weightStr) > 1)817 Abort "wave name is already in use" //executed only if name is in use elsewhere818 endif819 Wave weightW = $weightStr820 Wave abscissW = $zStr // create the wave references821 endif822 823 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord)824 Return (0)825 endif826 827 End828 829 //830 //Smear_Model_20(SphereForm,s.coefW,s.yW,s.xW,s.resW)831 //832 // Wave sigq //std dev of resolution fn833 // Wave qbar //mean q-value834 // Wave shad //beamstop shadow factor835 // Wave qvals //q-values where R(q) is known836 //837 Function Smear_Model_20(fcn,w,x,answer,resW)838 FUNCREF SANSModelAAO_proto fcn839 Wave w //coefficients of function fcn(w,x)840 Wave x //x-value (q) for the calculation841 Wave answer // ywave for calculation result842 Wave resW // Nx4 or NxN matrix of resolution843 NVAR useTrap = root:Packages:NIST:USANSUseTrap844 845 String weightStr,zStr846 Variable nord=20847 848 if (dimsize(resW,1) > 4 && useTrap != 1)849 if(dimsize(resW,1) != dimsize(answer,0) )850 Abort "ResW and answer are different dimensions - (res,ans)"+num2str(dimsize(resW,1))+","+num2str(dimsize(answer,0))851 endif852 //USANS Weighting matrix is present.853 fcn(w,answer,x)854 855 MatrixOP/O answer = resW x answer856 //Duplicate/O answer,tmpMat857 //MatrixOP/O answer = resW x tmpMat858 Return(0)859 else860 weightStr = "gauss20wt"861 zStr = "gauss20z"862 863 // if wt,z waves don't exist, create them (only check for weight, should really check for both)864 if (WaveExists($weightStr) == 0) // wave reference is not valid,865 Make/D/N=(nord) $weightStr,$zStr866 Wave weightW = $weightStr867 Wave abscissW = $zStr // wave references to pass868 Make20GaussPoints(weightW,abscissW)869 else870 if(exists(weightStr) > 1)871 Abort "wave name is already in use" //executed only if name is in use elsewhere872 endif873 Wave weightW = $weightStr874 Wave abscissW = $zStr // create the wave references875 endif876 877 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord)878 Return (0)879 endif880 881 End882 882 /////////////////////////////////////////////////////////////// 883 883 Function Smear_Model_76(fcn,w,x,answer,resW) … … 904 904 Return(0) 905 905 else 906 weightStr = "gauss 20wt"907 zStr = "gauss 20z"906 weightStr = "gauss76wt" 907 zStr = "gauss76z" 908 908 909 909 // if wt,z waves don't exist, create them (only check for weight, should really check for both) … … 912 912 Wave weightW = $weightStr 913 913 Wave abscissW = $zStr // wave references to pass 914 Make 20GaussPoints(weightW,abscissW)914 Make76GaussPoints(weightW,abscissW) 915 915 else 916 916 if(exists(weightStr) > 1) -
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/Packages/Wrapper_v40.ipf
r318 r353 343 343 Make/O/D/N=(num) $("epsilon_"+suffix),$("Hold_"+suffix) 344 344 Make/O/T/N=(num) $("LoLim_"+suffix),$("HiLim_"+suffix) 345 Wave eps = $("epsilon_"+suffix) 346 Wave coef=$popStr 347 eps = abs(coef*1e-4) + 1e-10 //default eps is proportional to the coefficients 345 348 endif 346 349 // default epsilon values, sometimes needed for the fit 347 Wave eps = $("epsilon_"+suffix) 348 Wave coef=$popStr 349 eps = abs(coef*1e-4) + 1e-10 //default eps is proportional to the coefficients 350 351 350 352 WAVE/T LoLim = $("LoLim_"+suffix) 351 353 WAVE/T HiLim = $("HiLim_"+suffix) … … 906 908 print "V_chisq = ",V_chisq 907 909 print cw 908 WAVE w_sigma910 WAVE/Z w_sigma 909 911 print w_sigma 910 912 String resultStr=""
Note: See TracChangeset
for help on using the changeset viewer.