Changes in / [9087214:7949dcf7] in sasview


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • .pydevproject

    r79492222 r26c8be3  
    44<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> 
    55<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> 
    6 <path>/sasview/src</path> 
     6<path>/sasview4/src</path> 
    77</pydev_pathproperty> 
    88</pydev_project> 
  • sasview/setup_exe.py

    r450c6f6 r8b645cc  
    372372    ) 
    373373 
    374 bundle_option = 2 
     374# bundle_option = 2 
     375bundle_option = 3 
    375376if is_64bits: 
    376377    bundle_option = 3 
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    rec72ceb rad1ac45  
    2828import math 
    2929import re 
     30import logging 
    3031from wx.py.editwindow import EditWindow 
    3132from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     
    388389            wx.PostEvent(self.parent.parent, StatusEvent(status=msg, 
    389390                                                         info=info)) 
    390         else: 
    391             raise 
    392391 
    393392    def on_help(self, event): 
     
    633632        self.reader = None 
    634633        self.name = 'untitled' 
    635         self.overwrite_name = False 
     634        self.overwrite_name = True 
    636635        self.is_2d = False 
    637636        self.fname = None 
     
    684683        #title name [string] 
    685684        name_txt = wx.StaticText(self, -1, 'Function Name : ') 
    686         overwrite_cb = wx.CheckBox(self, -1, "Overwrite?", (10, 10)) 
    687         overwrite_cb.SetValue(False) 
     685        overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 
     686        overwrite_cb.SetValue(True) 
    688687        overwrite_cb.SetToolTipString("Overwrite it if already exists?") 
    689688        wx.EVT_CHECKBOX(self, overwrite_cb.GetId(), self.on_over_cb) 
     
    947946        # Sort out the errors if occur 
    948947        # First check for valid python name then if the name already exists 
    949         if not re.match('^[A-Za-z0-9_]*$', name): 
    950             msg = "not a valid python name. Name must include only alpha \n" 
    951             msg += "numeric or underline characters and no spaces" 
     948        if not name or not bool(re.match('^[A-Za-z0-9_]*$', name)): 
     949            msg = "is not a valid python name. Name must not be empty and \n" 
     950            msg += "may include only alpha numeric or underline characters \n" 
     951            msg += "and no spaces" 
    952952        elif self.check_name(): 
    953953            description = self.desc_tcl.GetValue() 
     
    966966                        result, msg = None, "error building model" 
    967967                        check_err = "\n"+traceback.format_exc(limit=2) 
    968  
    969                     # Modified compiling test, as it will fail for sasmodels.sasview_model class 
    970                     # Should add a test to check that the class is correctly built  
    971                     # by sasview_model.make_class_from_file? 
    972 #                    try:  
    973 #                        tr_msg = _compile_file(self.fname) 
    974 #                        msg = str(tr_msg.__str__()) 
    975 #                        # Compile error 
    976 #                        if msg: 
    977 #                            msg.replace("  ", "\n") 
    978 #                            msg += "\nCompiling Failed" 
    979 #                            try: 
    980 #                                # try to remove pyc file if exists 
    981 #                                _delete_file(self.fname) 
    982 #                                _delete_file(self.fname + "c") 
    983 #                            except: 
    984 #                                pass 
    985 #                    except: 
    986 #                        pass 
    987968                else: 
    988969                    msg = "Error: The func(x) must 'return' a value at least.\n" 
     
    1002983                exec "from %s import Model" % name 
    1003984            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 
     985                logging.error(sys.exc_value) 
     986 
    1026987        # Prepare the messagebox 
    1027988        if msg: 
     
    11911152 
    11921153        _TreeLocation = "user/sasgui/perspectives/fitting/fitting_help.html" 
    1193         _PageAnchor = "#custom-model-editor" 
     1154        _PageAnchor = "#New_Plugin_Model" 
    11941155        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, _PageAnchor, 
    1195                                           "Custom Model Editor Help") 
     1156                                          "Plugin Model Editor Help") 
    11961157 
    11971158    def on_close(self, event): 
     
    12301191 
    12311192## Templates for custom models 
    1232 #CUSTOM_TEMPLATE = """ 
    1233 #from sas.models.pluginmodel import Model1DPlugin 
    1234 #from math import * 
    1235 #import os 
    1236 #import sys 
    1237 #import numpy 
    1238 ##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 name 
    1244 #        #self.params here 
    1245 #        self.description = "%s" 
    1246 #        self.set_details() 
    1247 #    def function(self, x=0.0%s): 
    1248 #        #local params here 
    1249 #        #function here 
    1250 #""" 
    12511193 
    12521194CUSTOM_TEMPLATE = """ 
     
    14191361 
    14201362    def _clone(self, obj): 
     1363        import copy 
    14211364        obj.params     = copy.deepcopy(self.params) 
    14221365        obj.description     = copy.deepcopy(self.description) 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rf22b43c r313c5c9  
    20572057 
    20582058        if  struct_factor != None: 
    2059             from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 
     2059            from sasmodels.sasview_model import MultiplicationModel 
    20602060            self.model = MultiplicationModel(form_factor(self.multi_factor), 
    20612061                                             struct_factor()) 
     
    33443344                            item[0].SetValue(is_true) 
    33453345 
     3346        self.select_param(event=None) 
     3347        self.Refresh() 
     3348 
    33463349    def _paste_poly_help(self, item, value): 
    33473350        """ 
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    r3e1c9e5 r26c8be3  
    163163^^^^^^^^^^^^^^^^ 
    164164 
     165Relatively straightforward models can be programmed directly from the SasView GUI  
     166using the *New Plugin Model Function*. 
     167 
    165168.. image:: new_model.bmp 
    166169 
    167 A model template generated by this option can be viewed and further modified using 
     170When using this feature, be aware that even if your code has errors, including  
     171syntax errors, a model file is still generated. When you then correct the errors  
     172and click 'Apply' again to re-compile you will get an error informing you that  
     173the model already exists if the 'Overwrite' box is not checked. In this case you  
     174will need to supply a new model function name. By default the 'Overwrite' box is  
     175*checked*\ . 
     176 
     177Also note that the 'Fit Parameters' have been split into two sections: those which  
     178can be polydisperse (shape and orientation parameters) and those which are not 
     179(eg, scattering length densities). 
     180 
     181A model file generated by this option can be viewed and further modified using 
    168182the :ref:`Advanced_Plugin_Editor` . 
    169  
    170 *NB: "Fit Parameters" has been split into two sections, those which can be 
    171 polydisperse (shape and orientation parameters) and those which are not 
    172 (scattering length densities, for example).* 
    173183 
    174184Sum|Multi(p1,p2) 
  • src/sas/sasgui/perspectives/fitting/models.py

    r5de7f69 r313c5c9  
    356356        """ 
    357357        if int(evt.GetId()) in self.form_factor_dict.keys(): 
    358             from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 
     358            from sasmodels.sasview_model import MultiplicationModel 
    359359            self.model_dictionary[MultiplicationModel.__name__] = MultiplicationModel 
    360360            model1, model2 = self.form_factor_dict[int(evt.GetId())] 
  • src/sas/sasgui/perspectives/pr/pr.py

    rc10d9d6c ra69a967  
    12761276                    wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 
    12771277                    return 
    1278                 msg += "Prview does not allow multiple data!\n" 
     1278                msg = "Prview does not allow multiple data!\n" 
    12791279                msg += "Please select one.\n" 
    12801280                if len(data_list) > 1: 
Note: See TracChangeset for help on using the changeset viewer.