Changeset dcdca68 in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Apr 5, 2016 10:33:17 AM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
1780d8b
Parents:
eca66a1
Message:

adjust to new sasmodels interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/models.py

    r08959b8 rdcdca68  
    22    Utilities to manage models 
    33""" 
    4 import wx 
    54import imp 
    65import os 
    76import sys 
    8 import math 
    97import os.path 
    108# Time is needed by the log method 
     
    1311import py_compile 
    1412import shutil 
    15 from sas.sasgui.guiframe.events import StatusEvent 
    1613# Explicitly import from the pluginmodel module so that py2exe 
    1714# places it in the distribution. The Model1DPlugin class is used 
    1815# as the base class of plug-in models. 
    1916from sas.sascalc.fit.pluginmodel import Model1DPlugin 
    20 from sas.sascalc.calculator.BaseComponent import BaseComponent 
    2117from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    22 from sasmodels import sasview_model,core 
     18from sasmodels.sasview_model import load_custom_model, load_standard_models 
    2319 
    2420 
     
    2723def get_model_python_path(): 
    2824    """ 
    29         Returns the python path for a model 
     25    Returns the python path for a model 
    3026    """ 
    3127    return os.path.dirname(__file__) 
     
    3430def log(message): 
    3531    """ 
    36         Log a message in a file located in the user's home directory 
     32    Log a message in a file located in the user's home directory 
    3733    """ 
    3834    dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR) 
     
    8783def find_plugins_dir(): 
    8884    """ 
    89         Find path of the plugins directory. 
    90         The plugin directory is located in the user's home directory. 
     85    Find path of the plugins directory. 
     86    The plugin directory is located in the user's home directory. 
    9187    """ 
    9288    dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR) 
     
    133129class ReportProblem: 
    134130    """ 
    135         Class to check for problems with specific values 
     131    Class to check for problems with specific values 
    136132    """ 
    137133    def __nonzero__(self): 
     
    159155 
    160156def _findModels(dir): 
    161     """ 
    162     """ 
    163157    # List of plugin objects 
    164158    plugins = {} 
     
    198192                    else: 
    199193                        filename = os.path.join(dir, item) 
    200                         plugins[name] = sasview_model.make_class_from_file(filename)  
     194                        plugins[name] = load_custom_model(filename) 
    201195 
    202196                except: 
     
    252246class ModelManagerBase: 
    253247    """ 
    254         Base class for the model manager 
     248    Base class for the model manager 
    255249    """ 
    256250    ## external dict for models 
     
    273267 
    274268    def __init__(self): 
    275         """ 
    276         """ 
    277269        self.model_dictionary = {} 
    278270        self.stored_plugins = {} 
     
    300292 
    301293        # regular model names only 
    302         base_message = "Unable to load model {0}" 
    303294        self.model_name_list = [] 
    304295 
    305296        #Build list automagically from sasmodels package 
    306         for model in sasview_model.standard_models(): 
     297        for model in load_standard_models(): 
    307298            self.model_dictionary[model._model_info['name']] = model 
    308299            if model._model_info['structure_factor'] == True: 
     
    328319        """ 
    329320        check the last time the plugin dir has changed and return true 
    330          is the directory was modified else return false 
     321        is the directory was modified else return false 
    331322        """ 
    332323        is_modified = False 
Note: See TracChangeset for help on using the changeset viewer.