Changeset cf3b781 in sasview for park_integration/Fitting.py
- Timestamp:
- Jul 7, 2008 4:37:27 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1b0b3ca
- Parents:
- 672c44da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/Fitting.py
r4408fb0 rcf3b781 42 42 """ return list of data""" 43 43 44 def set_param(self,model, pars):44 def set_param(self,model,name, pars): 45 45 """ Recieve a dictionary of parameter and save it """ 46 46 47 def add_constraint(self, constraint): 48 """ User specify contraint to fit """ 47 def remove_data(self,Uid,data=None): 48 """ remove one or all data""" 49 50 def remove_model(self,Uid): 51 """ remove model """ 49 52 50 def get_constraint(self):51 """ return the contraint value """52 53 def set_constraint(self,constraint):54 """55 receive a string as a constraint56 @param constraint: a string used to constraint some parameters to get a57 specific value58 53 """ 59 if __name__ == "__main__":60 load= Load()61 # test scipy62 """test fit one data set one model with scipy """63 #load data64 load.set_filename("testdata_line.txt")65 load.set_values()66 data1 = Data1D(x=[], y=[], dx=None,dy=None)67 data1.name = "data1"68 load.load_data(data1)69 #choose a model70 from sans.guitools.LineModel import LineModel71 model = LineModel()72 #Create a Fit engine73 fitter =Fit()74 fitter.fit_engine('scipy')75 engine = fitter.returnEngine()76 77 #set the model78 engine.set_model(model,1)79 engine.set_data(data1,1)80 81 print"fit only one data SCIPY:",engine.fit({'A':2,'B':1},None,None)82 83 84 """ test fit one data set one model with park """85 fitter.fit_engine('scipy')86 engine = fitter.returnEngine()87 #set the model88 engine.set_model(model,1)89 engine.set_data(data1,1)90 91 print"fit only one data PARK:",engine.fit({'A':2,'B':1},None,None)92 93 94 """test fit with 2 data and one model SCIPY:"""95 # reinitialize the fitter96 fitter =Fit()97 #create an engine98 fitter.fit_engine("scipy")99 engine=fitter.returnEngine()100 #set the model for fit101 engine.set_model(model,2 )102 #load 1 st data103 load.set_filename("testdata1.txt")104 load.set_values()105 data2 = Data1D(x=[], y=[], dx=None,dy=None)106 data2.name = "data2"107 load.load_data(data2)108 #load 2nd data109 load.set_filename("testdata2.txt")110 load.set_values()111 data3 = Data1D(x=[], y=[], dx=None,dy=None)112 data3.name = "data2"113 load.load_data(data3)114 115 #set data in the engine116 engine.set_data(data2,2)117 engine.set_data(data3,2)118 print"fit two data SCIPY:",engine.fit({'A':2,'B':1},None,None)119 120 """ test fit with 2 data and one model PARK:"""121 fitter.fit_engine("park")122 engine=fitter.returnEngine()123 #set the model for fit124 engine.set_model(model,2 )125 #load 1 st data126 load.set_filename("testdata1.txt")127 load.set_values()128 data2 = Data1D(x=[], y=[], dx=None,dy=None)129 data2.name = "data2"130 load.load_data(data2)131 #load 2nd data132 load.set_filename("testdata2.txt")133 load.set_values()134 data3 = Data1D(x=[], y=[], dx=None,dy=None)135 data3.name = "data2"136 load.load_data(data3)137 138 #set data in the engine139 engine.set_data(data2,2)140 engine.set_data(data3,2)141 print"fit two data PARK:",engine.fit({'A':2,'B':1},None,None)142 143
Note: See TracChangeset
for help on using the changeset viewer.