[12aa9b5] | 1 | """ |
---|
[ff3f900b] | 2 | Adapters for fitting module |
---|
[12aa9b5] | 3 | """ |
---|
[ff3f900b] | 4 | from danse.common.plottools.plottables import Data1D as PlotData1D |
---|
| 5 | from danse.common.plottools.plottables import Data2D as PlotData2D |
---|
[e5664f2] | 6 | from danse.common.plottools.plottables import Theory1D as PlotTheory1D |
---|
[81812d9] | 7 | |
---|
[ff3f900b] | 8 | from DataLoader.data_info import Data1D as LoadData1D |
---|
| 9 | from DataLoader.data_info import Data2D as LoadData2D |
---|
[81812d9] | 10 | |
---|
[ff3f900b] | 11 | import copy |
---|
| 12 | |
---|
[3562fbc] | 13 | class Data1D(PlotData1D, LoadData1D): |
---|
[ff3f900b] | 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.x = copy.deepcopy(data1d.x) |
---|
| 27 | self.dx = copy.deepcopy(data1d.dx) |
---|
| 28 | self.y = copy.deepcopy(data1d.y) |
---|
| 29 | self.dy = copy.deepcopy(data1d.dy) |
---|
[09fe12d] | 30 | self.dxl = copy.deepcopy(data1d.dxl) |
---|
| 31 | self.dxw = copy.deepcopy(data1d.dxw) |
---|
[ff3f900b] | 32 | |
---|
| 33 | self.xaxis(data1d._xaxis,data1d._xunit) |
---|
| 34 | self.yaxis(data1d._yaxis,data1d._yunit) |
---|
[3562fbc] | 35 | |
---|
| 36 | def __str__(self): |
---|
| 37 | """ |
---|
| 38 | print data |
---|
| 39 | """ |
---|
| 40 | _str = "%s\n" % LoadData1D.__str__(self) |
---|
| 41 | |
---|
| 42 | return _str |
---|
[e5664f2] | 43 | class Theory1D(PlotTheory1D,LoadData1D): |
---|
[ff3f900b] | 44 | |
---|
[e5664f2] | 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.x = copy.deepcopy(data1d.x) |
---|
| 57 | self.y = 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) |
---|
[3562fbc] | 62 | def __str__(self): |
---|
| 63 | """ |
---|
| 64 | print data |
---|
| 65 | """ |
---|
| 66 | _str = "%s\n" % LoadData1D.__str__(self) |
---|
| 67 | |
---|
| 68 | return _str |
---|
[ff3f900b] | 69 | |
---|
| 70 | class 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 | |
---|
[20b6760] | 76 | LoadData2D.__init__(self,data=image, err_data=err_image, qx_data=None,qy_data=None,q_data=None,mask=None) |
---|
[ff3f900b] | 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) |
---|
[20b6760] | 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) |
---|
[ff3f900b] | 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 | |
---|
[3562fbc] | 99 | def __str__(self): |
---|
| 100 | """ |
---|
| 101 | print data |
---|
| 102 | """ |
---|
| 103 | _str = "%s\n" % LoadData2D.__str__(self) |
---|
| 104 | |
---|
| 105 | return _str |
---|
[ff3f900b] | 106 | |
---|