- Timestamp:
- Feb 22, 2013 3:21:48 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Auto_Fit.ipf
r828 r901 1565 1565 Variable Number_of_Parameters=7 1566 1566 fCompile_Reports(Number_of_Parameters) 1567 fCompile_ReportsTable(Number_of_Parameters) 1567 1568 End 1568 1569 … … 1632 1633 Notebook Compilation selection={startOfFile,startOfFile} 1633 1634 End 1635 1636 //// 1637 // compiles the results into a table. 1638 Function fCompile_ReportsTable(nPar) 1639 Variable nPar 1640 1641 String list=WinList("*", ";", "WIN:16") 1642 String item = "",textStr="",newStr="",str 1643 Variable sstop,dum,chi 1644 1645 Variable ii,numRep,jj,val1,val2,pt 1646 numRep=ItemsInList(list,";") 1647 1648 Make/O/T/N=(numRep) fittedFiles 1649 Make/O/D/N=(numRep) chiSQ 1650 Edit fittedFiles,chiSQ 1651 1652 for(ii=0;ii<nPar;ii+=1) //waves for the parameters 1653 Make/O/D/N=(numRep) $("par"+num2str(ii)),$("par"+num2str(ii)+"_err") 1654 AppendToTable $("par"+num2str(ii)),$("par"+num2str(ii)+"_err") 1655 endfor 1656 1657 for(jj=0;jj<numRep;jj+=1) 1658 1659 item=StringFromList(jj,list,";") 1660 DoWindow/F $item 1661 Notebook $item selection={(2,0), (3,0)} //paragraph 3 (starts from 0) = filename 1662 GetSelection notebook,$item,2 1663 textStr=S_Selection 1664 textStr=textStr[0,strlen(textStr)-2] //remove CR 1665 textStr=textStr[10,strlen(textStr)-1] //remove "DATA FILE: 1666 1667 fittedFiles[jj] = textStr 1668 // 1669 // results are written as: "%s = \t%g\t±\t%g\r" 1670 // 1671 for(ii=0;ii<nPar;ii+=1) //gather the parameters 1672 Notebook $item selection={(ii+4,0), (ii+5,0)} //paragraph 5 = parameter 0 1673 GetSelection notebook,$item,2 1674 textStr=S_Selection 1675 textStr=textStr[0,strlen(textStr)-2] 1676 // find the "=" 1677 pt = strsearch(textStr,"=",0,0) 1678 textStr = textStr[pt,strlen(textStr)-1] 1679 sscanf textStr,"= \t%g\t ± \t%g\r",val1,val2 1680 1681 Print textStr 1682 1683 Wave w1 = $("par"+num2str(ii)) 1684 Wave w2 = $("par"+num2str(ii)+"_err") 1685 1686 w1[jj] = val1 1687 w2[jj] = val2 1688 1689 //textStr = ReplaceString("=",textStr,"") 1690 //textStr = ReplaceString("±\t",textStr,"") 1691 //Notebook Compilation text=textStr+"\r" 1692 //printf "%s\r",textStr 1693 //Print strlen(textStr) 1694 endfor 1695 //get the chi-squared/N value 1696 ii += 1 1697 Notebook $item selection={(ii+4,0), (ii+5,0)} // 1698 GetSelection notebook,$item,2 1699 textStr=S_Selection 1700 Print textStr 1701 1702 sscanf textStr,"Npnts = %g\t\tSqrt(X^2/N) = %g\r",dum,chi 1703 1704 chiSQ[jj] = chi 1705 endfor 1706 1707 return(0) 1708 End 1709 1634 1710 1635 1711 ////
Note: See TracChangeset
for help on using the changeset viewer.