- Timestamp:
- Apr 29, 2009 2:31:07 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/GlobalFit/SimpleGlobalFit_NCNR_v40.ipf
r477 r495 113 113 ListBox list0 widths={30,50,80,80} 114 114 115 Button button_0,pos={344,13},size={100,20},title="Do Fit"115 Button button_0,pos={344,13},size={100,20},title="Do The Fit" 116 116 Button button_0 proc=SGF_DoFitButtonProc 117 117 Button button_1,pos={369,173},size={50,20},proc=SaveCheckStateButtonProc,title="Save" 118 118 Button button_2,pos={429,173},size={70,20},proc=RestoreCheckStateButtonProc,title="Restore" 119 Button button_3,pos={500,13},size={100,20},proc=SGFitHelpButtonProc,title="Help" 119 120 120 121 Edit/W=(14,174,348,495)/HOST=# … … 124 125 125 126 EndMacro 127 128 //open the Help file for the Simple Global Fit 129 Function SGFitHelpButtonProc(ba) : ButtonControl 130 STRUCT WMButtonAction &ba 131 132 switch( ba.eventCode ) 133 case 2: // mouse up 134 // click code here 135 DisplayHelpTopic/Z/K=1 "Simple Global Fit" 136 if(V_flag !=0) 137 DoAlert 0,"The Simple Global Fit Help file could not be found" 138 endif 139 break 140 endswitch 141 142 return 0 143 End 144 126 145 127 146 // save the state of the checkboxes -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf
r494 r495 24 24 Variable/G root:Packages:NIST:USANSUseTrap = 0 25 25 Variable/G root:Packages:NIST:USANS_dQv = 0.117 26 26 Variable/G root:Packages:NIST:gUseGenCurveFit = 0 //set to 1 to use genetic optimization 27 27 28 //Ugly. Put this here to make sure things don't break 28 29 String/G root:Packages:NIST:gXMLLoader_Title … … 217 218 218 219 // MOTOFIT/GenFit bits 219 tmp = "GEN_allatoncefitfunc;GEN_fitfunc;GetCheckBoxesState;MOTO_GFFitAllAtOnceTemplate;MOTO_GFFitFuncTemplate;MOTO_NewGF_SetXWaveInList;MOTO_NewGlblFitFunc;MOTO_NewGlblFitFuncAllAtOnce; "220 tmp = "GEN_allatoncefitfunc;GEN_fitfunc;GetCheckBoxesState;MOTO_GFFitAllAtOnceTemplate;MOTO_GFFitFuncTemplate;MOTO_NewGF_SetXWaveInList;MOTO_NewGlblFitFunc;MOTO_NewGlblFitFuncAllAtOnce;GeneticFit_UnSmearedModel;GeneticFit_SmearedModel;" 220 221 list = RemoveFromList(tmp, list ,";") 221 222 … … 758 759 fitYw = NaN 759 760 760 Variable useRes=0 761 Variable useRes=0,isUSANS=0,val 761 762 if(stringmatch(funcStr, "Smear*")) // if it's a smeared function, need a struct 762 763 useRes=1 763 764 endif 764 765 if(dimsize(resW,1) > 4) 766 isUSANS=1 767 endif 765 768 // do not construct constraints for any of the coefficients that are being held 766 769 // -- this will generate an "unknown error" from the curve fitting … … 793 796 Variable pt1,pt2,newN,mPt1,mPt2 794 797 String noteStr 795 if(useCursors && (dimsize(resW,1) > 4))798 if(useCursors && isUSANS ) 796 799 //where are the cursors, and what is the status of the current matrix? 797 800 if(pcsr(A) > pcsr(B)) … … 814 817 Wave trimResW=$(DF+folderStr+"_res"+"t") //put the trimmed resW in the struct for the fit! 815 818 Wave fs.resW=trimResW 816 819 endif 820 if(useCursors) 821 //find the points so that genetic optimization can use them 822 if(pcsr(A) > pcsr(B)) 823 pt1 = pcsr(B) 824 pt2 = pcsr(A) 825 else 826 pt1 = pcsr(A) 827 pt2 = pcsr(B) 828 endif 817 829 endif 818 830 … … 821 833 Variable/G V_FitQuitReason=0 //0=ok,1=maxiter,2=user stop,3=no chisq decrease 822 834 823 835 NVAR useGenCurveFit = root:Packages:NIST:gUseGenCurveFit 824 836 // don't use the auto-destination with no flag, it doesn't appear to work correctly 825 837 // dispatch the fit … … 834 846 do 835 847 // Variable t0 = stopMStimer(-2) // corresponding print is at the end of the do-while loop (outside) 848 849 850 if(useGenCurveFit) 851 852 #if !(exists("GenCurveFit")) 853 // XOP not available 854 useGenCurveFit = 0 855 Abort "Genetic Optimiztion XOP not available. Reverting to normal optimization." 856 #endif 857 //send everything to a function, to reduce the clutter 858 // useEps and useConstr are not needed 859 // pass the structure to get the current waves, including the trimmed USANS matrix 860 Variable chi,pt 861 862 chi = DoGenCurveFit(useRes,useCursors,sw,fitYw,fs,funcStr,getHStr(hold),val,lolim,hilim,pt1,pt2) 863 pt = val 864 865 break 866 867 endif 868 836 869 837 870 if(useRes && useEps && useCursors && useConstr) //do it all … … 940 973 String traces=TraceNameList("", ";", 1 ) //"" as first parameter == look on the target graph 941 974 if(strsearch(traces,"FitYw",0) == -1) 942 AppendToGraph FitYw vs xw 975 if(useGenCurveFit && useCursors) 976 WAVE trimX = trimX 977 AppendtoGraph fitYw vs trimX 978 else 979 AppendToGraph FitYw vs xw 980 endif 943 981 else 944 982 RemoveFromGraph FitYw 945 AppendToGraph FitYw vs xw 983 if(useGenCurveFit && useCursors) 984 WAVE trimX = trimX 985 AppendtoGraph fitYw vs trimX 986 else 987 AppendToGraph FitYw vs xw 988 endif 946 989 endif 947 990 ModifyGraph lsize(FitYw)=2,rgb(FitYw)=(0,0,0) … … 950 993 951 994 // report the results (to the panel?) 995 if(useGenCurveFit) 996 V_chisq = chi 997 V_npnts = pt 998 endif 952 999 print "V_chisq = ",V_chisq 953 1000 print cw -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/SA_includes_v400.ipf
r475 r495 16 16 #include "PlotUtilsMacro_v40" version>=4.00 17 17 #include "PlotManager_v40" version>=4.00 18 #include "NCNR_GenFitUtils" // April 2009, compiles OK if XOP not present 18 19 19 20 #include "USANS_SlitSmearing_v40" … … 39 40 "Determine Invariant",Execute/P "INSERTINCLUDE \"Invariant_v40\"";Execute/P "COMPILEPROCEDURES ";Execute/P "Make_Invariant_Panel()" 40 41 "Do Linear Fits",Execute/P "INSERTINCLUDE \"LinearizedFits_v40\"";Execute/P "COMPILEPROCEDURES ";Execute/P "A_OpenFitPanel()" 42 GenOpFlagEnable()+"Genetic Optimization Enabled", Init_GenOp() 43 GenOpFlagDisable()+"Genetic Optimization Disabled", UnSet_GenOp() 41 44 End 42 45 "-" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Correct.ipf
r451 r495 895 895 noadd_mat = 1 //initialize to 1 896 896 897 If(( xshift != 0) || (yshift != 0))897 If((abs(xshift) >= 0.01) || (abs(yshift) >= 0.01)) //APR09 - change tolerance to handle ICE "precision" 898 898 DoAlert 1,"Do you want to ignore the beam center mismatch?" 899 899 if(V_flag==1) //yes -> just go on … … 901 901 yshift=0 902 902 endif 903 else 904 // "mismatch" is simply a python type conversion error 905 xshift=0 906 yshift=0 903 907 endif 904 908 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/PatchFiles.ipf
r494 r495 81 81 Variable/G root:myGlobals:Patch:gPV19 = 0 82 82 Variable/G root:myGlobals:Patch:gTransCts = 0 83 Variable/G root:myGlobals:Patch:gRadioVal = 083 Variable/G root:myGlobals:Patch:gRadioVal = 1 84 84 End 85 85 … … 301 301 ControlUpdate PatchPopup 302 302 PopupMenu PatchPopup,mode=1 303 ShowHeaderButtonProc("SHButton") 303 304 End 304 305
Note: See TracChangeset
for help on using the changeset viewer.