Ignore:
Timestamp:
May 4, 2010 10:47:11 AM (13 years ago)
Author:
srkline
Message:

Added flag /MAT on GenCurveFit? to actially generate the W_sigma error estimates and passed the values of the "V_" variables back to the wrapper for display and reports.

Changed how the USANS simulator calculates the number of points from the range and increment to match what is actually done on USANS.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/GeneticOptimization/NCNR_GenFitUtils.ipf

    r570 r704  
    180180        WAVE/Z bar.ffsWaves[0] = fs.resW                //will not exist for 3-column data sets 
    181181         
     182 
    182183        //need to parse limits, or make up some defaults 
    183184        // limits is (n,2) 
     
    243244 
    244245        Variable t0 = stopMStimer(-2) 
    245         Variable/G root:num_evals=0 
    246         Variable/G root:V_chisq,root:V_npnts 
    247         NVAR chi = root:V_chisq 
    248         NVAR pt = root:V_npnts 
    249         NVAR num=root:num_evals 
    250          
     246 
     247 
     248         
     249        Variable/G root:num_evals               //for my own tracking 
     250        NVAR num = root:num_evals 
    251251        num=0 
    252252 
     
    278278                         
    279279                if(useRes && useCursors) 
    280                         GenCurveFit /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=trimS /D=fitYw GeneticFit_SmearedModel,bar.y,bar.w,holdStr,limits 
     280                        GenCurveFit/MAT /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=trimS /D=fitYw GeneticFit_SmearedModel,bar.y,bar.w,holdStr,limits 
    281281                        break 
    282282                endif 
    283283                if(useRes) 
    284                         GenCurveFit /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=sw /D=fitYw GeneticFit_SmearedModel,bar.y,bar.w,holdStr,limits 
     284                        GenCurveFit/MAT /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=sw /D=fitYw GeneticFit_SmearedModel,bar.y,bar.w,holdStr,limits 
    285285                        break 
    286286                endif 
     
    288288                //no resolution 
    289289                if(!useRes && useCursors) 
    290                         GenCurveFit /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=trimS /D=fitYw GeneticFit_UnSmearedModel,bar.y,bar.w,holdStr,limits 
     290                        GenCurveFit/MAT /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=trimS /D=fitYw GeneticFit_UnSmearedModel,bar.y,bar.w,holdStr,limits 
    291291                        break 
    292292                endif 
    293293                if(!useRes) 
    294                         GenCurveFit /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=sw /D=fitYw GeneticFit_UnSmearedModel,bar.y,bar.w,holdStr,limits 
     294                        GenCurveFit/MAT /STRC=bar /X=bar.x[0] /I=1 /TOL=(kGenOp_tol) /W=sw /D=fitYw GeneticFit_UnSmearedModel,bar.y,bar.w,holdStr,limits 
    295295                        break 
    296296                endif 
     
    299299#endif 
    300300         
     301//      NVAR V_chisq = V_chisq 
     302//      NVAR V_npnts = V_npnts 
     303//      NVAR V_fitIters = V_fitIters 
     304        WAVE/Z W_sigma = W_sigma 
     305         
     306        val = V_npnts           //return this as a parameter 
    301307         
    302308        t0 = (stopMSTimer(-2) - t0)*1e-6 
    303309        Printf  "fit time = %g seconds\r\r",t0 
    304                          
     310        Print W_sigma    
     311        Print "number of iterations = ",V_fitIters 
    305312        Print "number of function evaluations = ",num 
    306  
    307         return(chi) 
     313        Print "Chi-squared = ",V_chisq 
     314         
     315        return(V_chisq) 
    308316end 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf

    r693 r704  
    868868 
    869869        do 
    870 //              Variable t0 = stopMStimer(-2)           // corresponding print is at the end of the do-while loop (outside) 
     870                Variable t0 = stopMStimer(-2)           // corresponding print is at the end of the do-while loop (outside) 
    871871 
    872872 
     
    988988        while(0) 
    989989         
    990 //      t0 = (stopMSTimer(-2) - t0)*1e-6 
    991 //      Printf  "fit time = %g seconds\r\r",t0 
     990        t0 = (stopMSTimer(-2) - t0)*1e-6 
     991        Printf  "fit time = %g seconds\r\r",t0 
    992992         
    993993        // append the fit 
     
    10491049                DoUpdate                //force an update of the graph before making a copy of it for the report 
    10501050 
     1051                //if GenCurveFit used, V_startRow and V_endRow may not exist - so read the cursors? but the cursors may not be used, so  
     1052                // there won't be anything on the graph... 
     1053                // 
    10511054                W_GenerateReport(funcStr,folderStr,$parStr,cw,yesSave,V_chisq,W_sigma,V_npnts,V_FitError,V_FitQuitReason,V_startRow,V_endRow,topGraph) 
    10521055        endif 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/U_CALC.ipf

    r689 r704  
    529529                        NVAR Incr = $("root:Packages:NIST:USANS:Globals:U_Sim:"+"gIncr"+ns) 
    530530                         
    531                         NumPts = trunc( (thetaMax - ThetaMin) / incr ) 
     531                        NumPts = trunc( (thetaMax - ThetaMin) / incr ) + 1                      //+1 to count both ends of the interval 
    532532                 
    533533                        CalcTotalCountTime() 
     
    580580 
    581581// new way - to spread the points out over the specified angle range 
    582                         incr = (thetaMax - thetaMin) / numpts 
     582                        incr = (thetaMax - thetaMin) /( numpts -1 )                     //-1 since end points are both counted 
    583583                         
    584584                        CalcTotalCountTime() 
Note: See TracChangeset for help on using the changeset viewer.