Changeset 1abcb04 in sasview for guiframe


Ignore:
Timestamp:
Jun 5, 2009 9:08:48 PM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
410aad8
Parents:
7d8094b
Message:

guiframe: modified the dataFitting.Data1D to be a child class of DataLoader?.data_info.Data1D, as was originally designed. Added lots of TODOs for refactoring. Inserted a call to bridge the data of the newly defined Data1D to the output of DataLoader?. The data_loader module needs a lot of work.

Location:
guiframe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • guiframe/dataFitting.py

    r858fabed r1abcb04  
    11""" 
    2     Adapters for fitting module 
     2    A Data1D class compatible with guiframe from the output of DataLoader.  
    33""" 
    44from danse.common.plottools.plottables import Data1D as plotData1D 
    55from danse.common.plottools.plottables import Theory1D as plotTheory1D 
    66 
    7 from DataLoader.data_info import DataInfo 
     7from DataLoader.data_info import Data1D as loader_data_1D 
    88 
    9 class Data1D(plotData1D,DataInfo): 
    10      
     9class Data1D(plotData1D, loader_data_1D): 
     10    """ 
     11        A Data1D class compatible with guiframe from  
     12        the output of DataLoader. The new class inherits  
     13        from DataLoader.data_info.Data1D 
     14    """ 
    1115    def __init__(self,x=[],y=[],dx=None,dy=None,dxl=None, dxw=None): 
    1216        plotData1D.__init__(self, x, y, dx, dy) 
     17        loader_data_1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 
    1318        self.smearer=None 
    1419        
     
    1621        self.dxw = dxw 
    1722  
    18 class Theory1D(plotTheory1D,DataInfo): 
     23class Theory1D(plotTheory1D, loader_data_1D): 
     24    """ 
     25        A Theory1D class compatible with guiframe from  
     26        the output of DataLoader. The new class inherits  
     27        from DataLoader.data_info.Data1D 
     28    """ 
    1929    def __init__(self,x=[],y=[],dy=None,dxl=None, dxw=None): 
    2030        plotTheory1D.__init__(self, x, y) 
     31        loader_data_1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 
    2132        self.smearer=None 
    2233         
  • guiframe/data_loader.py

    r25ccf33 r1abcb04  
    7474    """ 
    7575        Use the DataLoader loader to created data to plot. 
     76         
     77        TODO: this method needs a major cleanup.  
     78        It's a complete mess. It needs: 
     79          - to be cleaned of code duplication 
     80          - to be cleaned of data duplication: we should not 
     81            need to reference all the Data1D data members. 
     82            It should be sufficient to use the Data1D class 
     83            defined in dataFitting (which btw needs a better name). 
     84         
    7685        @param path: the path of the data to load 
    7786    """ 
     
    125134            new_plot = Data1D(x=output.x, y=output.y, dx=output.dx, 
    126135                              dy= dy, dxl=dxl, dxw=dxw) 
     136            # Copy all the data to the new object so that the  
     137            # new_plot object properly behaves as a data_info.Data1D. 
     138            # This also means that we should not have to copy all 
     139            # the data below... 
     140            output.clone_without_data(clone=new_plot) 
    127141                 
    128142        ## source will request in dataLoader .manipulation module 
     
    160174         
    161175    ## the output of the loader is a list , some xml files contain more than one data 
     176    #TODO: refactor this so that there is no duplication of code. 
     177    # There is no reason why the code above shouldn't be put in  
     178    # a private method to be used within the loop below. 
    162179    else: 
    163180        i=1 
     
    176193                
    177194            new_plot = Data1D(x=item.x,y=item.y,dx=dx,dy=item.dy,dxl=dxl,dxw=dxw) 
     195            # Copy all the data to the new object 
     196            item.clone_without_data(clone=new_plot) 
    178197            new_plot.source=item.source 
    179198             
  • guiframe/local_perspectives/plotting/Plotter1D.py

    r8068b52 r1abcb04  
    419419        """ 
    420420            Save 1D  Data to  XML file 
     421             
     422            TODO: Refactor and remove this method. See TODO in _onSave. 
     423             
    421424            @param evt: Menu event 
    422425        """ 
     
    439442        """ 
    440443            Save file as txt 
     444             
     445            TODO: Refactor and remove this method. See TODO in _onSave. 
    441446        """ 
    442447        data = self.plots[self.graph.selected_plottable] 
     
    495500                path = dlg.GetPath() 
    496501                mypath = os.path.basename(path) 
     502                 
     503                #TODO: This is bad design. The DataLoader is designed to recognize extensions. 
     504                # It should be a simple matter of calling the .save(file, data, '.xml') method 
     505                # of the DataLoader.loader.Loader class.  
     506                 
    497507                if os.path.splitext(mypath)[1].lower() ==".txt": 
    498508                    self._onsaveTXT(path) 
Note: See TracChangeset for help on using the changeset viewer.