Ignore:
Timestamp:
Aug 14, 2007 4:12:23 PM (16 years ago)
Author:
ajj
Message:

Changes:

  • Made USANS weighting matrix double precision
  • Changed Smear_Model_(5,10,20,76) to be AAO and added test for presence of USANS matrix. If the number of columns in the resolution wave is > 4 then do the matrix multiplication, otherwise do gaussian quadrature via Smear_Model_N.
  • Changed Sphere.ipf and SchulzSpheres?.ipf to use AAO form of Smear_Model_20
Location:
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/GaussUtils.ipf

    r144 r145  
    729729// 
    730730// 
    731 Function Smear_Model_5(fcn,w,x,resW)                             
     731Function Smear_Model_5(fcn,w,x,answer,resW)                              
    732732        FUNCREF SANSModelAAO_proto fcn 
    733733        Wave w                  //coefficients of function fcn(w,x) 
    734         Variable x      //x-value (q) for the calculation 
     734        Wave x  //x-value (q) for the calculation 
     735        Wave answer // ywave for calculation result 
    735736        Wave resW               // Nx4 or NxN matrix of resolution 
    736737 
    737738        String weightStr,zStr 
    738         Variable answer,nord=5 
    739          
    740         weightStr = "gauss5wt" 
    741         zStr = "gauss5z" 
    742          
    743 //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
    744         if (WaveExists($weightStr) == 0) // wave reference is not valid,  
    745                 Make/D/N=(nord) $weightStr,$zStr 
    746                 Wave weightW = $weightStr 
    747                 Wave abscissW = $zStr           // wave references to pass 
    748                 Make5GaussPoints(weightW,abscissW)       
     739        Variable nord=5 
     740         
     741        if (dimsize(resW,1) > 4) 
     742                //USANS Weighting matrix is present. 
     743                fcn(w,answer,x) 
     744         
     745                MatrixOP/O  answer = resW x answer 
     746                //Duplicate/O answer,tmpMat 
     747                //MatrixOP/O answer = resW x tmpMat 
     748                Return(0) 
    749749        else 
    750                 if(exists(weightStr) > 1)  
    751                          Abort "wave name is already in use"            //executed only if name is in use elsewhere 
    752                 endif 
    753                 Wave weightW = $weightStr 
    754                 Wave abscissW = $zStr           // create the wave references 
    755         endif 
    756          
    757         answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    758         Return (answer) 
     750                weightStr = "gauss20wt" 
     751                zStr = "gauss20z" 
     752         
     753        //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
     754                if (WaveExists($weightStr) == 0) // wave reference is not valid,  
     755                        Make/D/N=(nord) $weightStr,$zStr 
     756                        Wave weightW = $weightStr 
     757                        Wave abscissW = $zStr           // wave references to pass 
     758                        Make20GaussPoints(weightW,abscissW)      
     759                else 
     760                        if(exists(weightStr) > 1)  
     761                                 Abort "wave name is already in use"            //executed only if name is in use elsewhere 
     762                        endif 
     763                        Wave weightW = $weightStr 
     764                        Wave abscissW = $zStr           // create the wave references 
     765                endif 
     766         
     767                answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     768                Return (0) 
     769        endif 
    759770         
    760771End 
     
    763774// 
    764775// 
    765 Function Smear_Model_10(fcn,w,x,resW)                            
     776Function Smear_Model_10(fcn,w,x,answer,resW)                             
    766777        FUNCREF SANSModelAAO_proto fcn 
    767778        Wave w                  //coefficients of function fcn(w,x) 
    768         Variable x      //x-value (q) for the calculation 
     779        Wave x  //x-value (q) for the calculation 
     780        Wave answer // ywave for calculation result 
    769781        Wave resW               // Nx4 or NxN matrix of resolution 
    770782 
    771783        String weightStr,zStr 
    772         Variable answer,nord=10 
    773          
    774         weightStr = "gauss10wt" 
    775         zStr = "gauss10z" 
    776          
    777 //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
    778         if (WaveExists($weightStr) == 0) // wave reference is not valid,  
    779                 Make/D/N=(nord) $weightStr,$zStr 
    780                 Wave weightW = $weightStr 
    781                 Wave abscissW = $zStr           // wave references to pass 
    782                 Make10GaussPoints(weightW,abscissW)      
     784        Variable nord=10 
     785         
     786        if (dimsize(resW,1) > 4) 
     787                //USANS Weighting matrix is present. 
     788                fcn(w,answer,x) 
     789         
     790                MatrixOP/O  answer = resW x answer 
     791                //Duplicate/O answer,tmpMat 
     792                //MatrixOP/O answer = resW x tmpMat 
     793                Return(0) 
    783794        else 
    784                 if(exists(weightStr) > 1)  
    785                          Abort "wave name is already in use"            //executed only if name is in use elsewhere 
    786                 endif 
    787                 Wave weightW = $weightStr 
    788                 Wave abscissW = $zStr           // create the wave references 
    789         endif 
    790          
    791         answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    792         Return (answer) 
     795                weightStr = "gauss20wt" 
     796                zStr = "gauss20z" 
     797         
     798        //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
     799                if (WaveExists($weightStr) == 0) // wave reference is not valid,  
     800                        Make/D/N=(nord) $weightStr,$zStr 
     801                        Wave weightW = $weightStr 
     802                        Wave abscissW = $zStr           // wave references to pass 
     803                        Make20GaussPoints(weightW,abscissW)      
     804                else 
     805                        if(exists(weightStr) > 1)  
     806                                 Abort "wave name is already in use"            //executed only if name is in use elsewhere 
     807                        endif 
     808                        Wave weightW = $weightStr 
     809                        Wave abscissW = $zStr           // create the wave references 
     810                endif 
     811         
     812                answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     813                Return (0) 
     814        endif 
    793815         
    794816End 
     
    802824//      Wave qvals      //q-values where R(q) is known 
    803825// 
    804 Function Smear_Model_20(fcn,w,x,resW)                            
     826Function Smear_Model_20(fcn,w,x,answer,resW)                             
    805827        FUNCREF SANSModelAAO_proto fcn 
    806828        Wave w                  //coefficients of function fcn(w,x) 
    807         Variable x      //x-value (q) for the calculation 
     829        Wave x  //x-value (q) for the calculation 
     830        Wave answer // ywave for calculation result 
    808831        Wave resW               // Nx4 or NxN matrix of resolution 
    809832 
    810833        String weightStr,zStr 
    811         Variable answer,nord=20 
    812          
    813         weightStr = "gauss20wt" 
    814         zStr = "gauss20z" 
    815          
    816 //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
    817         if (WaveExists($weightStr) == 0) // wave reference is not valid,  
    818                 Make/D/N=(nord) $weightStr,$zStr 
    819                 Wave weightW = $weightStr 
    820                 Wave abscissW = $zStr           // wave references to pass 
    821                 Make20GaussPoints(weightW,abscissW)      
     834        Variable nord=20 
     835         
     836        if (dimsize(resW,1) > 4) 
     837                //USANS Weighting matrix is present. 
     838                fcn(w,answer,x) 
     839         
     840                MatrixOP/O  answer = resW x answer 
     841                //Duplicate/O answer,tmpMat 
     842                //MatrixOP/O answer = resW x tmpMat 
     843                Return(0) 
    822844        else 
    823                 if(exists(weightStr) > 1)  
    824                          Abort "wave name is already in use"            //executed only if name is in use elsewhere 
    825                 endif 
    826                 Wave weightW = $weightStr 
    827                 Wave abscissW = $zStr           // create the wave references 
    828         endif 
    829          
    830         answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    831         Return (answer) 
     845                weightStr = "gauss20wt" 
     846                zStr = "gauss20z" 
     847         
     848        //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
     849                if (WaveExists($weightStr) == 0) // wave reference is not valid,  
     850                        Make/D/N=(nord) $weightStr,$zStr 
     851                        Wave weightW = $weightStr 
     852                        Wave abscissW = $zStr           // wave references to pass 
     853                        Make20GaussPoints(weightW,abscissW)      
     854                else 
     855                        if(exists(weightStr) > 1)  
     856                                 Abort "wave name is already in use"            //executed only if name is in use elsewhere 
     857                        endif 
     858                        Wave weightW = $weightStr 
     859                        Wave abscissW = $zStr           // create the wave references 
     860                endif 
     861         
     862                answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     863                Return (0) 
     864        endif 
    832865         
    833866End 
    834867/////////////////////////////////////////////////////////////// 
    835 Function Smear_Model_76(fcn,w,x,resW)                            
     868Function Smear_Model_76(fcn,w,x,answer,resW)                             
    836869        FUNCREF SANSModelAAO_proto fcn 
    837870        Wave w                  //coefficients of function fcn(w,x) 
    838         Variable x      //x-value (q) for the calculation 
     871        Wave x  //x-value (q) for the calculation 
     872        Wave answer // ywave for calculation result 
    839873        Wave resW               // Nx4 or NxN matrix of resolution 
    840874 
    841  
    842 // local variables 
    843         Variable answer,nord=76 
    844875        String weightStr,zStr 
    845          
    846         weightStr = "gauss76wt" 
    847         zStr = "gauss76z" 
    848          
    849         if (WaveExists($weightStr) == 0) // wave reference is not valid,  
    850                 Make/D/N=(nord) $weightStr,$zStr 
    851                 Wave weightW = $weightStr 
    852                 Wave abscissW = $zStr           // wave references to pass 
    853                 Make76GaussPoints(weightW,abscissW)      
     876        Variable nord=76 
     877         
     878        if (dimsize(resW,1) > 4) 
     879                //USANS Weighting matrix is present. 
     880                fcn(w,answer,x) 
     881         
     882                MatrixOP/O  answer = resW x answer 
     883                //Duplicate/O answer,tmpMat 
     884                //MatrixOP/O answer = resW x tmpMat 
     885                Return(0) 
    854886        else 
    855                 if(exists(weightStr) > 1)  
    856                          Abort "wave name is already in use"            //executed only if name is in use elsewhere 
    857                 endif 
    858                 Wave weightW = $weightStr 
    859                 Wave abscissW = $zStr           // create the wave references 
    860         endif 
    861         answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    862         Return (answer) 
     887                weightStr = "gauss20wt" 
     888                zStr = "gauss20z" 
     889         
     890        //      if wt,z waves don't exist, create them (only check for weight, should really check for both) 
     891                if (WaveExists($weightStr) == 0) // wave reference is not valid,  
     892                        Make/D/N=(nord) $weightStr,$zStr 
     893                        Wave weightW = $weightStr 
     894                        Wave abscissW = $zStr           // wave references to pass 
     895                        Make20GaussPoints(weightW,abscissW)      
     896                else 
     897                        if(exists(weightStr) > 1)  
     898                                 Abort "wave name is already in use"            //executed only if name is in use elsewhere 
     899                        endif 
     900                        Wave weightW = $weightStr 
     901                        Wave abscissW = $zStr           // create the wave references 
     902                endif 
     903         
     904                answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     905                Return (0) 
     906        endif 
     907         
    863908End 
    864909 
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/SchulzSpheres.ipf

    r131 r145  
    215215 
    216216//      the name of your unsmeared model (AAO) is the first argument 
    217         s.yW = Smear_Model_20(SchulzSpheres,s.coefW,s.xW,s.resW) 
     217        Smear_Model_20(SchulzSpheres,s.coefW,s.xW,s.yW,s.resW) 
    218218 
    219219        return(0) 
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Sphere.ipf

    r144 r145  
    163163 
    164164////the name of your unsmeared model is the first argument 
    165         s.yW = Smear_Model_20(SphereForm,s.coefW,s.xW,s.resW) 
     165        Smear_Model_20(SphereForm,s.coefW,s.xW,s.yW,s.resW) 
    166166 
    167167        return(0) 
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/USANS_SlitSmearing.ipf

    r138 r145  
    3131        String/G USANS_basestr = basestr 
    3232 
    33         Make/O/N=(USANS_N,USANS_N) $(basestr+"_res") 
     33        Make/D/O/N=(USANS_N,USANS_N) $(basestr+"_res") 
    3434        //Make/O/N=(N,N) W1mat 
    3535        //Make/O/N=(N,N) W2mat 
Note: See TracChangeset for help on using the changeset viewer.