Changeset dcdca68 in sasview
- Timestamp:
- Apr 5, 2016 10:33:17 AM (9 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:
- 1780d8b
- Parents:
- eca66a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/models.py
r08959b8 rdcdca68 2 2 Utilities to manage models 3 3 """ 4 import wx5 4 import imp 6 5 import os 7 6 import sys 8 import math9 7 import os.path 10 8 # Time is needed by the log method … … 13 11 import py_compile 14 12 import shutil 15 from sas.sasgui.guiframe.events import StatusEvent16 13 # Explicitly import from the pluginmodel module so that py2exe 17 14 # places it in the distribution. The Model1DPlugin class is used 18 15 # as the base class of plug-in models. 19 16 from sas.sascalc.fit.pluginmodel import Model1DPlugin 20 from sas.sascalc.calculator.BaseComponent import BaseComponent21 17 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 22 from sasmodels import sasview_model,core18 from sasmodels.sasview_model import load_custom_model, load_standard_models 23 19 24 20 … … 27 23 def get_model_python_path(): 28 24 """ 29 25 Returns the python path for a model 30 26 """ 31 27 return os.path.dirname(__file__) … … 34 30 def log(message): 35 31 """ 36 32 Log a message in a file located in the user's home directory 37 33 """ 38 34 dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR) … … 87 83 def find_plugins_dir(): 88 84 """ 89 90 85 Find path of the plugins directory. 86 The plugin directory is located in the user's home directory. 91 87 """ 92 88 dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR) … … 133 129 class ReportProblem: 134 130 """ 135 131 Class to check for problems with specific values 136 132 """ 137 133 def __nonzero__(self): … … 159 155 160 156 def _findModels(dir): 161 """162 """163 157 # List of plugin objects 164 158 plugins = {} … … 198 192 else: 199 193 filename = os.path.join(dir, item) 200 plugins[name] = sasview_model.make_class_from_file(filename)194 plugins[name] = load_custom_model(filename) 201 195 202 196 except: … … 252 246 class ModelManagerBase: 253 247 """ 254 248 Base class for the model manager 255 249 """ 256 250 ## external dict for models … … 273 267 274 268 def __init__(self): 275 """276 """277 269 self.model_dictionary = {} 278 270 self.stored_plugins = {} … … 300 292 301 293 # regular model names only 302 base_message = "Unable to load model {0}"303 294 self.model_name_list = [] 304 295 305 296 #Build list automagically from sasmodels package 306 for model in sasview_model.standard_models():297 for model in load_standard_models(): 307 298 self.model_dictionary[model._model_info['name']] = model 308 299 if model._model_info['structure_factor'] == True: … … 328 319 """ 329 320 check the last time the plugin dir has changed and return true 330 321 is the directory was modified else return false 331 322 """ 332 323 is_modified = False
Note: See TracChangeset
for help on using the changeset viewer.