Ignore:
Timestamp:
Jul 19, 2013 12:06:53 PM (9 years ago)
Author:
srkline
Message:

Adding to batch fitting. Now automatically saves the fit XY waves and coefficients as separate text files that can be loaded and appended later, or imported into a different program.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Auto_Fit.ipf

    r915 r920  
    10331033//              AutoFit_GenerateReport(funcStr,dataname,"par","myCoef",1)        
    10341034        endif 
     1035 
     1036 
     1037// if checked, also write out the fitted waves and coefficients as a text file, maybe an Igor Text format, or just plain text. 
     1038        if(1) 
     1039                AF_SaveFitWaves(dataName,$"myCoef",W_sigma,fitYw,xw) 
     1040        endif 
    10351041         
    10361042        return(0) 
    10371043End 
     1044 
     1045// if checked, also write out the fitted waves and coefficients as a text file, maybe an Igor Text format, or just plain text. 
     1046// 
     1047Function AF_SaveFitWaves(dataName,cw,cw_err,yw,xw) 
     1048        String dataName 
     1049        Wave cw,cw_err,yw,xw 
     1050         
     1051        String saveName,formatStr 
     1052        Variable refNum 
     1053 
     1054        PathInfo dataPath        
     1055        saveName = S_path+dataName+"_fit.txt" 
     1056        formatStr="%15.4g\t%15.4g" 
     1057        formatStr += "\r" 
     1058 
     1059//      Print saveName 
     1060         
     1061        Open refNum as saveName 
     1062         
     1063        fprintf refnum,"Model data created %s\r\n",(date()+" "+time()) 
     1064        wfprintf refnum,formatStr,xw,yw 
     1065                 
     1066        close refnum 
     1067 
     1068        // then the coefficients 
     1069        saveName = S_path+dataName+"_coef.txt" 
     1070        Open refNum as saveName 
     1071         
     1072        fprintf refnum,"Model coefficients and One Std. Deviation %s\r\n",(date()+" "+time()) 
     1073        wfprintf refnum,formatStr,cw,cw_err 
     1074                 
     1075        close refnum 
     1076         
     1077         
     1078        return(0) 
     1079End 
     1080 
     1081 
    10381082 
    10391083//// to be able to simply fill in the pt range of the yw[lo,hi] 
Note: See TracChangeset for help on using the changeset viewer.