Changeset ad92c5a in sasview for src/sas/sascalc/dataloader/file_reader_base_class.py
- Timestamp:
- Apr 18, 2017 2:56:03 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:
- 080d88e
- Parents:
- da8bb53
- git-author:
- Jeff Krzywon <krzywon@…> (04/18/17 14:56:03)
- git-committer:
- krzywon <krzywon@…> (04/18/17 14:56:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
rda8bb53 rad92c5a 52 52 # Try to load the file, but raise an error if unable to. 53 53 try: 54 self.load_unit_converter()55 54 self.f_open = open(filepath, 'rb') 56 55 self.get_file_contents() … … 94 93 self.output.append(data_obj) 95 94 96 def load_unit_converter(self):97 """98 Generic unit conversion import99 """100 # Check whether we have a converter available101 self.has_converter = True102 try:103 from sas.sascalc.data_util.nxsunit import Converter104 except:105 self.has_converter = False106 107 95 def sort_one_d_data(self): 108 96 """ … … 138 126 self.output = [] 139 127 128 def remove_empty_q_values(self, has_error_dx=False, has_error_dy=False): 129 """ 130 Remove any point where Q == 0 131 """ 132 x = self.current_dataset.x 133 self.current_dataset.x = self.current_dataset.x[x != 0] 134 self.current_dataset.y = self.current_dataset.y[x != 0] 135 self.current_dataset.dy = self.current_dataset.dy[x != 0] if \ 136 has_error_dy else np.zeros(len(self.current_dataset.y)) 137 self.current_dataset.dx = self.current_dataset.dx[x != 0] if \ 138 has_error_dx else np.zeros(len(self.current_dataset.x)) 139 140 def reset_data_list(self, no_lines=0): 141 """ 142 Reset the plottable_1D object 143 """ 144 # Initialize data sets with arrays the maximum possible size 145 x = np.zeros(no_lines) 146 y = np.zeros(no_lines) 147 dy = np.zeros(no_lines) 148 dx = np.zeros(no_lines) 149 self.current_dataset = plottable_1D(x, y, dx, dy) 150 140 151 @staticmethod 141 152 def splitline(line): … … 158 169 def get_file_contents(self): 159 170 """ 171 Reader specific class to access the contents of the file 160 172 All reader classes that inherit from FileReader must implement 161 173 """
Note: See TracChangeset
for help on using the changeset viewer.