source: sasview/guiframe/dataFitting.py @ afab469

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 afab469 was 20b6760, checked in by Jae Cho <jhjcho@…>, 15 years ago

Added qx qy data as 2D input parameters

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