source: sasview/guiframe/dataFitting.py @ 7a108dd

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 7a108dd was 09fe12d, checked in by Gervaise Alina <gervyh@…>, 15 years ago

modify datat1D to copy properly dxl and dxw

  • Property mode set to 100644
File size: 2.8 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   
36class Theory1D(PlotTheory1D,LoadData1D):
37   
38    def __init__(self,x=[],y=[],dy=None):
39        PlotTheory1D.__init__(self, x, y, dy)
40        LoadData1D.__init__(self, x, y, dy)
41        self.id= None
42        self.group_id =None
43        self.is_data = True
44   
45    def copy_from_datainfo(self, data1d):
46        """
47            copy values of Data1D of type DataLaoder.Data_info
48        """
49        self.= copy.deepcopy(data1d.x)
50        self.= copy.deepcopy(data1d.y)
51        self.dy = copy.deepcopy(data1d.dy)
52   
53        self.xaxis(data1d._xaxis,data1d._xunit)
54        self.yaxis(data1d._yaxis,data1d._yunit)
55     
56class Data2D(PlotData2D,LoadData2D):
57    def __init__(self,image=None,err_image=None,xmin=None,xmax=None,ymin=None,ymax=None,zmin=None,zmax=None):
58       
59        PlotData2D.__init__(self, image=image, err_image=err_image,xmin=xmin, xmax=xmax,
60                            ymin=ymin, ymax=ymax)
61       
62        LoadData2D.__init__(self,data=image, err_data=err_image)
63       
64    def copy_from_datainfo(self, data2d):
65        """
66            copy value of Data2D of type DataLoader.data_info
67        """
68        self.data     =  copy.deepcopy(data2d.data)
69        self.err_data =  copy.deepcopy(data2d.err_data)
70        self.x_bins     = copy.deepcopy(data2d.x_bins)
71        self.y_bins     = copy.deepcopy(data2d.y_bins)
72       
73        self.xmin       = data2d.xmin
74        self.xmax       = data2d.xmax
75        self.ymin       = data2d.ymin
76        self.ymax       = data2d.ymax
77       
78        self.xaxis(data2d._xaxis,data2d._xunit)
79        self.yaxis(data2d._yaxis,data2d._yunit)
80       
81       
82       
Note: See TracBrowser for help on using the repository browser.