source: sasview/guiframe/dataFitting.py @ 7068cc7

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 7068cc7 was 8e87ece, checked in by Gervaise Alina <gervyh@…>, 14 years ago

working on hide and show error

  • Property mode set to 100644
File size: 3.9 KB
Line 
1"""
2    Adapters for fitting module
3"""
4import copy
5import numpy
6
7from danse.common.plottools.plottables import Data1D as PlotData1D
8from danse.common.plottools.plottables import Data2D as PlotData2D
9from danse.common.plottools.plottables import Theory1D as PlotTheory1D
10
11from DataLoader.data_info import Data1D as LoadData1D
12from DataLoader.data_info import Data2D as LoadData2D
13
14class Data1D(PlotData1D, LoadData1D):
15   
16    def __init__(self, x=[], y=[], dx=None, dy=None):
17        PlotData1D.__init__(self, x, y, dx, dy)
18        LoadData1D.__init__(self, x, y, dx, dy)
19        self.id= None
20        self.group_id =None
21        self.is_data = True
22   
23    def copy_from_datainfo(self, data1d):
24        """
25            copy values of Data1D of type DataLaoder.Data_info
26        """
27        self.= copy.deepcopy(data1d.x)
28        self.= copy.deepcopy(data1d.y)
29        self.dy = copy.deepcopy(data1d.dy)
30       
31        if hasattr(data1d, "dx"):
32            self.dx = copy.deepcopy(data1d.dx)   
33        if hasattr(data1d, "dxl"):
34            self.dxl = copy.deepcopy(data1d.dxl)
35        if hasattr(data1d, "dxw"):
36            self.dxw = copy.deepcopy(data1d.dxw)
37   
38        self.xaxis(data1d._xaxis,data1d._xunit)
39        self.yaxis(data1d._yaxis,data1d._yunit)
40       
41    def __str__(self):
42        """
43            print data
44        """
45        _str = "%s\n" % LoadData1D.__str__(self)
46     
47        return _str
48class Theory1D(PlotTheory1D,LoadData1D):
49   
50    def __init__(self,x=[],y=[],dy=None):
51        PlotTheory1D.__init__(self, x, y, dy)
52        LoadData1D.__init__(self, x, y, dy)
53        self.id= None
54        self.group_id = None
55        self.is_data = True
56   
57    def copy_from_datainfo(self, data1d):
58        """
59            copy values of Data1D of type DataLaoder.Data_info
60        """
61        self.= copy.deepcopy(data1d.x)
62        self.= copy.deepcopy(data1d.y)
63        self.dy = copy.deepcopy(data1d.dy)
64        if hasattr(data1d, "dx"):
65            self.dx = copy.deepcopy(data1d.dx) 
66        if hasattr(data1d, "dxl"):
67            self.dxl = copy.deepcopy(data1d.dxl)
68        if hasattr(data1d, "dxw"):
69            self.dxw = copy.deepcopy(data1d.dxw)   
70        self.xaxis(data1d._xaxis,data1d._xunit)
71        self.yaxis(data1d._yaxis,data1d._yunit)
72       
73    def __str__(self):
74        """
75            print data
76        """
77        _str = "%s\n" % LoadData1D.__str__(self)
78     
79        return _str
80     
81class Data2D(PlotData2D,LoadData2D):
82    def __init__(self,image=None,err_image=None,xmin=None,xmax=None,ymin=None,ymax=None,zmin=None,zmax=None):
83       
84        PlotData2D.__init__(self, image=image, err_image=err_image,xmin=xmin, xmax=xmax,
85                            ymin=ymin, ymax=ymax)
86       
87        LoadData2D.__init__(self,data=image, err_data=err_image, qx_data=None,qy_data=None,q_data=None,mask=None)
88       
89    def copy_from_datainfo(self, data2d):
90        """
91            copy value of Data2D of type DataLoader.data_info
92        """
93        self.data     =  copy.deepcopy(data2d.data)
94        self.qx_data     =  copy.deepcopy(data2d.qx_data)
95        self.qy_data     =  copy.deepcopy(data2d.qy_data)
96        self.q_data     =  copy.deepcopy(data2d.q_data)
97        self.mask     =  copy.deepcopy(data2d.mask)
98        self.err_data =  copy.deepcopy(data2d.err_data)
99        self.x_bins     = copy.deepcopy(data2d.x_bins)
100        self.y_bins     = copy.deepcopy(data2d.y_bins)
101       
102        self.xmin       = data2d.xmin
103        self.xmax       = data2d.xmax
104        self.ymin       = data2d.ymin
105        self.ymax       = data2d.ymax
106       
107        self.xaxis(data2d._xaxis,data2d._xunit)
108        self.yaxis(data2d._yaxis,data2d._yunit)
109       
110    def __str__(self):
111        """
112            print data
113        """
114        _str = "%s\n" % LoadData2D.__str__(self)
115     
116        return _str
117       
Note: See TracBrowser for help on using the repository browser.