Changeset 65f3930 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Jun 26, 2017 4:22:56 PM (7 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, 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
Message:

move models.py to sascalc/fit

Location:
src/sas/sasgui/perspectives/fitting
Files:
3 edited

Legend:

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

    rba8d326 r65f3930  
    1919from wx.lib.scrolledpanel import ScrolledPanel 
    2020 
     21from sasmodels.sasview_model import MultiplicationModel 
    2122from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 
     23from sasmodels.weights import GaussianDispersion 
    2224 
    2325from sas.sascalc.dataloader.data_info import Detector 
    2426from sas.sascalc.dataloader.data_info import Source 
    2527from sas.sascalc.fit.pagestate import PageState 
     28from sas.sascalc.fit.models import PLUGIN_NAME_BASE 
    2629 
    2730from sas.sasgui.guiframe.panel_base import PanelBase 
     
    3841from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
    3942 
    40 from sas.sasgui.perspectives.fitting.report_dialog import ReportDialog 
     43from .report_dialog import ReportDialog 
     44from .utils import get_weight 
    4145 
    4246logger = logging.getLogger(__name__) 
     
    12141218        self.categorybox.Select(category_pos) 
    12151219        self._show_combox(None) 
    1216         from models import PLUGIN_NAME_BASE 
    12171220        if self.categorybox.GetValue() == CUSTOM_MODEL \ 
    12181221                and PLUGIN_NAME_BASE not in state.formfactorcombobox: 
     
    17521755                    temp_smear = self.current_smearer 
    17531756            # compute weight for the current data 
    1754             from sas.sasgui.perspectives.fitting.utils import get_weight 
    17551757            flag = self.get_weight_flag() 
    17561758            weight = get_weight(data=self.data, is2d=self._is_2D(), flag=flag) 
     
    17781780 
    17791781        from sas.sasgui.plottools import Data1D as pf_data1d 
    1780         # from sas.sasgui.perspectives.theory.profile_dialog import SLDPanel 
    17811782        from sas.sasgui.guiframe.local_perspectives.plotting.profile_dialog \ 
    17821783            import SLDPanel 
     
    20742075 
    20752076        if struct_factor is not None: 
    2076             from sasmodels.sasview_model import MultiplicationModel 
    20772077            self.model = MultiplicationModel(form_factor(self.multi_factor), 
    20782078                                             struct_factor()) 
     
    23962396        self.weights = {} 
    23972397 
    2398         # from sas.models.dispersion_models import GaussianDispersion 
    2399         from sasmodels.weights import GaussianDispersion 
    24002398        if not self.disp_cb_dict: 
    24012399            self.sizer4_4.Clear(True) 
  • src/sas/sasgui/perspectives/fitting/fitpanel.py

    r67b0a99 r65f3930  
    99from wx.aui import AuiNotebook as nb 
    1010 
     11from sas.sascalc.fit.models import ModelManager 
     12 
    1113from sas.sasgui.guiframe.panel_base import PanelBase 
    1214from sas.sasgui.guiframe.events import PanelOnFocusEvent, StatusEvent 
    1315from 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 
     18from . import basepage 
     19from .fitpage import FitPage 
     20from .simfitpage import SimultaneousFitPage 
     21from .batchfitpage import BatchFitPage 
     22from .fitting_widgets import BatchDataDialog 
     23 
    1824_BOX_WIDTH = 80 
    1925 
     
    4652        self.event_owner = None 
    4753        # dictionary of miodel {model class name, model class} 
    48         self.menu_mng = models.ModelManager() 
     54        self.menu_mng = ModelManager() 
    4955        self.model_list_box = self.menu_mng.get_model_list() 
    5056        # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 
     
    310316        Add the simultaneous fit page 
    311317        """ 
    312         from simfitpage import SimultaneousFitPage 
    313318        page_finder = self._manager.get_page_finder() 
    314319        if caption == "Const & Simul Fit": 
     
    338343        """ 
    339344        if self.batch_on: 
    340             from batchfitpage import BatchFitPage 
    341345            panel = BatchFitPage(parent=self) 
    342346            self.batch_page_index += 1 
     
    345349        else: 
    346350            # Increment index of fit page 
    347             from fitpage import FitPage 
    348351            panel = FitPage(parent=self) 
    349352            self.fit_page_index += 1 
     
    443446        if data_1d_list and data_2d_list: 
    444447            # need to warning the user that this batch is a special case 
    445             from sas.sasgui.perspectives.fitting.fitting_widgets import \ 
    446                 BatchDataDialog 
    447448            dlg = BatchDataDialog(self) 
    448449            if dlg.ShowModal() == wx.ID_OK: 
  • src/sas/sasgui/perspectives/fitting/model_thread.py

    rba8d326 r65f3930  
    44 
    55import time 
     6import math 
     7 
    68import numpy as np 
    7 import math 
     9 
    810from sas.sascalc.data_util.calcthread import CalcThread 
    911from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 
     
    240242    class CalcCommandline: 
    241243        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])) 
    249251 
    250252            qmax = 0.01 
     
    255257            y = numpy.arange(-qmax, qmax+qstep*0.01, qstep) 
    256258 
    257  
    258259            calc_thread_2D = Calc2D(x, y, None, model.clone(),None, 
    259260                                    -qmax, qmax,qstep, 
    260                                             completefn=self.complete, 
    261                                             updatefn=self.update , 
    262                                             yieldtime=0.0) 
     261                                    completefn=self.complete, 
     262                                    updatefn=self.update , 
     263                                    yieldtime=0.0) 
    263264 
    264265            calc_thread_2D.queue() 
     
    269270 
    270271        def update(self,output): 
    271             print "update" 
     272            print("update") 
    272273 
    273274        def complete(self, image, data, model, elapsed, qmin, qmax,index, qstep ): 
    274             print "complete" 
     275            print("complete") 
    275276            self.done = True 
    276277 
Note: See TracChangeset for help on using the changeset viewer.