Changeset 65f3930 in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Jun 26, 2017 6:22:56 PM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 50fcb09
- Parents:
- 98e3f24
- Location:
- src/sas/sasgui/perspectives
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
ra1b8fee r65f3930 657 657 self.warning = "" 658 658 #This does not seem to be used anywhere so commenting out for now 659 # -- PDB 2/26/17 659 # -- PDB 2/26/17 660 660 #self._description = "New Plugin Model" 661 661 self.function_tcl = None … … 740 740 self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10), 741 741 (self.param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) 742 742 743 743 # Parameters with polydispersity 744 744 pd_param_txt = wx.StaticText(self, -1, 'Fit Parameters requiring ' + \ … … 755 755 self.pd_param_tcl.setDisplayLineNumbers(True) 756 756 self.pd_param_tcl.SetToolTipString(pd_param_tip) 757 757 758 758 self.param_sizer.AddMany([(pd_param_txt, 0, wx.LEFT, 10), 759 759 (self.pd_param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) … … 1030 1030 if has_scipy: 1031 1031 lines.insert(0, 'import scipy') 1032 1033 # Think about 2D later 1032 1033 # Think about 2D later 1034 1034 #self.is_2d = func_str.count("#self.ndim = 2") 1035 1035 #line_2d = '' 1036 1036 #if self.is_2d: 1037 1037 # line_2d = CUSTOM_2D_TEMP.split('\n') 1038 1039 # Also think about test later 1038 1039 # Also think about test later 1040 1040 #line_test = TEST_TEMPLATE.split('\n') 1041 1041 #local_params = '' … … 1043 1043 spaces4 = ' '*4 1044 1044 spaces13 = ' '*13 1045 spaces16 = ' '*16 1045 spaces16 = ' '*16 1046 1046 param_names = [] # to store parameter names 1047 1047 has_scipy = func_str.count("scipy.") … … 1055 1055 out_f.write(line + '\n') 1056 1056 if line.count('#name'): 1057 out_f.write('name = "%s" \n' % name) 1057 out_f.write('name = "%s" \n' % name) 1058 1058 elif line.count('#title'): 1059 out_f.write('title = "User model for %s"\n' % name) 1059 out_f.write('title = "User model for %s"\n' % name) 1060 1060 elif line.count('#description'): 1061 out_f.write('description = "%s"\n' % desc_str) 1061 out_f.write('description = "%s"\n' % desc_str) 1062 1062 elif line.count('#parameters'): 1063 1063 out_f.write('parameters = [ \n') … … 1075 1075 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', ''],\n" % (spaces16, pname, pvalue)) 1076 1076 out_f.write('%s]\n' % spaces13) 1077 1077 1078 1078 # No form_volume or ER available in simple model editor 1079 1079 out_f.write('def form_volume(*arg): \n') … … 1082 1082 out_f.write('def ER(*arg): \n') 1083 1083 out_f.write(' return 1.0 \n') 1084 1084 1085 1085 # function to compute 1086 1086 out_f.write('\n') … … 1091 1091 for func_line in func_str.split('\n'): 1092 1092 out_f.write('%s%s\n' % (spaces4, func_line)) 1093 1093 1094 1094 Iqxy_string = 'return Iq(numpy.sqrt(x**2+y**2) ' 1095 1095 1096 1096 out_f.write('\n') 1097 1097 out_f.write('def Iqxy(x, y ') … … 1204 1204 import numpy 1205 1205 1206 #name 1206 #name 1207 1207 1208 1208 #title … … 1210 1210 #description 1211 1211 1212 #parameters 1212 #parameters 1213 1213 1214 1214 """ … … 1590 1590 1591 1591 if __name__ == "__main__": 1592 # app = wx.PySimpleApp()1593 1592 main_app = wx.App() 1594 1593 main_frame = TextDialog(id=1, model_list=["SphereModel", "CylinderModel"], … … 1596 1595 main_frame.ShowModal() 1597 1596 main_app.MainLoop() 1598 1599 #if __name__ == "__main__":1600 # from sas.sasgui.perspectives.fitting import models1601 # dir_path = models.find_plugins_dir()1602 # app = wx.App()1603 # window = EditorWindow(parent=None, base=None, path=dir_path, title="Editor")1604 # app.MainLoop() -
src/sas/sasgui/perspectives/fitting/basepage.py
rba8d326 r65f3930 19 19 from wx.lib.scrolledpanel import ScrolledPanel 20 20 21 from sasmodels.sasview_model import MultiplicationModel 21 22 from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 23 from sasmodels.weights import GaussianDispersion 22 24 23 25 from sas.sascalc.dataloader.data_info import Detector 24 26 from sas.sascalc.dataloader.data_info import Source 25 27 from sas.sascalc.fit.pagestate import PageState 28 from sas.sascalc.fit.models import PLUGIN_NAME_BASE 26 29 27 30 from sas.sasgui.guiframe.panel_base import PanelBase … … 38 41 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 39 42 40 from sas.sasgui.perspectives.fitting.report_dialog import ReportDialog 43 from .report_dialog import ReportDialog 44 from .utils import get_weight 41 45 42 46 logger = logging.getLogger(__name__) … … 1214 1218 self.categorybox.Select(category_pos) 1215 1219 self._show_combox(None) 1216 from models import PLUGIN_NAME_BASE1217 1220 if self.categorybox.GetValue() == CUSTOM_MODEL \ 1218 1221 and PLUGIN_NAME_BASE not in state.formfactorcombobox: … … 1752 1755 temp_smear = self.current_smearer 1753 1756 # compute weight for the current data 1754 from sas.sasgui.perspectives.fitting.utils import get_weight1755 1757 flag = self.get_weight_flag() 1756 1758 weight = get_weight(data=self.data, is2d=self._is_2D(), flag=flag) … … 1778 1780 1779 1781 from sas.sasgui.plottools import Data1D as pf_data1d 1780 # from sas.sasgui.perspectives.theory.profile_dialog import SLDPanel1781 1782 from sas.sasgui.guiframe.local_perspectives.plotting.profile_dialog \ 1782 1783 import SLDPanel … … 2074 2075 2075 2076 if struct_factor is not None: 2076 from sasmodels.sasview_model import MultiplicationModel2077 2077 self.model = MultiplicationModel(form_factor(self.multi_factor), 2078 2078 struct_factor()) … … 2396 2396 self.weights = {} 2397 2397 2398 # from sas.models.dispersion_models import GaussianDispersion2399 from sasmodels.weights import GaussianDispersion2400 2398 if not self.disp_cb_dict: 2401 2399 self.sizer4_4.Clear(True) -
src/sas/sasgui/perspectives/fitting/fitpanel.py
r67b0a99 r65f3930 9 9 from wx.aui import AuiNotebook as nb 10 10 11 from sas.sascalc.fit.models import ModelManager 12 11 13 from sas.sasgui.guiframe.panel_base import PanelBase 12 14 from sas.sasgui.guiframe.events import PanelOnFocusEvent, StatusEvent 13 15 from sas.sasgui.guiframe.dataFitting import check_data_validity 14 from sas.sasgui.perspectives.fitting.simfitpage import SimultaneousFitPage 15 16 import basepage 17 import models 16 17 18 from . import basepage 19 from .fitpage import FitPage 20 from .simfitpage import SimultaneousFitPage 21 from .batchfitpage import BatchFitPage 22 from .fitting_widgets import BatchDataDialog 23 18 24 _BOX_WIDTH = 80 19 25 … … 46 52 self.event_owner = None 47 53 # dictionary of miodel {model class name, model class} 48 self.menu_mng = models.ModelManager()54 self.menu_mng = ModelManager() 49 55 self.model_list_box = self.menu_mng.get_model_list() 50 56 # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING … … 310 316 Add the simultaneous fit page 311 317 """ 312 from simfitpage import SimultaneousFitPage313 318 page_finder = self._manager.get_page_finder() 314 319 if caption == "Const & Simul Fit": … … 338 343 """ 339 344 if self.batch_on: 340 from batchfitpage import BatchFitPage341 345 panel = BatchFitPage(parent=self) 342 346 self.batch_page_index += 1 … … 345 349 else: 346 350 # Increment index of fit page 347 from fitpage import FitPage348 351 panel = FitPage(parent=self) 349 352 self.fit_page_index += 1 … … 443 446 if data_1d_list and data_2d_list: 444 447 # need to warning the user that this batch is a special case 445 from sas.sasgui.perspectives.fitting.fitting_widgets import \446 BatchDataDialog447 448 dlg = BatchDataDialog(self) 448 449 if dlg.ShowModal() == wx.ID_OK: -
src/sas/sasgui/perspectives/fitting/model_thread.py
rba8d326 r65f3930 4 4 5 5 import time 6 import math 7 6 8 import numpy as np 7 import math 9 8 10 from sas.sascalc.data_util.calcthread import CalcThread 9 11 from sas.sascalc.fit.MultiplicationModel import MultiplicationModel … … 240 242 class CalcCommandline: 241 243 def __init__(self, n=20000): 242 #print thread.get_ident()243 from sas.models.CylinderModel import CylinderModel 244 245 model = CylinderModel()246 247 248 print model.runXY([0.01, 0.02])244 #print(thread.get_ident()) 245 246 from sasmodels.sasview_model import _make_standard_model 247 cylinder = _make_standard_model('cylinder') 248 model = cylinder() 249 250 print(model.runXY([0.01, 0.02])) 249 251 250 252 qmax = 0.01 … … 255 257 y = numpy.arange(-qmax, qmax+qstep*0.01, qstep) 256 258 257 258 259 calc_thread_2D = Calc2D(x, y, None, model.clone(),None, 259 260 -qmax, qmax,qstep, 260 261 262 261 completefn=self.complete, 262 updatefn=self.update , 263 yieldtime=0.0) 263 264 264 265 calc_thread_2D.queue() … … 269 270 270 271 def update(self,output): 271 print "update"272 print("update") 272 273 273 274 def complete(self, image, data, model, elapsed, qmin, qmax,index, qstep ): 274 print "complete"275 print("complete") 275 276 self.done = True 276 277
Note: See TracChangeset
for help on using the changeset viewer.