Changeset 2fff4db in sasview for sansview/perspectives/fitting


Ignore:
Timestamp:
Apr 8, 2010 6:09:07 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
286bb6c
Parents:
8e87ece
Message:

working on select theory or data to fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fitting.py

    redcbd467 r2fff4db  
    1313import time 
    1414import thread 
    15  
    1615from copy import deepcopy 
     16 
    1717from DataLoader.data_info import Data1D as LoaderData1D 
    1818from danse.common.plottools.PlotPanel import PlotPanel 
     
    2121from sans.guiframe.dataFitting import Data1D 
    2222from sans.guiframe.dataFitting import Theory1D 
    23 from sans.guiframe import dataFitting  
     23 
    2424from sans.guiframe.utils import format_number 
    2525 
     
    291291        data.copy_from_datainfo(item) 
    292292        item.clone_without_data(clone=data)     
    293         data.dy=dy 
     293        data.dy = dy 
    294294        data.name = item.name 
    295295        ## allow to highlight data when plotted 
     
    544544        """ 
    545545        if data.__class__.__name__ != "Data2D": 
    546             raise Valueerror, " create_fittable_data2D expects a Data2D" 
     546            raise ValueError, " create_fittable_data2D expects a Data2D" 
    547547        ## Data2D case 
    548548        new_data = deepcopy(data) 
     
    564564            @return Data1D 
    565565        """ 
     566        class_name = data.__class__.__name__ 
     567        if not class_name in ["Data1D", "Theory1D"]: 
     568            raise ValueError, "create_fittable_data1D expects Data1D" 
     569        #For prview the theory is not a subclass of DataLoader.Data1D 
    566570        if not issubclass(data.__class__, LoaderData1D): 
    567             raise ValueError, "create_fittable_data1D expects Data1D" 
     571            if class_name == 'Theory1D': 
     572                temp_data = Theory1D(x=data.x, y=data.y, dy=data.y) 
     573                temp_data.copy_from_datainfo(data1d=data) 
     574                temp_data.name = data.name 
     575            if class_name == 'Data1D': 
     576                temp_data = Data1D(x=data.x, y=data.y, dx=data.dx, dy=data.y) 
     577                temp_data.copy_from_datainfo(data=data) 
     578                temp_data.name = data.name 
     579            data = temp_data 
     580         
    568581        #get the appropriate dy  
    569582        dy = deepcopy(data.dy) 
     
    571584            if data.name in  self.err_dy.iterkeys(): 
    572585                dy = self.err_dy[data.name]    
    573                 print "err_dy ====", dy  
     586                
    574587        if data.dy is None or data.dy == []: 
    575588            dy = numpy.zeros(len(data.y)) 
    576         print "dy ====", dy  
     589        #print "dy ====", dy  
    577590        if data.__class__.__name__ == "Theory1D": 
    578              
    579591            new_data = self.copy_data(data, dy) 
    580             new_data.group_id += "data1D" 
    581             new_data.id +="data1D" 
     592            new_data.group_id = str(new_data.group_id)+"data1D" 
     593            new_data.id = str(new_data.id)+"data1D" 
    582594            new_data.is_data = False 
    583595            title = new_data.name 
     
    731743        Plugin.on_perspective(self,event=event) 
    732744        for plottable in self.panel.graph.plottables: 
    733             if issubclass(plottable.__class__, LoaderData1D): 
     745            if plottable.__class__.__name__ in ["Data1D", "Theory1D"]: 
    734746                if plottable.name == self.panel.graph.selected_plottable: 
    735747                    data = self.create_fittable_data1D(data=plottable) 
Note: See TracChangeset for help on using the changeset viewer.