Changes in / [0b63c6e:50a77df] in sasview


Ignore:
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rbc873053 rf0d720b  
    1313.pydevproject 
    1414.vagrant 
     15.idea 
     16build 
     17dist 
     18sasview.egg-info 
     19sasview.egg-info 
     20 
    1521.mplconfig 
     22doctrees 
     23html 
     24build 
    1625 
    1726/setup.cfg 
    1827 
    1928/dist 
    20 /build 
     29**/build 
    2130sasview.egg-info 
    2231sasview-install 
     
    4150/test/sasdataloader/test/plugins.zip 
    4251/test/sasdataloader/test/test_log.txt 
     52 
  • run.py

    rb699768 rb699768  
    104104    addpath(joinpath(root, 'src')) 
    105105 
     106    # sasmodels on the path 
     107    addpath(joinpath(root, '../sasmodels/')) 
     108 
    106109    # Import the sasview package from root/sasview as sas.sasview.  It would 
    107110    # be better to just store the package in src/sas/sasview. 
  • setup.py

    r4adf48e r4adf48e  
    244244model_dir = os.path.join("src", "sas","models") 
    245245 
    246 if os.path.isdir(wrapper_dir): 
    247     for file in os.listdir(wrapper_dir):  
    248         file_path =  os.path.join(wrapper_dir, file) 
    249         os.remove(file_path) 
    250 else: 
    251     os.makedirs(wrapper_dir) 
    252 sys.path.append(os.path.join("src", "sas", "models", "c_extension", "python_wrapper")) 
    253 from wrapping import generate_wrappers 
    254 generate_wrappers(header_dir = includedir,  
    255                   output_dir = model_dir, 
    256                   c_wrapper_dir = wrapper_dir) 
     246#if os.path.isdir(wrapper_dir): 
     247#    for file in os.listdir(wrapper_dir): 
     248#        file_path =  os.path.join(wrapper_dir, file) 
     249#        os.remove(file_path) 
     250#else: 
     251#    os.makedirs(wrapper_dir) 
     252#sys.path.append(os.path.join("src", "sas", "models", "c_extension", "python_wrapper")) 
     253#from wrapping import generate_wrappers 
     254#generate_wrappers(header_dir = includedir, 
     255#                  output_dir = model_dir, 
     256#                  c_wrapper_dir = wrapper_dir) 
    257257 
    258258IGNORED_FILES = [".svn"] 
     
    283283model_sources = [] 
    284284append_file(file_list=model_sources, dir_path=igordir) 
    285 append_file(file_list=model_sources, dir_path=c_model_dir) 
    286 append_file(file_list=model_sources, dir_path=wrapper_dir) 
     285#append_file(file_list=model_sources, dir_path=c_model_dir) 
     286#append_file(file_list=model_sources, dir_path=wrapper_dir) 
    287287 
    288288smear_sources = [] 
     
    303303 
    304304c_models = [  
    305     Extension("sas.models.sas_extension.c_models", 
    306         sources=model_sources,                  
    307         include_dirs=[ 
    308             igordir, includedir, c_model_dir, numpy_incl_path, cephes_dir 
    309         ], 
    310     ), 
     305    #Extension("sas.models.sas_extension.c_models", 
     306    #    sources=model_sources, 
     307    #    include_dirs=[ 
     308    #        igordir, includedir, c_model_dir, numpy_incl_path, cephes_dir 
     309    #    ], 
     310    #), 
    311311 
    312312    # Smearer extension 
     
    340340ext_modules.extend(c_models) 
    341341 
     342packages.append("sas.models") 
    342343# SasView 
    343344 
     
    350351                               'test/save_states/*', 
    351352                               'test/upcoming_formats/*',  
    352                                'default_categories.json'] 
     353                                 'default_categories.json'] 
    353354packages.append("sas.sasview") 
    354355 
  • src/sas/models/dispersion_models.py

    rfd5ac0d r0e4e554  
    154154        c_models.set_dispersion_weights(self.cdisp, values, weights) 
    155155         
    156 models = {"gaussian":GaussianDispersion,  "rectangula":RectangleDispersion, 
     156models = {"gaussian":GaussianDispersion,  "rectangular":RectangleDispersion, 
    157157          "array":ArrayDispersion, "schulz":SchulzDispersion,  
    158158          "lognormal":LogNormalDispersion}        
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rd85c194 rd85c194  
    5757    ## Title to appear on top of the window 
    5858    window_caption = "Fit Page " 
     59 
    5960    # These two buttons have specific IDs since they seem to be created more 
    6061    # frequently than they need to.  In particular, set_dispers_sizer() is 
     
    13791380            if disp.__class__.__name__ == 'str': 
    13801381                disp_model = None 
    1381                 com_str = "from sas.models.dispersion_models " 
     1382                com_str = "from sasmodels.weights " 
    13821383                com_str += "import %s as disp_func \ndisp_model = disp_func()" 
    13831384                exec com_str % disp 
     
    19441945            name = model.__class__.__name__ 
    19451946            if models.__name__ != "NoStructure": 
    1946                 if hasattr(model, "name"): 
     1947                if hasattr(model, "oldname"): 
     1948                    name = model.oldname 
     1949                elif hasattr(model, "name"): 
    19471950                    name = model.name 
    19481951                mlist.append((name, models)) 
     
    24582461        self.values = {} 
    24592462        self.weights = {} 
    2460  
    2461         from sas.models.dispersion_models import GaussianDispersion 
     2463       
     2464        #from sas.models.dispersion_models import GaussianDispersion 
     2465        from sasmodels.weights import GaussianDispersion 
    24622466        if len(self.disp_cb_dict) == 0: 
    24632467            self.save_current_state() 
     
    35873591        cat_tip = "Modify model categories \n" 
    35883592        cat_tip += "(also accessible from the menu bar)." 
    3589         show_cat_button.SetToolTip(wx.ToolTip(cat_tip)) 
     3593        show_cat_button.SetToolTip( wx.ToolTip(cat_tip) ) 
    35903594        show_cat_button.Bind(wx.EVT_BUTTON, self._on_modify_cat) 
    35913595        sizer_cat_box.Add(self.categorybox, 1, wx.RIGHT, 3) 
    3592         sizer_cat_box.Add((10, 10)) 
     3596        sizer_cat_box.Add((10,10)) 
    35933597        sizer_cat_box.Add(show_cat_button) 
    35943598        #self.shape_rbutton.SetValue(True) 
    3595  
     3599       
    35963600        sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 
    35973601        #sizer_radiobutton.Add(self.shape_rbutton) 
    35983602        #sizer_radiobutton.Add(self.shape_indep_rbutton) 
    3599         sizer_radiobutton.Add((5, 5)) 
     3603        sizer_radiobutton.Add((5,5)) 
    36003604        sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 5) 
    36013605        #sizer_radiobutton.Add(self.plugin_rbutton) 
  • src/sas/sasgui/perspectives/fitting/models.py

    rd85c194 rd85c194  
    66import os 
    77import sys 
     8import math 
    89import os.path 
    910# Time is needed by the log method 
     
    1213import py_compile 
    1314import shutil 
     15from sas.guiframe.events import StatusEvent 
    1416# Explicitly import from the pluginmodel module so that py2exe 
    1517# places it in the distribution. The Model1DPlugin class is used 
    1618# as the base class of plug-in models. 
    1719from sas.models.pluginmodel import Model1DPlugin 
     20from sas.models.BaseComponent import BaseComponent 
    1821from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    1922 
     23from sasmodels.sasview_model import make_class 
     24    
    2025PLUGIN_DIR = 'plugin_models' 
    2126 
     
    314319 
    315320        # regular model names only 
    316         base_message = "Unable to load model {0}" 
    317321        self.model_name_list = [] 
    318         try: 
    319             from sas.models.SphereModel import SphereModel 
    320             self.model_dictionary[SphereModel.__name__] = SphereModel 
    321             #        self.shape_list.append(SphereModel) 
    322             self.multiplication_factor.append(SphereModel) 
    323             self.model_name_list.append(SphereModel.__name__) 
    324         except: 
    325             logging.error(base_message.format(SphereModel.__name__)) 
     322 
     323        #Build list automagically from sasmodels package 
     324        import pkgutil 
     325        from importlib import import_module 
     326        import sasmodels.models 
     327        for importer,modname,ispkg in pkgutil.iter_modules(sasmodels.models.__path__): 
     328            if not ispkg: 
     329                module = import_module('.'+modname,'sasmodels.models') 
     330                self.model_dictionary[module.oldname] = make_class(module, dtype='single',namestyle='oldname') 
     331                self.model_name_list.append(module.oldname) 
     332 
     333 
     334        ### NASTY HACK - Comment out most of these lines as models are added to sasmodels. 
     335        ### Still need the lines that put models into multiplication etc 
     336 
     337        try: 
     338        #     # from sas.models.SphereModel import SphereModel 
     339        #     from sasmodels.models import sphere 
     340        #     SphereModel = make_class(sphere, dtype='single',namestyle='oldname') 
     341        #     self.model_dictionary[SphereModel.__name__] = SphereModel 
     342        #     #        self.shape_list.append(SphereModel) 
     343             self.multiplication_factor.append(SphereModel) 
     344        #     self.model_name_list.append(SphereModel.__name__) 
     345        except: 
     346            pass 
    326347 
    327348        try: 
     
    10771098        new_plugins = _findModels(dir) 
    10781099        for name, plug in  new_plugins.iteritems(): 
    1079             for stored_name, _ in self.stored_plugins.iteritems(): 
     1100            for stored_name, stored_plug in self.stored_plugins.iteritems(): 
    10801101                if name == stored_name: 
    10811102                    del self.stored_plugins[name] 
Note: See TracChangeset for help on using the changeset viewer.