Changeset 19e614a in sasview for fittingview/src/sans/perspectives/fitting
- Timestamp:
- May 2, 2012 11:03:55 AM (13 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:
- 3aab96b
- Parents:
- 6246e00
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/basepage.py
r8df5faa r19e614a 2893 2893 name = self.formfactorbox.GetValue() 2894 2894 frame = HelpWindow(None, -1, pageToOpen=model_path) 2895 if frame.rhelp.HasAnchor(name): 2895 # If model name exists and model is not a custom model 2896 if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue(): 2896 2897 frame.Show(True) 2897 2898 frame.rhelp.ScrollToAnchor(name) -
fittingview/src/sans/perspectives/fitting/fitting.py
rf32d144 r19e614a 262 262 os.remove(p_path) 263 263 self.update_custom_combo() 264 self.delete_menu.Delete(id) 265 for item in self.edit_menu.GetMenuItems(): 266 if item.GetLabel() == label: 267 self.edit_menu.DeleteItem(item) 268 break 264 if os.path.isfile(p_path): 265 msg = "Sorry! Could not be able to delete the default " 266 msg += "custom model... \n" 267 msg += "Please manually remove the files (.py, .pyc) " 268 msg += "in the 'plugin_models' folder \n" 269 msg += "inside of the SansView application, " 270 msg += "and try it again." 271 wx.MessageBox(msg, 'Info') 272 #wx.PostEvent(self.parent, StatusEvent(status=msg, type='stop', 273 # info='warning')) 274 else: 275 self.delete_menu.Delete(id) 276 for item in self.edit_menu.GetMenuItems(): 277 if item.GetLabel() == label: 278 self.edit_menu.DeleteItem(item) 279 msg = "The custom model, %s, has been deleted."% label 280 wx.PostEvent(self.parent, StatusEvent(status=msg, 281 type='stop', info='info')) 282 break 269 283 except: 270 284 msg ='Delete Error: \nCould not delete the file; Check if in use.' 271 wx.MessageBox(msg )285 wx.MessageBox(msg, 'Error') 272 286 273 287 def make_sum_model(self, event): … … 314 328 if hasattr(page, "formfactorbox"): 315 329 page.model_list_box = temp 316 current_val = page.formfactorbox.Get Value()317 pos = page.formfactorbox.GetSelection()330 current_val = page.formfactorbox.GetLabel() 331 #pos = page.formfactorbox.GetSelection() 318 332 page._show_combox_helper() 319 new_val = page.formfactorbox.Get Value()333 new_val = page.formfactorbox.GetLabel() 320 334 if current_val != new_val and new_val != '': 321 page.formfactorbox.Set Value(new_val)335 page.formfactorbox.SetLabel(new_val) 322 336 else: 323 page.formfactorbox.Set Value(current_val)337 page.formfactorbox.SetLabel(current_val) 324 338 except: 325 339 pass -
fittingview/src/sans/perspectives/fitting/models.py
rf32d144 r19e614a 107 107 if not p_dir: 108 108 raise 109 110 109 # Place example user models as needed 111 for file in os.listdir(p_dir): 112 file_path = os.path.join(p_dir, file) 113 if os.path.isfile(file_path): 114 if file.split(".")[-1] == 'py' and\ 115 file.split(".")[0] != '__init__': 116 if not os.path.isfile(os.path.join(dir, file)): 117 shutil.copy(file_path, dir) 110 if os.path.isdir(p_dir): 111 for file in os.listdir(p_dir): 112 file_path = os.path.join(p_dir, file) 113 if os.path.isfile(file_path): 114 if file.split(".")[-1] == 'py' and\ 115 file.split(".")[0] != '__init__': 116 if not os.path.isfile(os.path.join(dir, file)): 117 shutil.copy(file_path, dir) 118 118 119 return dir 119 120 … … 572 573 573 574 from sans.models.ReflectivityModel import ReflectivityModel 575 self.shape_indep_list.append(ReflectivityModel) 574 576 self.multi_func_list.append(ReflectivityModel) 575 577 576 578 from sans.models.ReflectivityIIModel import ReflectivityIIModel 579 self.shape_indep_list.append(ReflectivityIIModel) 577 580 self.multi_func_list.append(ReflectivityIIModel) 578 581 … … 580 583 self.stored_plugins = self.findModels() 581 584 self.plugins = self.stored_plugins.values() 582 self.plugins.append(ReflectivityModel) 583 self.plugins.append(ReflectivityIIModel) 585 584 586 self._get_multifunc_models() 585 587 … … 630 632 self.stored_plugins[name] = plug 631 633 self.plugins.append(plug) 632 from sans.models.ReflectivityModel import ReflectivityModel 633 from sans.models.ReflectivityIIModel import ReflectivityIIModel 634 self.plugins.append(ReflectivityModel) 635 self.plugins.append(ReflectivityIIModel) 634 636 635 self.model_combobox.reset_list("Customized Models", self.plugins) 637 636 return self.model_combobox.get_list() -
fittingview/src/sans/perspectives/fitting/plugin_models/polynominal5.py
re9bd127 r19e614a 32 32 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 33 33 ## TO RENAME YOUR MODEL: THIS NAME IS WHAT YOU SEE ON GUI. 34 name = "polynomial5" ## <----- NAME OF THE MODEL34 name = "polynomial5" ## <----- FILE NAME (NAME OF THE MODEL) 35 35 36 36 def __init__(self): ##DO NOT CHANGE THIS LINE!!! … … 48 48 self.params['E'] = 0.0 ## <----- 49 49 self.params['F'] = 0.0 ## <----- 50 50 ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """ """ ONLY!!!! 51 self.description = """ 52 a + b * x + c * math.pow(x,2) + d * math.pow(x,3) \n 53 + e * math.pow(x,4) + f * math.pow(x,5) 54 """ ## <----- 51 55 ## DEFINE DEFAULT DETAILS 52 56 self.set_details() ##DO NOT DELETE OR CHANGE THIS LINE!!! -
fittingview/src/sans/perspectives/fitting/plugin_models/sph_bessel_jn.py
re9bd127 r19e614a 36 36 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 37 37 ## TO RENAME YOUR MODEL 38 name = " C*sph_jn(Ax+B)+D" ## <----- NAME OF THE MODEL38 name = "sph_bessel_jn" ## <----- FILE NAME (NAME OF THE MODEL) 39 39 40 40 def __init__(self): ##DO NOT CHANGE THIS LINE!!! -
fittingview/src/sans/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.py
r2b4c8ca r19e614a 43 43 Note: P(Q) refers to 'form factor' model. 44 44 """ 45 name = " "45 name = "sum_Ap1_1_Ap2" ## <----- FILE NAME (NAME OF THE MODEL) 46 46 def __init__(self): 47 Model1DPlugin.__init__(self, name= '')47 Model1DPlugin.__init__(self, name=self.name) 48 48 """ 49 49 :param p_model1: a form factor, P(Q) … … 53 53 p_model2 = P2() 54 54 ## Setting model name model description 55 self.description="" 56 self.name = self._get_name(p_model1.name, p_model2.name) 57 self.description = p_model1.name+"\n" 58 self.description += p_model2.name+"\n" 55 self.description = "" 59 56 self.fill_description(p_model1, p_model2) 60 57 … … 391 388 """ 392 389 description = "" 393 description +="This model gives the summation of %s and %s.\n"% \390 description +="This model gives the summation of (A*%s) and ((1-A)*%s).\n"% \ 394 391 ( p_model1.name, p_model2.name ) 395 392 self.description += description -
fittingview/src/sans/perspectives/fitting/plugin_models/sum_p1_p2.py
r0e62f0f r19e614a 48 48 Note: P(Q) refers to 'form factor' model. 49 49 """ 50 name = " "50 name = "sum_p1_p2" ## <----- FILE NAME (NAME OF THE MODEL) 51 51 def __init__(self): 52 Model1DPlugin.__init__(self, name= '')52 Model1DPlugin.__init__(self, name=self.name) 53 53 """ 54 54 :param p_model1: a form factor, P(Q) … … 59 59 ## Setting model name model description 60 60 self.description="" 61 self.name = self._get_name(p_model1.name, p_model2.name)61 62 62 self.description = p_model1.name+"\n" 63 63 self.description += p_model2.name+"\n" -
fittingview/src/sans/perspectives/fitting/plugin_models/testmodel.py
re9bd127 r19e614a 36 36 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 37 37 ## TO RENAME YOUR MODEL 38 name = " A+Bcos(2x)+Csin(2x)" ## <----- NAME OF THE MODEL38 name = "testmodel" ## <----- FILE NAME (NAME OF THE MODEL) 39 39 40 40 def __init__(self): -
fittingview/src/sans/perspectives/fitting/plugin_models/testmodel_2.py
r6f140f2 r19e614a 35 35 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 36 36 ## TO RENAME YOUR MODEL 37 name = " sin(poly)/(poly)" ## <----- NAME OF THE MODEL37 name = "testmodel_2" ## <----- FILE NAME (NAME OF THE MODEL) 38 38 39 39 def __init__(self): ##DO NOT CHANGE THIS LINE!!!
Note: See TracChangeset
for help on using the changeset viewer.