Changeset 181


Ignore:
Timestamp:
Oct 19, 2007 5:04:09 PM (15 years ago)
Author:
srkline
Message:

Changes to wrapper are to toggle button labels and their procedures as needed for 1d/2d analysis and to hopefully not undo the conflict with r180 changes to the sizing of controls on the panel.

File:
1 edited

Legend:

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

    r180 r181  
    11#pragma rtGlobals=1             // Use modern global access method. 
    2  
     2#pragma IgorVersion=6.0 
    33 
    44// 
     
    5757        CheckBox check_1,pos={440,42},size={74,14},title="Use Epsilon?",value= 0 
    5858        CheckBox check_2,pos={440,65},size={95,14},title="Use Constraints?",value= 0 
    59 //      CheckBox check_3,pos={544,18},size={72,14},title="From target",value= 0 
     59        CheckBox check_3,pos={530,18},size={72,14},title="2D Functions?",value= 0 
     60        CheckBox check_3 proc=Toggle2DControlsCheckProc 
    6061        CheckBox check_4,pos={440,85},size={72,14},title="Report?",value= 0 
    6162        CheckBox check_5,pos={454,103},size={72,14},title="Save it?",value= 0 
     
    550551// folderStr is the data folder for the desired data set 
    551552// 
    552 // -- this looks like something that can be made rather generic rather easily 
    553553// 
    554554Function FitWrapper(folderStr,funcStr,coefStr,useCursors,useEps,useConstr) 
     
    681681                endif 
    682682                 
    683 /////   same as above, but all without useRes 
     683/////   same as above, but all without useRes (no /STRC flag) 
    684684                if(useEps && useCursors && useConstr)           //do it all 
    685685                        FuncFit/H=getHStr(hold) /NTHR=0 $funcStr cw, yw[pcsr(A),pcsr(B)] /X=xw /W=sw /I=1 /E=eps /D=fitYw /C=constr 
     
    764764                String topGraph= WinName(0,1)   //this is the topmost graph 
    765765         
     766                DoUpdate                //force an update of the graph before making a copy of it for the report 
     767 
    766768                W_GenerateReport(funcStr,folderStr,$parStr,cw,yesSave,V_chisq,W_sigma,V_npnts,V_FitError,V_FitQuitReason,V_startRow,V_endRow,topGraph) 
    767769        endif 
     
    840842         
    841843        // 
    842         Wave dataXw = $("root:"+dataname+":"+dataname+"_q")      
     844        // no "fitted range" for 2D data, so make sure that this exists before using it 
     845        Wave/Z dataXw = $("root:"+dataname+":"+dataname+"_q")    
    843846        // 
    844847        Notebook $nb ruler=Normal 
     
    849852        sprintf str,"Npnts = %g \t\t Sqrt(X^2/N) = %g\r",npts,sqrt(chiSq/npts) 
    850853        Notebook $nb textRGB=(0,0,0),fstyle=0, text=str 
    851         sprintf str "Fitted range = [%d,%d] = %g < Q < %g\r",fitStart,fitEnd,dataXw(fitStart),dataXw(fitEnd) 
    852         Notebook $nb textRGB=(0,0,0),fstyle=0, text=str 
     854        if(WaveExists(dataXw)) 
     855                sprintf str "Fitted range = [%d,%d] = %g < Q < %g\r",fitStart,fitEnd,dataXw(fitStart),dataXw(fitEnd) 
     856                Notebook $nb textRGB=(0,0,0),fstyle=0, text=str 
     857        endif 
    853858        sprintf str,"FitError = %s\t\tFitQuitReason = %s\r",W_ErrorMessage(FitErr),W_QuitMessage(FitQuit) 
    854859        Notebook $nb textRGB=(65000,0,0),fstyle=1,text=str 
     
    856861         
    857862        // insert graphs 
    858         Notebook $nb picture={$topGraph(0, 0, 400, 300), 0, 1}, text="\r" 
    859          
    860  
     863        if(WaveExists(dataXw)) 
     864                Notebook $nb picture={$topGraph(0, 0, 400, 300), 0, 1}, text="\r" 
     865        // 
     866        else            //must be 2D Gizmo 
     867                Execute "ExportGizmo Clip" 
     868                LoadPict/Q/O "Clipboard",tmp_Gizmo 
     869                Notebook $nb picture={tmp_Gizmo(0, 0, 400, 300), 0, 1}, text="\r" 
     870        endif 
    861871        //Notebook Report picture={Table1, 0, 0}, text="\r" 
    862872         
     
    880890                // E=2 is PICT @2x screen resolution 
    881891///             SavePICT /E=-5/O/P=home /I/W=(0,0,3,3) as pictStr 
    882                 SavePICT /E=-5/O/P=home/WIN=$topGraph /W=(0,0,400,300) as pictStr 
     892                if(WaveExists(dataXw)) 
     893                        SavePICT /E=-5/O/P=home/WIN=$topGraph /W=(0,0,400,300) as pictStr 
     894                else 
     895                        Execute "ExportGizmo /P=home as \""+pictStr+"\"" 
     896                        //SavePICT /E=-5/O/P=home/WIN=$topGraph /W=(0,0,400,300) as pictStr 
     897                endif 
    883898        Endif 
    884899         
     
    886901End 
    887902 
    888 static Function/S W_ErrorMessage(code) 
     903Function/S W_ErrorMessage(code) 
    889904        Variable code 
    890905         
     
    907922end 
    908923 
    909 static Function/S W_QuitMessage(code) 
     924Function/S W_QuitMessage(code) 
    910925        Variable code 
    911926         
     
    928943end 
    929944 
     945Function Toggle2DControlsCheckProc(cba) : CheckBoxControl 
     946        STRUCT WMCheckboxAction &cba 
     947 
     948        switch( cba.eventCode ) 
     949                case 2: // mouse up 
     950                        Variable checked = cba.checked 
     951                        if(checked) 
     952                                //print "change the buttons to 2D" 
     953                                Button button_0,proc=Do2DFitButtonProc,title="Do 2D Fit" 
     954                                Button button_1,size={120,20},proc=Plot2DFunctionButtonProc,title="Plot 2D Function" 
     955                                Button button_2,size={100,20},proc=Append2DModelButtonProc,title="Append 2D" 
     956                                Button button_3,size={100,20},proc=Load2DDataButtonProc,title="Load 2D Data" 
     957                                 
     958                                Button button_2D_0,pos={520,37},size={70,20},proc=LogToggle2DButtonProc,title="Log/Lin" 
     959                                Button button_2D_1,pos={520,60},size={100,20},proc=Plot2DButtonProc,title="Plot 2D Data" 
     960                                 
     961                                Button button_2D_0,disable=0            //visible again, and enabled 
     962                                Button button_2D_1,disable=0 
     963                        else 
     964                                //print "unchecked, change them back to 1D" 
     965                                Button button_0,pos={520,93},size={100,20},proc=DoTheFitButton,title="Do 1D Fit" 
     966                                Button button_1,pos={240,57},size={120,20},proc=PlotModelFunction,title="Plot 1D Function" 
     967                                Button button_2,pos={240,93},size={100,20},proc=AppendModelToTarget,title="Append 1D" 
     968                                Button button_3,pos={240,20},size={100,20},proc=W_LoadDataButtonProc,title="Load 1D Data" 
     969                                 
     970                                Button button_2D_0,disable=3    //hide the extra 2D buttons, and disable 
     971                                Button button_2D_1,disable=3 
     972                        endif 
     973                        break 
     974        endswitch 
     975 
     976        return 0 
     977End 
Note: See TracChangeset for help on using the changeset viewer.