Changeset 9c0f3c17 in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Apr 4, 2017 12:50:04 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f2940c4
- Parents:
- 463e7ffc (diff), 1779e72 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sascalc/dataloader
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/data_info.py
r2ffe241 r9a5097c 23 23 #from sas.guitools.plottables import Data1D as plottable_1D 24 24 from sas.sascalc.data_util.uncertainty import Uncertainty 25 import numpy 25 import numpy as np 26 26 import math 27 27 … … 51 51 52 52 def __init__(self, x, y, dx=None, dy=None, dxl=None, dxw=None, lam=None, dlam=None): 53 self.x = n umpy.asarray(x)54 self.y = n umpy.asarray(y)53 self.x = np.asarray(x) 54 self.y = np.asarray(y) 55 55 if dx is not None: 56 self.dx = n umpy.asarray(dx)56 self.dx = np.asarray(dx) 57 57 if dy is not None: 58 self.dy = n umpy.asarray(dy)58 self.dy = np.asarray(dy) 59 59 if dxl is not None: 60 self.dxl = n umpy.asarray(dxl)60 self.dxl = np.asarray(dxl) 61 61 if dxw is not None: 62 self.dxw = n umpy.asarray(dxw)62 self.dxw = np.asarray(dxw) 63 63 if lam is not None: 64 self.lam = n umpy.asarray(lam)64 self.lam = np.asarray(lam) 65 65 if dlam is not None: 66 self.dlam = n umpy.asarray(dlam)66 self.dlam = np.asarray(dlam) 67 67 68 68 def xaxis(self, label, unit): … … 109 109 qy_data=None, q_data=None, mask=None, 110 110 dqx_data=None, dqy_data=None): 111 self.data = n umpy.asarray(data)112 self.qx_data = n umpy.asarray(qx_data)113 self.qy_data = n umpy.asarray(qy_data)114 self.q_data = n umpy.asarray(q_data)115 self.mask = n umpy.asarray(mask)116 self.err_data = n umpy.asarray(err_data)111 self.data = np.asarray(data) 112 self.qx_data = np.asarray(qx_data) 113 self.qy_data = np.asarray(qy_data) 114 self.q_data = np.asarray(q_data) 115 self.mask = np.asarray(mask) 116 self.err_data = np.asarray(err_data) 117 117 if dqx_data is not None: 118 self.dqx_data = n umpy.asarray(dqx_data)118 self.dqx_data = np.asarray(dqx_data) 119 119 if dqy_data is not None: 120 self.dqy_data = n umpy.asarray(dqy_data)120 self.dqy_data = np.asarray(dqy_data) 121 121 122 122 def xaxis(self, label, unit): … … 734 734 """ 735 735 def _check(v): 736 if (v.__class__ == list or v.__class__ == n umpy.ndarray) \736 if (v.__class__ == list or v.__class__ == np.ndarray) \ 737 737 and len(v) > 0 and min(v) > 0: 738 738 return True … … 752 752 753 753 if clone is None or not issubclass(clone.__class__, Data1D): 754 x = n umpy.zeros(length)755 dx = n umpy.zeros(length)756 y = n umpy.zeros(length)757 dy = n umpy.zeros(length)758 lam = n umpy.zeros(length)759 dlam = n umpy.zeros(length)754 x = np.zeros(length) 755 dx = np.zeros(length) 756 y = np.zeros(length) 757 dy = np.zeros(length) 758 lam = np.zeros(length) 759 dlam = np.zeros(length) 760 760 clone = Data1D(x, y, lam=lam, dx=dx, dy=dy, dlam=dlam) 761 761 … … 806 806 dy_other = other.dy 807 807 if other.dy == None or (len(other.dy) != len(other.y)): 808 dy_other = n umpy.zeros(len(other.y))808 dy_other = np.zeros(len(other.y)) 809 809 810 810 # Check that we have errors, otherwise create zero vector 811 811 dy = self.dy 812 812 if self.dy == None or (len(self.dy) != len(self.y)): 813 dy = n umpy.zeros(len(self.y))813 dy = np.zeros(len(self.y)) 814 814 815 815 return dy, dy_other … … 824 824 result.dxw = None 825 825 else: 826 result.dxw = n umpy.zeros(len(self.x))826 result.dxw = np.zeros(len(self.x)) 827 827 if self.dxl == None: 828 828 result.dxl = None 829 829 else: 830 result.dxl = n umpy.zeros(len(self.x))830 result.dxl = np.zeros(len(self.x)) 831 831 832 832 for i in range(len(self.x)): … … 886 886 result.dy = None 887 887 else: 888 result.dy = n umpy.zeros(len(self.x) + len(other.x))888 result.dy = np.zeros(len(self.x) + len(other.x)) 889 889 if self.dx == None or other.dx is None: 890 890 result.dx = None 891 891 else: 892 result.dx = n umpy.zeros(len(self.x) + len(other.x))892 result.dx = np.zeros(len(self.x) + len(other.x)) 893 893 if self.dxw == None or other.dxw is None: 894 894 result.dxw = None 895 895 else: 896 result.dxw = n umpy.zeros(len(self.x) + len(other.x))896 result.dxw = np.zeros(len(self.x) + len(other.x)) 897 897 if self.dxl == None or other.dxl is None: 898 898 result.dxl = None 899 899 else: 900 result.dxl = n umpy.zeros(len(self.x) + len(other.x))901 902 result.x = n umpy.append(self.x, other.x)900 result.dxl = np.zeros(len(self.x) + len(other.x)) 901 902 result.x = np.append(self.x, other.x) 903 903 #argsorting 904 ind = n umpy.argsort(result.x)904 ind = np.argsort(result.x) 905 905 result.x = result.x[ind] 906 result.y = n umpy.append(self.y, other.y)906 result.y = np.append(self.y, other.y) 907 907 result.y = result.y[ind] 908 908 if result.dy != None: 909 result.dy = n umpy.append(self.dy, other.dy)909 result.dy = np.append(self.dy, other.dy) 910 910 result.dy = result.dy[ind] 911 911 if result.dx is not None: 912 result.dx = n umpy.append(self.dx, other.dx)912 result.dx = np.append(self.dx, other.dx) 913 913 result.dx = result.dx[ind] 914 914 if result.dxw is not None: 915 result.dxw = n umpy.append(self.dxw, other.dxw)915 result.dxw = np.append(self.dxw, other.dxw) 916 916 result.dxw = result.dxw[ind] 917 917 if result.dxl is not None: 918 result.dxl = n umpy.append(self.dxl, other.dxl)918 result.dxl = np.append(self.dxl, other.dxl) 919 919 result.dxl = result.dxl[ind] 920 920 return result … … 970 970 971 971 if clone is None or not issubclass(clone.__class__, Data2D): 972 data = n umpy.zeros(length)973 err_data = n umpy.zeros(length)974 qx_data = n umpy.zeros(length)975 qy_data = n umpy.zeros(length)976 q_data = n umpy.zeros(length)977 mask = n umpy.zeros(length)972 data = np.zeros(length) 973 err_data = np.zeros(length) 974 qx_data = np.zeros(length) 975 qy_data = np.zeros(length) 976 q_data = np.zeros(length) 977 mask = np.zeros(length) 978 978 dqx_data = None 979 979 dqy_data = None … … 1031 1031 if other.err_data == None or \ 1032 1032 (len(other.err_data) != len(other.data)): 1033 err_other = n umpy.zeros(len(other.data))1033 err_other = np.zeros(len(other.data)) 1034 1034 1035 1035 # Check that we have errors, otherwise create zero vector … … 1037 1037 if self.err_data == None or \ 1038 1038 (len(self.err_data) != len(self.data)): 1039 err = n umpy.zeros(len(other.data))1039 err = np.zeros(len(other.data)) 1040 1040 return err, err_other 1041 1041 … … 1049 1049 # First, check the data compatibility 1050 1050 dy, dy_other = self._validity_check(other) 1051 result = self.clone_without_data(n umpy.size(self.data))1051 result = self.clone_without_data(np.size(self.data)) 1052 1052 if self.dqx_data == None or self.dqy_data == None: 1053 1053 result.dqx_data = None 1054 1054 result.dqy_data = None 1055 1055 else: 1056 result.dqx_data = n umpy.zeros(len(self.data))1057 result.dqy_data = n umpy.zeros(len(self.data))1058 for i in range(n umpy.size(self.data)):1056 result.dqx_data = np.zeros(len(self.data)) 1057 result.dqy_data = np.zeros(len(self.data)) 1058 for i in range(np.size(self.data)): 1059 1059 result.data[i] = self.data[i] 1060 1060 if self.err_data is not None and \ 1061 numpy.size(self.data) == numpy.size(self.err_data):1061 np.size(self.data) == np.size(self.err_data): 1062 1062 result.err_data[i] = self.err_data[i] 1063 1063 if self.dqx_data is not None: … … 1118 1118 # First, check the data compatibility 1119 1119 self._validity_check_union(other) 1120 result = self.clone_without_data(n umpy.size(self.data) + \1121 n umpy.size(other.data))1120 result = self.clone_without_data(np.size(self.data) + \ 1121 np.size(other.data)) 1122 1122 result.xmin = self.xmin 1123 1123 result.xmax = self.xmax … … 1129 1129 result.dqy_data = None 1130 1130 else: 1131 result.dqx_data = n umpy.zeros(len(self.data) + \1132 numpy.size(other.data))1133 result.dqy_data = n umpy.zeros(len(self.data) + \1134 numpy.size(other.data))1135 1136 result.data = n umpy.append(self.data, other.data)1137 result.qx_data = n umpy.append(self.qx_data, other.qx_data)1138 result.qy_data = n umpy.append(self.qy_data, other.qy_data)1139 result.q_data = n umpy.append(self.q_data, other.q_data)1140 result.mask = n umpy.append(self.mask, other.mask)1131 result.dqx_data = np.zeros(len(self.data) + \ 1132 np.size(other.data)) 1133 result.dqy_data = np.zeros(len(self.data) + \ 1134 np.size(other.data)) 1135 1136 result.data = np.append(self.data, other.data) 1137 result.qx_data = np.append(self.qx_data, other.qx_data) 1138 result.qy_data = np.append(self.qy_data, other.qy_data) 1139 result.q_data = np.append(self.q_data, other.q_data) 1140 result.mask = np.append(self.mask, other.mask) 1141 1141 if result.err_data is not None: 1142 result.err_data = n umpy.append(self.err_data, other.err_data)1142 result.err_data = np.append(self.err_data, other.err_data) 1143 1143 if self.dqx_data is not None: 1144 result.dqx_data = n umpy.append(self.dqx_data, other.dqx_data)1144 result.dqx_data = np.append(self.dqx_data, other.dqx_data) 1145 1145 if self.dqy_data is not None: 1146 result.dqy_data = n umpy.append(self.dqy_data, other.dqy_data)1146 result.dqy_data = np.append(self.dqy_data, other.dqy_data) 1147 1147 1148 1148 return result -
src/sas/sascalc/dataloader/manipulations.py
rb2b36932 red2276f 14 14 #TODO: copy the meta data from the 2D object to the resulting 1D object 15 15 import math 16 import numpy 16 import numpy as np 17 17 18 18 #from data_info import plottable_2D … … 80 80 81 81 """ 82 if data2d.data == None or data2d.x_bins == None or data2d.y_bins ==None:82 if data2d.data is None or data2d.x_bins is None or data2d.y_bins is None: 83 83 raise ValueError, "Can't convert this data: data=None..." 84 new_x = n umpy.tile(data2d.x_bins, (len(data2d.y_bins), 1))85 new_y = n umpy.tile(data2d.y_bins, (len(data2d.x_bins), 1))84 new_x = np.tile(data2d.x_bins, (len(data2d.y_bins), 1)) 85 new_y = np.tile(data2d.y_bins, (len(data2d.x_bins), 1)) 86 86 new_y = new_y.swapaxes(0, 1) 87 87 … … 89 89 qx_data = new_x.flatten() 90 90 qy_data = new_y.flatten() 91 q_data = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 92 if data2d.err_data == None or numpy.any(data2d.err_data <= 0): 93 new_err_data = numpy.sqrt(numpy.abs(new_data)) 91 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 92 if data2d.err_data == None or np.any(data2d.err_data <= 0): 93 new_err_data = np.sqrt(np.abs(new_data)) 94 94 95 else: 95 96 new_err_data = data2d.err_data.flatten() 96 mask = n umpy.ones(len(new_data), dtype=bool)97 mask = np.ones(len(new_data), dtype=bool) 97 98 98 99 #TODO: make sense of the following two lines... … … 149 150 150 151 # Get data 151 data = data2D.data[n umpy.isfinite(data2D.data)]152 err_data = data2D.err_data[n umpy.isfinite(data2D.data)]153 qx_data = data2D.qx_data[n umpy.isfinite(data2D.data)]154 qy_data = data2D.qy_data[n umpy.isfinite(data2D.data)]152 data = data2D.data[np.isfinite(data2D.data)] 153 err_data = data2D.err_data[np.isfinite(data2D.data)] 154 qx_data = data2D.qx_data[np.isfinite(data2D.data)] 155 qy_data = data2D.qy_data[np.isfinite(data2D.data)] 155 156 156 157 # Build array of Q intervals … … 170 171 raise RuntimeError, "_Slab._avg: unrecognized axis %s" % str(maj) 171 172 172 x = n umpy.zeros(nbins)173 y = n umpy.zeros(nbins)174 err_y = n umpy.zeros(nbins)175 y_counts = n umpy.zeros(nbins)173 x = np.zeros(nbins) 174 y = np.zeros(nbins) 175 err_y = np.zeros(nbins) 176 y_counts = np.zeros(nbins) 176 177 177 178 # Average pixelsize in q space … … 225 226 y = y / y_counts 226 227 x = x / y_counts 227 idx = (n umpy.isfinite(y) & numpy.isfinite(x))228 idx = (np.isfinite(y) & np.isfinite(x)) 228 229 229 230 if not idx.any(): … … 304 305 raise RuntimeError, msg 305 306 # Get data 306 data = data2D.data[n umpy.isfinite(data2D.data)]307 err_data = data2D.err_data[n umpy.isfinite(data2D.data)]308 qx_data = data2D.qx_data[n umpy.isfinite(data2D.data)]309 qy_data = data2D.qy_data[n umpy.isfinite(data2D.data)]307 data = data2D.data[np.isfinite(data2D.data)] 308 err_data = data2D.err_data[np.isfinite(data2D.data)] 309 qx_data = data2D.qx_data[np.isfinite(data2D.data)] 310 qy_data = data2D.qy_data[np.isfinite(data2D.data)] 310 311 311 312 y = 0.0 … … 414 415 """ 415 416 # Get data W/ finite values 416 data = data2D.data[n umpy.isfinite(data2D.data)]417 q_data = data2D.q_data[n umpy.isfinite(data2D.data)]418 err_data = data2D.err_data[n umpy.isfinite(data2D.data)]419 mask_data = data2D.mask[n umpy.isfinite(data2D.data)]417 data = data2D.data[np.isfinite(data2D.data)] 418 q_data = data2D.q_data[np.isfinite(data2D.data)] 419 err_data = data2D.err_data[np.isfinite(data2D.data)] 420 mask_data = data2D.mask[np.isfinite(data2D.data)] 420 421 421 422 dq_data = None … … 448 449 dq_overlap_y *= dq_overlap_y 449 450 450 dq_overlap = n umpy.sqrt((dq_overlap_x + dq_overlap_y) / 2.0)451 dq_overlap = np.sqrt((dq_overlap_x + dq_overlap_y) / 2.0) 451 452 # Final protection of dq 452 453 if dq_overlap < 0: 453 454 dq_overlap = y_min 454 dqx_data = data2D.dqx_data[n umpy.isfinite(data2D.data)]455 dqy_data = data2D.dqy_data[n umpy.isfinite(data2D.data)] - dq_overlap455 dqx_data = data2D.dqx_data[np.isfinite(data2D.data)] 456 dqy_data = data2D.dqy_data[np.isfinite(data2D.data)] - dq_overlap 456 457 # def; dqx_data = dq_r dqy_data = dq_phi 457 458 # Convert dq 2D to 1D here 458 459 dqx = dqx_data * dqx_data 459 460 dqy = dqy_data * dqy_data 460 dq_data = n umpy.add(dqx, dqy)461 dq_data = n umpy.sqrt(dq_data)462 463 #q_data_max = n umpy.max(q_data)461 dq_data = np.add(dqx, dqy) 462 dq_data = np.sqrt(dq_data) 463 464 #q_data_max = np.max(q_data) 464 465 if len(data2D.q_data) == None: 465 466 msg = "Circular averaging: invalid q_data: %g" % data2D.q_data … … 469 470 nbins = int(math.ceil((self.r_max - self.r_min) / self.bin_width)) 470 471 471 x = n umpy.zeros(nbins)472 y = n umpy.zeros(nbins)473 err_y = n umpy.zeros(nbins)474 err_x = n umpy.zeros(nbins)475 y_counts = n umpy.zeros(nbins)472 x = np.zeros(nbins) 473 y = np.zeros(nbins) 474 err_y = np.zeros(nbins) 475 err_x = np.zeros(nbins) 476 y_counts = np.zeros(nbins) 476 477 477 478 for npt in range(len(data)): … … 527 528 528 529 err_y = err_y / y_counts 529 err_y[err_y == 0] = n umpy.average(err_y)530 err_y[err_y == 0] = np.average(err_y) 530 531 y = y / y_counts 531 532 x = x / y_counts 532 idx = (n umpy.isfinite(y)) & (numpy.isfinite(x))533 idx = (np.isfinite(y)) & (np.isfinite(x)) 533 534 534 535 if err_x != None: … … 585 586 586 587 # Get data 587 data = data2D.data[n umpy.isfinite(data2D.data)]588 q_data = data2D.q_data[n umpy.isfinite(data2D.data)]589 err_data = data2D.err_data[n umpy.isfinite(data2D.data)]590 qx_data = data2D.qx_data[n umpy.isfinite(data2D.data)]591 qy_data = data2D.qy_data[n umpy.isfinite(data2D.data)]588 data = data2D.data[np.isfinite(data2D.data)] 589 q_data = data2D.q_data[np.isfinite(data2D.data)] 590 err_data = data2D.err_data[np.isfinite(data2D.data)] 591 qx_data = data2D.qx_data[np.isfinite(data2D.data)] 592 qy_data = data2D.qy_data[np.isfinite(data2D.data)] 592 593 593 594 # Set space for 1d outputs 594 phi_bins = n umpy.zeros(self.nbins_phi)595 phi_counts = n umpy.zeros(self.nbins_phi)596 phi_values = n umpy.zeros(self.nbins_phi)597 phi_err = n umpy.zeros(self.nbins_phi)595 phi_bins = np.zeros(self.nbins_phi) 596 phi_counts = np.zeros(self.nbins_phi) 597 phi_values = np.zeros(self.nbins_phi) 598 phi_err = np.zeros(self.nbins_phi) 598 599 599 600 # Shift to apply to calculated phi values in order … … 636 637 phi_values[i] = 2.0 * math.pi / self.nbins_phi * (1.0 * i) 637 638 638 idx = (n umpy.isfinite(phi_bins))639 idx = (np.isfinite(phi_bins)) 639 640 640 641 if not idx.any(): … … 769 770 770 771 # Get the all data & info 771 data = data2D.data[n umpy.isfinite(data2D.data)]772 q_data = data2D.q_data[n umpy.isfinite(data2D.data)]773 err_data = data2D.err_data[n umpy.isfinite(data2D.data)]774 qx_data = data2D.qx_data[n umpy.isfinite(data2D.data)]775 qy_data = data2D.qy_data[n umpy.isfinite(data2D.data)]772 data = data2D.data[np.isfinite(data2D.data)] 773 q_data = data2D.q_data[np.isfinite(data2D.data)] 774 err_data = data2D.err_data[np.isfinite(data2D.data)] 775 qx_data = data2D.qx_data[np.isfinite(data2D.data)] 776 qy_data = data2D.qy_data[np.isfinite(data2D.data)] 776 777 dq_data = None 777 778 … … 803 804 dq_overlap_y *= dq_overlap_y 804 805 805 dq_overlap = n umpy.sqrt((dq_overlap_x + dq_overlap_y) / 2.0)806 dq_overlap = np.sqrt((dq_overlap_x + dq_overlap_y) / 2.0) 806 807 if dq_overlap < 0: 807 808 dq_overlap = y_min 808 dqx_data = data2D.dqx_data[n umpy.isfinite(data2D.data)]809 dqy_data = data2D.dqy_data[n umpy.isfinite(data2D.data)] - dq_overlap809 dqx_data = data2D.dqx_data[np.isfinite(data2D.data)] 810 dqy_data = data2D.dqy_data[np.isfinite(data2D.data)] - dq_overlap 810 811 # def; dqx_data = dq_r dqy_data = dq_phi 811 812 # Convert dq 2D to 1D here 812 813 dqx = dqx_data * dqx_data 813 814 dqy = dqy_data * dqy_data 814 dq_data = n umpy.add(dqx, dqy)815 dq_data = n umpy.sqrt(dq_data)815 dq_data = np.add(dqx, dqy) 816 dq_data = np.sqrt(dq_data) 816 817 817 818 #set space for 1d outputs 818 x = n umpy.zeros(self.nbins)819 y = n umpy.zeros(self.nbins)820 y_err = n umpy.zeros(self.nbins)821 x_err = n umpy.zeros(self.nbins)822 y_counts = n umpy.zeros(self.nbins)819 x = np.zeros(self.nbins) 820 y = np.zeros(self.nbins) 821 y_err = np.zeros(self.nbins) 822 x_err = np.zeros(self.nbins) 823 y_counts = np.zeros(self.nbins) 823 824 824 825 # Get the min and max into the region: 0 <= phi < 2Pi … … 923 924 #x[i] = math.sqrt((r_inner * r_inner + r_outer * r_outer) / 2) 924 925 x[i] = x[i] / y_counts[i] 925 y_err[y_err == 0] = n umpy.average(y_err)926 idx = (n umpy.isfinite(y) & numpy.isfinite(y_err))926 y_err[y_err == 0] = np.average(y_err) 927 idx = (np.isfinite(y) & np.isfinite(y_err)) 927 928 if x_err != None: 928 929 d_x = x_err[idx] / y_counts[idx] … … 1012 1013 qx_data = data2D.qx_data 1013 1014 qy_data = data2D.qy_data 1014 q_data = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)1015 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 1015 1016 1016 1017 # check whether or not the data point is inside ROI … … 1113 1114 1114 1115 # get phi from data 1115 phi_data = n umpy.arctan2(qy_data, qx_data)1116 phi_data = np.arctan2(qy_data, qx_data) 1116 1117 1117 1118 # Get the min and max into the region: -pi <= phi < Pi -
src/sas/sascalc/dataloader/readers/IgorReader.py
rb699768 red2276f 13 13 ############################################################################# 14 14 import os 15 import numpy 15 16 import numpy as np 16 17 import math 17 18 #import logging 19 18 20 from sas.sascalc.dataloader.data_info import Data2D 19 21 from sas.sascalc.dataloader.data_info import Detector … … 40 42 """ Read file """ 41 43 if not os.path.isfile(filename): 42 raise ValueError, \ 43 "Specified file %s is not a regular file" % filename 44 45 # Read file 46 f = open(filename, 'r') 47 buf = f.read() 48 49 # Instantiate data object 44 raise ValueError("Specified file %s is not a regular " 45 "file" % filename) 46 50 47 output = Data2D() 48 51 49 output.filename = os.path.basename(filename) 52 50 detector = Detector() 53 if len(output.detector) > 0:54 print str(output.detector[0])51 if len(output.detector): 52 print(str(output.detector[0])) 55 53 output.detector.append(detector) 56 57 # Get content 58 dataStarted = False 59 60 lines = buf.split('\n') 61 itot = 0 62 x = [] 63 y = [] 64 65 ncounts = 0 66 67 xmin = None 68 xmax = None 69 ymin = None 70 ymax = None 71 72 i_x = 0 73 i_y = -1 74 i_tot_row = 0 75 76 isInfo = False 77 isCenter = False 78 79 data_conv_q = None 80 data_conv_i = None 81 82 if has_converter == True and output.Q_unit != '1/A': 54 55 data_conv_q = data_conv_i = None 56 57 if has_converter and output.Q_unit != '1/A': 83 58 data_conv_q = Converter('1/A') 84 59 # Test it 85 60 data_conv_q(1.0, output.Q_unit) 86 61 87 if has_converter == Trueand output.I_unit != '1/cm':62 if has_converter and output.I_unit != '1/cm': 88 63 data_conv_i = Converter('1/cm') 89 64 # Test it 90 65 data_conv_i(1.0, output.I_unit) 91 66 92 67 for line in lines: 93 68 … … 118 93 size_x = i_tot_row # 192#128 119 94 size_y = i_tot_row # 192#128 120 output.data = numpy.zeros([size_x, size_y]) 121 output.err_data = numpy.zeros([size_x, size_y]) 122 123 #Read Header and 2D data 124 for line in lines: 125 # Find setup info line 126 if isInfo: 127 isInfo = False 128 line_toks = line.split() 129 # Wavelength in Angstrom 130 try: 131 wavelength = float(line_toks[1]) 132 except: 133 msg = "IgorReader: can't read this file, missing wavelength" 134 raise ValueError, msg 135 # Distance in meters 136 try: 137 distance = float(line_toks[3]) 138 except: 139 msg = "IgorReader: can't read this file, missing distance" 140 raise ValueError, msg 141 142 # Distance in meters 143 try: 144 transmission = float(line_toks[4]) 145 except: 146 msg = "IgorReader: can't read this file, " 147 msg += "missing transmission" 148 raise ValueError, msg 149 150 if line.count("LAMBDA") > 0: 151 isInfo = True 152 153 # Find center info line 154 if isCenter: 155 isCenter = False 156 line_toks = line.split() 157 158 # Center in bin number: Must substrate 1 because 159 #the index starts from 1 160 center_x = float(line_toks[0]) - 1 161 center_y = float(line_toks[1]) - 1 162 163 if line.count("BCENT") > 0: 164 isCenter = True 165 166 # Find data start 167 if line.count("***")>0: 168 dataStarted = True 169 170 # Check that we have all the info 171 if wavelength == None \ 172 or distance == None \ 173 or center_x == None \ 174 or center_y == None: 175 msg = "IgorReader:Missing information in data file" 176 raise ValueError, msg 177 178 if dataStarted == True: 179 try: 180 value = float(line) 181 except: 182 # Found a non-float entry, skip it 183 continue 184 185 # Get bin number 186 if math.fmod(itot, i_tot_row) == 0: 187 i_x = 0 188 i_y += 1 189 else: 190 i_x += 1 191 192 output.data[i_y][i_x] = value 193 ncounts += 1 194 195 # Det 640 x 640 mm 196 # Q = 4pi/lambda sin(theta/2) 197 # Bin size is 0.5 cm 198 #REmoved +1 from theta = (i_x-center_x+1)*0.5 / distance 199 # / 100.0 and 200 #REmoved +1 from theta = (i_y-center_y+1)*0.5 / 201 # distance / 100.0 202 #ToDo: Need complete check if the following 203 # covert process is consistent with fitting.py. 204 theta = (i_x - center_x) * 0.5 / distance / 100.0 205 qx = 4.0 * math.pi / wavelength * math.sin(theta/2.0) 206 207 if has_converter == True and output.Q_unit != '1/A': 208 qx = data_conv_q(qx, units=output.Q_unit) 209 210 if xmin == None or qx < xmin: 211 xmin = qx 212 if xmax == None or qx > xmax: 213 xmax = qx 214 215 theta = (i_y - center_y) * 0.5 / distance / 100.0 216 qy = 4.0 * math.pi / wavelength * math.sin(theta / 2.0) 217 218 if has_converter == True and output.Q_unit != '1/A': 219 qy = data_conv_q(qy, units=output.Q_unit) 220 221 if ymin == None or qy < ymin: 222 ymin = qy 223 if ymax == None or qy > ymax: 224 ymax = qy 225 226 if not qx in x: 227 x.append(qx) 228 if not qy in y: 229 y.append(qy) 230 231 itot += 1 232 233 95 output.data = np.zeros([size_x, size_y]) 96 output.err_data = np.zeros([size_x, size_y]) 97 98 data_row = 0 99 wavelength = distance = center_x = center_y = None 100 dataStarted = isInfo = isCenter = False 101 102 with open(filename, 'r') as f: 103 for line in f: 104 data_row += 1 105 # Find setup info line 106 if isInfo: 107 isInfo = False 108 line_toks = line.split() 109 # Wavelength in Angstrom 110 try: 111 wavelength = float(line_toks[1]) 112 except ValueError: 113 msg = "IgorReader: can't read this file, missing wavelength" 114 raise ValueError(msg) 115 # Distance in meters 116 try: 117 distance = float(line_toks[3]) 118 except ValueError: 119 msg = "IgorReader: can't read this file, missing distance" 120 raise ValueError(msg) 121 122 # Distance in meters 123 try: 124 transmission = float(line_toks[4]) 125 except: 126 msg = "IgorReader: can't read this file, " 127 msg += "missing transmission" 128 raise ValueError(msg) 129 130 if line.count("LAMBDA"): 131 isInfo = True 132 133 # Find center info line 134 if isCenter: 135 isCenter = False 136 line_toks = line.split() 137 138 # Center in bin number: Must subtract 1 because 139 # the index starts from 1 140 center_x = float(line_toks[0]) - 1 141 center_y = float(line_toks[1]) - 1 142 143 if line.count("BCENT"): 144 isCenter = True 145 146 # Find data start 147 if line.count("***"): 148 # now have to continue to blank line 149 dataStarted = True 150 151 # Check that we have all the info 152 if (wavelength is None 153 or distance is None 154 or center_x is None 155 or center_y is None): 156 msg = "IgorReader:Missing information in data file" 157 raise ValueError(msg) 158 159 if dataStarted: 160 if len(line.rstrip()): 161 continue 162 else: 163 break 164 165 # The data is loaded in row major order (last index changing most 166 # rapidly). However, the original data is in column major order (first 167 # index changing most rapidly). The swap to column major order is done 168 # in reader2D_converter at the end of this method. 169 data = np.loadtxt(filename, skiprows=data_row) 170 size_x = size_y = int(np.rint(np.sqrt(data.size))) 171 output.data = np.reshape(data, (size_x, size_y)) 172 output.err_data = np.zeros_like(output.data) 173 174 # Det 640 x 640 mm 175 # Q = 4 * pi/lambda * sin(theta/2) 176 # Bin size is 0.5 cm 177 # Removed +1 from theta = (i_x - center_x + 1)*0.5 / distance 178 # / 100.0 and 179 # Removed +1 from theta = (i_y - center_y + 1)*0.5 / 180 # distance / 100.0 181 # ToDo: Need complete check if the following 182 # convert process is consistent with fitting.py. 183 184 # calculate qx, qy bin centers of each pixel in the image 185 theta = (np.arange(size_x) - center_x) * 0.5 / distance / 100. 186 qx = 4 * np.pi / wavelength * np.sin(theta/2) 187 188 theta = (np.arange(size_y) - center_y) * 0.5 / distance / 100. 189 qy = 4 * np.pi / wavelength * np.sin(theta/2) 190 191 if has_converter and output.Q_unit != '1/A': 192 qx = data_conv_q(qx, units=output.Q_unit) 193 qy = data_conv_q(qx, units=output.Q_unit) 194 195 xmax = np.max(qx) 196 xmin = np.min(qx) 197 ymax = np.max(qy) 198 ymin = np.min(qy) 199 200 # calculate edge offset in q. 234 201 theta = 0.25 / distance / 100.0 235 xstep = 4.0 * math.pi / wavelength * math.sin(theta / 2.0)202 xstep = 4.0 * np.pi / wavelength * np.sin(theta / 2.0) 236 203 237 204 theta = 0.25 / distance / 100.0 238 ystep = 4.0 * math.pi/ wavelength * math.sin(theta / 2.0)205 ystep = 4.0 * np.pi/ wavelength * np.sin(theta / 2.0) 239 206 240 207 # Store all data ###################################### 241 208 # Store wavelength 242 if has_converter == Trueand output.source.wavelength_unit != 'A':209 if has_converter and output.source.wavelength_unit != 'A': 243 210 conv = Converter('A') 244 211 wavelength = conv(wavelength, units=output.source.wavelength_unit) … … 246 213 247 214 # Store distance 248 if has_converter == Trueand detector.distance_unit != 'm':215 if has_converter and detector.distance_unit != 'm': 249 216 conv = Converter('m') 250 217 distance = conv(distance, units=detector.distance_unit) … … 254 221 output.sample.transmission = transmission 255 222 256 # Store pixel size 223 # Store pixel size (mm) 257 224 pixel = 5.0 258 if has_converter == Trueand detector.pixel_size_unit != 'mm':225 if has_converter and detector.pixel_size_unit != 'mm': 259 226 conv = Converter('mm') 260 227 pixel = conv(pixel, units=detector.pixel_size_unit) … … 267 234 268 235 # Store limits of the image (2D array) 269 xmin = xmin -xstep / 2.0270 xmax = xmax +xstep / 2.0271 ymin = ymin -ystep / 2.0272 ymax = ymax +ystep / 2.0273 if has_converter == Trueand output.Q_unit != '1/A':236 xmin -= xstep / 2.0 237 xmax += xstep / 2.0 238 ymin -= ystep / 2.0 239 ymax += ystep / 2.0 240 if has_converter and output.Q_unit != '1/A': 274 241 xmin = data_conv_q(xmin, units=output.Q_unit) 275 242 xmax = data_conv_q(xmax, units=output.Q_unit) … … 282 249 283 250 # Store x and y axis bin centers 284 output.x_bins = x285 output.y_bins = y251 output.x_bins = qx.tolist() 252 output.y_bins = qy.tolist() 286 253 287 254 # Units -
src/sas/sascalc/dataloader/readers/abs_reader.py
rb699768 r9a5097c 9 9 ###################################################################### 10 10 11 import numpy 11 import numpy as np 12 12 import os 13 13 from sas.sascalc.dataloader.data_info import Data1D … … 53 53 buff = input_f.read() 54 54 lines = buff.split('\n') 55 x = n umpy.zeros(0)56 y = n umpy.zeros(0)57 dy = n umpy.zeros(0)58 dx = n umpy.zeros(0)55 x = np.zeros(0) 56 y = np.zeros(0) 57 dy = np.zeros(0) 58 dx = np.zeros(0) 59 59 output = Data1D(x, y, dy=dy, dx=dx) 60 60 detector = Detector() … … 204 204 _dy = data_conv_i(_dy, units=output.y_unit) 205 205 206 x = n umpy.append(x, _x)207 y = n umpy.append(y, _y)208 dy = n umpy.append(dy, _dy)209 dx = n umpy.append(dx, _dx)206 x = np.append(x, _x) 207 y = np.append(y, _y) 208 dy = np.append(dy, _dy) 209 dx = np.append(dx, _dx) 210 210 211 211 except: -
src/sas/sascalc/dataloader/readers/ascii_reader.py
rd2471870 r9a5097c 14 14 15 15 16 import numpy 16 import numpy as np 17 17 import os 18 18 from sas.sascalc.dataloader.data_info import Data1D … … 69 69 70 70 # Arrays for data storage 71 tx = n umpy.zeros(0)72 ty = n umpy.zeros(0)73 tdy = n umpy.zeros(0)74 tdx = n umpy.zeros(0)71 tx = np.zeros(0) 72 ty = np.zeros(0) 73 tdy = np.zeros(0) 74 tdx = np.zeros(0) 75 75 76 76 # The first good line of data will define whether … … 140 140 is_data == False: 141 141 try: 142 tx = n umpy.zeros(0)143 ty = n umpy.zeros(0)144 tdy = n umpy.zeros(0)145 tdx = n umpy.zeros(0)142 tx = np.zeros(0) 143 ty = np.zeros(0) 144 tdy = np.zeros(0) 145 tdx = np.zeros(0) 146 146 except: 147 147 pass 148 148 149 149 if has_error_dy == True: 150 tdy = n umpy.append(tdy, _dy)150 tdy = np.append(tdy, _dy) 151 151 if has_error_dx == True: 152 tdx = n umpy.append(tdx, _dx)153 tx = n umpy.append(tx, _x)154 ty = n umpy.append(ty, _y)152 tdx = np.append(tdx, _dx) 153 tx = np.append(tx, _x) 154 ty = np.append(ty, _y) 155 155 156 156 #To remember the # of columns on the current line … … 188 188 #Let's re-order the data to make cal. 189 189 # curve look better some cases 190 ind = n umpy.lexsort((ty, tx))191 x = n umpy.zeros(len(tx))192 y = n umpy.zeros(len(ty))193 dy = n umpy.zeros(len(tdy))194 dx = n umpy.zeros(len(tdx))190 ind = np.lexsort((ty, tx)) 191 x = np.zeros(len(tx)) 192 y = np.zeros(len(ty)) 193 dy = np.zeros(len(tdy)) 194 dx = np.zeros(len(tdx)) 195 195 output = Data1D(x, y, dy=dy, dx=dx) 196 196 self.filename = output.filename = basename … … 212 212 output.y = y[x != 0] 213 213 output.dy = dy[x != 0] if has_error_dy == True\ 214 else n umpy.zeros(len(output.y))214 else np.zeros(len(output.y)) 215 215 output.dx = dx[x != 0] if has_error_dx == True\ 216 else n umpy.zeros(len(output.x))216 else np.zeros(len(output.x)) 217 217 218 218 output.xaxis("\\rm{Q}", 'A^{-1}') -
src/sas/sascalc/dataloader/readers/danse_reader.py
r463e7ffc r9c0f3c17 15 15 import os 16 16 import sys 17 import numpy 17 import numpy as np 18 18 import logging 19 19 from sas.sascalc.dataloader.data_info import Data2D, Detector … … 81 81 output.detector.append(detector) 82 82 83 output.data = n umpy.zeros([size_x,size_y])84 output.err_data = n umpy.zeros([size_x, size_y])83 output.data = np.zeros([size_x,size_y]) 84 output.err_data = np.zeros([size_x, size_y]) 85 85 86 86 data_conv_q = None -
src/sas/sascalc/dataloader/readers/hfir1d_reader.py
rb699768 r9a5097c 9 9 #copyright 2008, University of Tennessee 10 10 ###################################################################### 11 import numpy 11 import numpy as np 12 12 import os 13 13 from sas.sascalc.dataloader.data_info import Data1D … … 52 52 buff = input_f.read() 53 53 lines = buff.split('\n') 54 x = n umpy.zeros(0)55 y = n umpy.zeros(0)56 dx = n umpy.zeros(0)57 dy = n umpy.zeros(0)54 x = np.zeros(0) 55 y = np.zeros(0) 56 dx = np.zeros(0) 57 dy = np.zeros(0) 58 58 output = Data1D(x, y, dx=dx, dy=dy) 59 59 self.filename = output.filename = basename … … 88 88 _dy = data_conv_i(_dy, units=output.y_unit) 89 89 90 x = n umpy.append(x, _x)91 y = n umpy.append(y, _y)92 dx = n umpy.append(dx, _dx)93 dy = n umpy.append(dy, _dy)90 x = np.append(x, _x) 91 y = np.append(y, _y) 92 dx = np.append(dx, _dx) 93 dy = np.append(dy, _dy) 94 94 except: 95 95 # Couldn't parse this line, skip it -
src/sas/sascalc/dataloader/readers/red2d_reader.py
rb699768 r9a5097c 10 10 ###################################################################### 11 11 import os 12 import numpy 12 import numpy as np 13 13 import math 14 14 from sas.sascalc.dataloader.data_info import Data2D, Detector … … 198 198 break 199 199 # Make numpy array to remove header lines using index 200 lines_array = n umpy.array(lines)200 lines_array = np.array(lines) 201 201 202 202 # index for lines_array 203 lines_index = n umpy.arange(len(lines))203 lines_index = np.arange(len(lines)) 204 204 205 205 # get the data lines … … 225 225 226 226 # numpy array form 227 data_array = n umpy.array(data_list1)227 data_array = np.array(data_list1) 228 228 # Redimesion based on the row_num and col_num, 229 229 #otherwise raise an error. … … 235 235 ## Get the all data: Let's HARDcoding; Todo find better way 236 236 # Defaults 237 dqx_data = n umpy.zeros(0)238 dqy_data = n umpy.zeros(0)239 err_data = n umpy.ones(row_num)240 qz_data = n umpy.zeros(row_num)241 mask = n umpy.ones(row_num, dtype=bool)237 dqx_data = np.zeros(0) 238 dqy_data = np.zeros(0) 239 err_data = np.ones(row_num) 240 qz_data = np.zeros(row_num) 241 mask = np.ones(row_num, dtype=bool) 242 242 # Get from the array 243 243 qx_data = data_point[0] … … 254 254 dqy_data = data_point[(5 + ver)] 255 255 #if col_num > (6 + ver): mask[data_point[(6 + ver)] < 1] = False 256 q_data = n umpy.sqrt(qx_data*qx_data+qy_data*qy_data+qz_data*qz_data)256 q_data = np.sqrt(qx_data*qx_data+qy_data*qy_data+qz_data*qz_data) 257 257 258 258 # Extra protection(it is needed for some data files): … … 262 262 263 263 # Store limits of the image in q space 264 xmin = n umpy.min(qx_data)265 xmax = n umpy.max(qx_data)266 ymin = n umpy.min(qy_data)267 ymax = n umpy.max(qy_data)264 xmin = np.min(qx_data) 265 xmax = np.max(qx_data) 266 ymin = np.min(qy_data) 267 ymax = np.max(qy_data) 268 268 269 269 # units … … 287 287 288 288 # store x and y axis bin centers in q space 289 x_bins = n umpy.arange(xmin, xmax + xstep, xstep)290 y_bins = n umpy.arange(ymin, ymax + ystep, ystep)289 x_bins = np.arange(xmin, xmax + xstep, xstep) 290 y_bins = np.arange(ymin, ymax + ystep, ystep) 291 291 292 292 # get the limits of q values … … 300 300 output.data = data 301 301 if (err_data == 1).all(): 302 output.err_data = n umpy.sqrt(numpy.abs(data))302 output.err_data = np.sqrt(np.abs(data)) 303 303 output.err_data[output.err_data == 0.0] = 1.0 304 304 else: … … 335 335 # tranfer the comp. to cartesian coord. for newer version. 336 336 if ver != 1: 337 diag = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)337 diag = np.sqrt(qx_data * qx_data + qy_data * qy_data) 338 338 cos_th = qx_data / diag 339 339 sin_th = qy_data / diag 340 output.dqx_data = n umpy.sqrt((dqx_data * cos_th) * \340 output.dqx_data = np.sqrt((dqx_data * cos_th) * \ 341 341 (dqx_data * cos_th) \ 342 342 + (dqy_data * sin_th) * \ 343 343 (dqy_data * sin_th)) 344 output.dqy_data = n umpy.sqrt((dqx_data * sin_th) * \344 output.dqy_data = np.sqrt((dqx_data * sin_th) * \ 345 345 (dqx_data * sin_th) \ 346 346 + (dqy_data * cos_th) * \ -
src/sas/sascalc/dataloader/readers/sesans_reader.py
r7caf3e5 r9a5097c 6 6 Jurrian Bakker 7 7 """ 8 import numpy 8 import numpy as np 9 9 import os 10 10 from sas.sascalc.dataloader.data_info import Data1D … … 60 60 buff = input_f.read() 61 61 lines = buff.splitlines() 62 x = n umpy.zeros(0)63 y = n umpy.zeros(0)64 dy = n umpy.zeros(0)65 lam = n umpy.zeros(0)66 dlam = n umpy.zeros(0)67 dx = n umpy.zeros(0)62 x = np.zeros(0) 63 y = np.zeros(0) 64 dy = np.zeros(0) 65 lam = np.zeros(0) 66 dlam = np.zeros(0) 67 dx = np.zeros(0) 68 68 69 69 #temp. space to sort data 70 tx = n umpy.zeros(0)71 ty = n umpy.zeros(0)72 tdy = n umpy.zeros(0)73 tlam = n umpy.zeros(0)74 tdlam = n umpy.zeros(0)75 tdx = n umpy.zeros(0)70 tx = np.zeros(0) 71 ty = np.zeros(0) 72 tdy = np.zeros(0) 73 tlam = np.zeros(0) 74 tdlam = np.zeros(0) 75 tdx = np.zeros(0) 76 76 output = Data1D(x=x, y=y, lam=lam, dy=dy, dx=dx, dlam=dlam, isSesans=True) 77 77 self.filename = output.filename = basename … … 128 128 129 129 x,y,lam,dy,dx,dlam = [ 130 numpy.asarray(v, 'double')130 np.asarray(v, 'double') 131 131 for v in (x,y,lam,dy,dx,dlam) 132 132 ] -
src/sas/sascalc/dataloader/readers/tiff_reader.py
r463e7ffc r9c0f3c17 13 13 import logging 14 14 import os 15 import numpy 15 import numpy as np 16 16 from sas.sascalc.dataloader.data_info import Data2D 17 17 from sas.sascalc.dataloader.manipulations import reader2D_converter … … 58 58 59 59 # Initiazed the output data object 60 output.data = n umpy.zeros([im.size[0], im.size[1]])61 output.err_data = n umpy.zeros([im.size[0], im.size[1]])62 output.mask = n umpy.ones([im.size[0], im.size[1]], dtype=bool)60 output.data = np.zeros([im.size[0], im.size[1]]) 61 output.err_data = np.zeros([im.size[0], im.size[1]]) 62 output.mask = np.ones([im.size[0], im.size[1]], dtype=bool) 63 63 64 64 # Initialize … … 96 96 output.x_bins = x_vals 97 97 output.y_bins = y_vals 98 output.qx_data = n umpy.array(x_vals)99 output.qy_data = n umpy.array(y_vals)98 output.qx_data = np.array(x_vals) 99 output.qy_data = np.array(y_vals) 100 100 output.xmin = 0 101 101 output.xmax = im.size[0] - 1 -
src/sas/sascalc/dataloader/loader.py
rb699768 r463e7ffc 32 32 from readers import cansas_reader 33 33 34 logger = logging.getLogger(__name__) 35 34 36 class Registry(ExtensionRegistry): 35 37 """ … … 99 101 msg = "DataLoader couldn't locate DataLoader plugin folder." 100 102 msg += """ "%s" does not exist""" % dir 101 logg ing.warning(msg)103 logger.warning(msg) 102 104 return readers_found 103 105 … … 117 119 msg = "Loader: Error importing " 118 120 msg += "%s\n %s" % (item, sys.exc_value) 119 logg ing.error(msg)121 logger.error(msg) 120 122 121 123 # Process zip files … … 139 141 msg = "Loader: Error importing" 140 142 msg += " %s\n %s" % (mfile, sys.exc_value) 141 logg ing.error(msg)143 logger.error(msg) 142 144 143 145 except: 144 146 msg = "Loader: Error importing " 145 147 msg += " %s\n %s" % (item, sys.exc_value) 146 logg ing.error(msg)148 logger.error(msg) 147 149 148 150 return readers_found … … 190 192 msg = "Loader: Error accessing" 191 193 msg += " Reader in %s\n %s" % (module.__name__, sys.exc_value) 192 logg ing.error(msg)194 logger.error(msg) 193 195 return reader_found 194 196 … … 223 225 msg = "Loader: Error accessing Reader " 224 226 msg += "in %s\n %s" % (loader.__name__, sys.exc_value) 225 logg ing.error(msg)227 logger.error(msg) 226 228 return reader_found 227 229 … … 268 270 msg = "Loader: Error accessing Reader" 269 271 msg += " in %s\n %s" % (module.__name__, sys.exc_value) 270 logg ing.error(msg)272 logger.error(msg) 271 273 return reader_found 272 274 -
src/sas/sascalc/dataloader/readers/associations.py
re5c09cf r463e7ffc 18 18 import logging 19 19 import json 20 21 logger = logging.getLogger(__name__) 20 22 21 23 FILE_NAME = 'defaults.json' … … 67 69 msg = "read_associations: skipping association" 68 70 msg += " for %s\n %s" % (ext.lower(), sys.exc_value) 69 logg ing.error(msg)71 logger.error(msg) 70 72 else: 71 73 print "Could not find reader association settings\n %s [%s]" % (__file__, os.getcwd()) … … 81 83 :param registry_function: function to be called to register each reader 82 84 """ 83 logg ing.info("register_readers is now obsolete: use read_associations()")85 logger.info("register_readers is now obsolete: use read_associations()") 84 86 import abs_reader 85 87 import ascii_reader -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r8434365 r463e7ffc 33 33 import xml.dom.minidom 34 34 from xml.dom.minidom import parseString 35 36 logger = logging.getLogger(__name__) 35 37 36 38 PREPROCESS = "xmlpreprocess" … … 1471 1473 self.errors.add(err_mess) 1472 1474 if optional: 1473 logg ing.info(err_mess)1475 logger.info(err_mess) 1474 1476 else: 1475 1477 raise ValueError, err_mess … … 1480 1482 self.errors.add(err_mess) 1481 1483 if optional: 1482 logg ing.info(err_mess)1484 logger.info(err_mess) 1483 1485 else: 1484 1486 raise ValueError, err_mess -
src/sas/sascalc/dataloader/readers/xml_reader.py
ra235f715 r463e7ffc 18 18 from lxml import etree 19 19 from lxml.builder import E 20 21 logger = logging.getLogger(__name__) 20 22 21 23 PARSER = etree.ETCompatXMLParser(remove_comments=True, remove_pis=False) … … 71 73 self.xmlroot = self.xmldoc.getroot() 72 74 except etree.XMLSyntaxError as xml_error: 73 logg ing.info(xml_error)75 logger.info(xml_error) 74 76 except Exception: 75 77 self.xml = None … … 88 90 self.xmlroot = etree.fromstring(tag_soup) 89 91 except etree.XMLSyntaxError as xml_error: 90 logg ing.info(xml_error)92 logger.info(xml_error) 91 93 except Exception: 92 94 self.xml = None … … 102 104 self.schemadoc = etree.parse(self.schema, parser=PARSER) 103 105 except etree.XMLSyntaxError as xml_error: 104 logg ing.info(xml_error)106 logger.info(xml_error) 105 107 except Exception: 106 108 self.schema = None
Note: See TracChangeset
for help on using the changeset viewer.