Changeset 173


Ignore:
Timestamp:
Oct 1, 2007 1:44:11 PM (15 years ago)
Author:
srkline
Message:

Included a simple report generator (always generates a report, no automatic save) for the GlobalFit? routine. The WM report to the command window is captured and sent to a notebook to create a report similar to the FitWrapper?.

Location:
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Packages
Files:
2 edited

Legend:

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

    r164 r173  
    806806        Duplicate/O MasterCoefs, GlobalFitCoefficients 
    807807         
    808  
     808        Variable histNum=CaptureHistoryStart()          //SRK - for my report 
    809809        if (!quiet) 
    810                 Print "\rGlobal fit results" 
     810                Print "Global fit results" 
    811811                if(V_FitError) 
    812812                                print "\tFit stopped due to an error:" 
     
    846846                Variable firstUserow, firstUsecol, linkIndex 
    847847                Wave W_sigma = root:Packages:NewGlobalFit:W_sigma 
     848                //SRK - adjusting the report format 
     849//              for (i = 0; i < numRows; i += 1) 
     850//                      print "Data Set: ",DataSets[i][0]," vs ",DataSets[i][1],"; Function: ",FitFuncNames[privateLinkage[i][FuncPointerCol]] 
     851//                      for (j = FirstCoefCol; j < (privateLinkage[i][NumFuncCoefsCol] + FirstCoefCol); j += 1) 
     852//                              linkIndex = privateLinkage[i][j] 
     853//                               
     854//                              FirstUseOfIndexInLinkMatrix(linkIndex, privateLinkage, firstUserow, firstUsecol) 
     855//                              printf "\t%d\t%s\t%g +- %g", j-FirstCoefCol, CoefNames[privateLinkage[i][j]], MasterCoefs[privateLinkage[i][j]], W_sigma[privateLinkage[i][j]] 
     856//                              if (CoefWave[privateLinkage[i][j]][%Hold]) 
     857//                                      printf " *HELD* " 
     858//                              endif 
     859//                              if ( (firstUserow != i) || (firstUseCol != j) ) 
     860//                                      printf " ** LINKED to data set %s coefficient %d: %s", DataSets[firstUserow][0], firstUseCol-FirstCoefCol, CoefNames[privateLinkage[i][j]] 
     861//                              endif 
     862//                              print "\r" 
     863//                      endfor 
     864//              endfor 
     865 
     866        //ParseFilePath calls account for DataFolders, returning just the end (the intensity wave) 
    848867                for (i = 0; i < numRows; i += 1) 
    849                         print "Data Set: ",DataSets[i][0]," vs ",DataSets[i][1],"; Function: ",FitFuncNames[privateLinkage[i][FuncPointerCol]] 
     868                        print "Data Set: ",ParseFilePath(0, DataSets[i][0], ":", 1, 0),  "; Function: ",FitFuncNames[privateLinkage[i][FuncPointerCol]] 
    850869                        for (j = FirstCoefCol; j < (privateLinkage[i][NumFuncCoefsCol] + FirstCoefCol); j += 1) 
    851870                                linkIndex = privateLinkage[i][j] 
    852871                                 
    853872                                FirstUseOfIndexInLinkMatrix(linkIndex, privateLinkage, firstUserow, firstUsecol) 
    854                                 printf "\t%d\t%s\t%g +- %g", j-FirstCoefCol, CoefNames[privateLinkage[i][j]], MasterCoefs[privateLinkage[i][j]], W_sigma[privateLinkage[i][j]] 
     873                                printf "\tCoef_%d\t%g +- %g\t", j-FirstCoefCol, MasterCoefs[privateLinkage[i][j]], W_sigma[privateLinkage[i][j]] 
    855874                                if (CoefWave[privateLinkage[i][j]][%Hold]) 
    856                                         printf " *HELD* " 
     875                                        printf "*HELD" 
    857876                                endif 
    858877                                if ( (firstUserow != i) || (firstUseCol != j) ) 
    859                                         printf " ** LINKED to data set %s coefficient %d: %s", DataSets[firstUserow][0], firstUseCol-FirstCoefCol, CoefNames[privateLinkage[i][j]] 
     878                                        printf "*LINKED to data set %s; Coef_%d",ParseFilePath(0,  DataSets[firstUserow][0], ":", 1, 0), firstUseCol-FirstCoefCol 
    860879                                endif 
    861880                                print "\r" 
    862881                        endfor 
    863882                endfor 
     883                String GF_resultStr=CaptureHistory(histNum, 1) 
     884                //eSRK, simpler reporting of results to the command window 
    864885        endif 
    865886 
     
    10861107//                      endif 
    10871108                         
     1109                        //SRK - generate a simple report 
     1110                         
     1111                        String topGraph= WinName(0,1) 
     1112                        Generate_GF_Report(topGraph,GF_resultStr) 
     1113                         
     1114                        //eSRK 
    10881115                        SetDataFolder $saveDF    
    10891116                endfor 
     
    47014728        return 0; 
    47024729end 
     4730 
     4731//SRK - new function to generate a report (always) 
     4732Function Generate_GF_Report(topGraph,GF_resultStr) 
     4733        String topGraph,GF_resultStr 
     4734         
     4735        String nb = "GF_Report" 
     4736        String str="" 
     4737         
     4738        // bring report up 
     4739        DoWindow/F GF_Report 
     4740        if (V_flag == 0)                // Report notebook doesn't exist ? 
     4741                NewNotebook/W=(10,45,550,620)/F=1/N=GF_Report as "Global Fit Report" 
     4742        endif 
     4743        // delete old stuff 
     4744        Notebook $nb selection={startOfFile, endOfFile}, text="\r", selection={startOfFile, startOfFile} 
     4745         
     4746        //setup 
     4747        Notebook $nb defaultTab=36, statusWidth=252, pageMargins={44,44,44,44}          //44 points = 0.6" margin all around 
     4748        Notebook $nb showRuler=1, rulerUnits=1, updating={1, 60} 
     4749        Notebook $nb newRuler=Normal, justification=0, margins={0,0,524}, spacing={0,0,0}, tabs={}, rulerDefaults={"Geneva",10,0,(0,0,0)} 
     4750//       
     4751        // insert title 
     4752        Notebook $nb newRuler=Title, justification=1, rulerDefaults={"Times", 16, 1, (0, 0, 0)} 
     4753        sprintf str, "Global Fit Completed %s, %s\r\r",Secs2Date(datetime, 0), time() 
     4754        Notebook $nb ruler=Title, text=str 
     4755         
     4756        //the text 
     4757        Notebook $nb ruler=Normal 
     4758        Notebook $nb  margins={0,0,524}, tabs={63 + 3*8192} 
     4759        Notebook $nb text=GF_resultStr 
     4760         
     4761        //the graph 
     4762        Notebook $nb picture={$topGraph(0, 0, 400, 300), 0, 1}, text="\r" 
     4763         
     4764        // show the top of the report 
     4765        Notebook $nb  selection= {startOfFile, startOfFile},  findText={"", 1} 
     4766         
     4767        //save the notebook and the graphic file 
     4768//      if(yesSave) 
     4769//              String nameStr=CleanupName(func,0) 
     4770//              nameStr = nameStr[0,8]  //shorten the name 
     4771//              nameStr += "_"+dataname 
     4772//              //make sure the name is no more than 31 characters 
     4773//              namestr = namestr[0,30]         //if shorter than 31, this will NOT pad to 31 characters 
     4774//              Print "file saved as ",nameStr 
     4775//              SaveNotebook /O/P=home/S=2 $nb as nameStr 
     4776//              //save the graph separately as a PICT file, 2x screen 
     4777//              pictStr += nameStr 
     4778//              pictStr = pictStr[0,28]         //need a shorter name - why? 
     4779////            DoWindow/F $topGraph 
     4780//              // E=-5 is png @screen resolution 
     4781//              // E=2 is PICT @2x screen resolution 
     4782/////           SavePICT /E=-5/O/P=home /I/W=(0,0,3,3) as pictStr 
     4783//              SavePICT /E=-5/O/P=home/WIN=$topGraph /W=(0,0,400,300) as pictStr 
     4784//      Endif 
     4785         
     4786        return(0) 
     4787end 
     4788 
     4789 
     4790 
     4791 
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Packages/Wrapper.ipf

    r172 r173  
    821821        Variable num=numpnts(ans),ii=0 
    822822        Notebook $nb ruler=Normal 
    823         Notebook Report  margins={18,18,504}, tabs={63 + 3*8192} 
     823        Notebook $nb  margins={18,18,504}, tabs={63 + 3*8192} 
    824824        str = "Data file: " + dataname + "\r\r" 
    825825        Notebook $nb text=str 
Note: See TracChangeset for help on using the changeset viewer.