Changeset f80b8a9f in sasview for src/sas/sasgui/perspectives/calculator
- Timestamp:
- Oct 11, 2016 11:03:53 AM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 01cfd13
- Parents:
- 46dfee9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
rec72ceb rf80b8a9f 28 28 import math 29 29 import re 30 import logging 30 31 from wx.py.editwindow import EditWindow 31 32 from sas.sasgui.guiframe.documentation_window import DocumentationWindow … … 388 389 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, 389 390 info=info)) 390 else:391 raise392 391 393 392 def on_help(self, event): … … 966 965 result, msg = None, "error building model" 967 966 check_err = "\n"+traceback.format_exc(limit=2) 968 969 # Modified compiling test, as it will fail for sasmodels.sasview_model class970 # Should add a test to check that the class is correctly built971 # by sasview_model.make_class_from_file?972 # try:973 # tr_msg = _compile_file(self.fname)974 # msg = str(tr_msg.__str__())975 # # Compile error976 # if msg:977 # msg.replace(" ", "\n")978 # msg += "\nCompiling Failed"979 # try:980 # # try to remove pyc file if exists981 # _delete_file(self.fname)982 # _delete_file(self.fname + "c")983 # except:984 # pass985 # except:986 # pass987 967 else: 988 968 msg = "Error: The func(x) must 'return' a value at least.\n" … … 1002 982 exec "from %s import Model" % name 1003 983 except: 1004 pass 1005 # except: 1006 # msg = 'new model fails to import in python' 1007 # try: 1008 # # try to remove pyc file if exists 1009 # _delete_file(self.fname + "c") 1010 # except: 1011 # pass 1012 # 1013 # And also need to test if model runs 1014 # if self.base != None and not msg: 1015 # try: 1016 # Model().run(0.01) 1017 # except: 1018 # msg = "new model fails on run method:" 1019 # _, value, _ = sys.exc_info() 1020 # msg += "in %s:\n%s\n" % (name, value) 1021 # try: 1022 # # try to remove pyc file if exists 1023 # _delete_file(self.fname + "c") 1024 # except: 1025 # pass 984 logging.error(sys.exc_value) 985 1026 986 # Prepare the messagebox 1027 987 if msg: … … 1230 1190 1231 1191 ## Templates for custom models 1232 #CUSTOM_TEMPLATE = """1233 #from sas.models.pluginmodel import Model1DPlugin1234 #from math import *1235 #import os1236 #import sys1237 #import numpy1238 ##import scipy?1239 #class Model(Model1DPlugin):1240 # name = basename without extension of __file__1241 # def __init__(self):1242 # Model1DPlugin.__init__(self, name=self.name)1243 # #set name same as file name1244 # #self.params here1245 # self.description = "%s"1246 # self.set_details()1247 # def function(self, x=0.0%s):1248 # #local params here1249 # #function here1250 #"""1251 1192 1252 1193 CUSTOM_TEMPLATE = """ … … 1419 1360 1420 1361 def _clone(self, obj): 1362 import copy 1421 1363 obj.params = copy.deepcopy(self.params) 1422 1364 obj.description = copy.deepcopy(self.description)
Note: See TracChangeset
for help on using the changeset viewer.