[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 | |
---|
| 76 | LoadData2D.__init__(self,data=image, err_data=err_image) |
---|
| 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.err_data = copy.deepcopy(data2d.err_data) |
---|
| 84 | self.x_bins = copy.deepcopy(data2d.x_bins) |
---|
| 85 | self.y_bins = copy.deepcopy(data2d.y_bins) |
---|
| 86 | |
---|
| 87 | self.xmin = data2d.xmin |
---|
| 88 | self.xmax = data2d.xmax |
---|
| 89 | self.ymin = data2d.ymin |
---|
| 90 | self.ymax = data2d.ymax |
---|
| 91 | |
---|
| 92 | self.xaxis(data2d._xaxis,data2d._xunit) |
---|
| 93 | self.yaxis(data2d._yaxis,data2d._yunit) |
---|
| 94 | |
---|
[3562fbc] | 95 | def __str__(self): |
---|
| 96 | """ |
---|
| 97 | print data |
---|
| 98 | """ |
---|
| 99 | _str = "%s\n" % LoadData2D.__str__(self) |
---|
| 100 | |
---|
| 101 | return _str |
---|
[ff3f900b] | 102 | |
---|