Changeset 248ff73 in sasview for src/sas/sascalc/dataloader


Ignore:
Timestamp:
Aug 1, 2017 11:36:38 AM (7 years ago)
Author:
lewis
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:
5a8cdbb
Parents:
b2c28a5
Message:

Ensure unit tests pass

utest_averaging still fails as it relies on loading in an Igor 2D file,
which is no longer possible

Location:
src/sas/sascalc/dataloader
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    ra78433dd r248ff73  
    6666                    if not self.f_open.closed: 
    6767                        self.f_open.close() 
     68                    if len(self.output) > 0: 
     69                        # Sort the data that's been loaded 
     70                        self.sort_one_d_data() 
     71                        self.sort_two_d_data() 
    6872        else: 
    6973            msg = "Unable to find file at: {}\n".format(filepath) 
    7074            msg += "Please check your file path and try again." 
    7175            self.handle_error_message(msg) 
    72  
    73         if isinstance(self.output[0], Data1D): 
    74             self.sort_one_d_data() 
    75         elif isinstance(self.output[0], Data2D): 
    76             self.sort_two_d_data() 
    7776 
    7877        # Return a list of parsed entries that data_loader can manage 
     
    122121                if data.dlam is not None: 
    123122                    data.dlam = np.asarray([data.dlam[i] for i in ind]).astype(np.float64) 
    124                 data.xmin = np.min(data.x) 
    125                 data.xmax = np.max(data.x) 
    126                 data.ymin = np.min(data.y) 
    127                 data.ymax = np.max(data.y) 
    128             final_list.append(data) 
    129         self.output = final_list 
    130         self.remove_empty_q_values() 
     123                if len(data.x > 0): 
     124                    data.xmin = np.min(data.x) 
     125                    data.xmax = np.max(data.x) 
     126                    data.ymin = np.min(data.y) 
     127                    data.ymax = np.max(data.y) 
     128        #     final_list.append(data) 
     129        # self.output = final_list 
    131130 
    132131    def sort_two_d_data(self): 
     
    157156                    dataset.x_bins = dataset.qx_data[:int(n_cols)] 
    158157                dataset.data = dataset.data.flatten() 
    159                 final_list.append(dataset) 
    160         self.output = final_list 
     158        #         final_list.append(dataset) 
     159        # self.output = final_list 
    161160 
    162161    def set_all_to_none(self): 
  • src/sas/sascalc/dataloader/readers/associations.py

    r371b9e2 r248ff73  
    3737    Read the specified settings file to associate 
    3838    default readers to file extension. 
    39      
     39 
    4040    :param loader: Loader object 
    4141    :param settings: path to the json settings file [string] 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r0615d54 r248ff73  
    130130                self.current_datainfo.meta_data[PREPROCESS] = self.processing_instructions 
    131131                self._parse_entry(entry) 
    132                 self.send_to_output() # Combune datasets with DataInfo 
     132                has_error_dx = self.current_dataset.dx is not None 
     133                has_error_dy = self.current_dataset.dy is not None 
     134                self.remove_empty_q_values(has_error_dx=has_error_dx, 
     135                    has_error_dy=has_error_dy) 
     136                self.send_to_output() # Combine datasets with DataInfo 
     137                self.current_datainfo = DataInfo() # Reset DataInfo 
    133138        except FileContentsException as fc_exc: 
    134139            # File doesn't meet schema - try loading with a less strict schema 
     
    215220            self.current_dataset = plottable_1D(np.empty(0), np.empty(0), 
    216221                np.empty(0), np.empty(0)) 
    217             self.current_dataset.dxl = np.empty(0) 
    218             self.current_dataset.dxw = np.empty(0) 
    219222        self.base_ns = "{" + CANSAS_NS.get(self.cansas_version).get("ns") + "}" 
    220223 
     
    295298                    self.current_dataset.dx = np.append(self.current_dataset.dx, data_point) 
    296299                elif tagname == 'dQw': 
     300                    if self.current_dataset.dqw is None: self.current_dataset.dqw = np.empty(0) 
    297301                    self.current_dataset.dxw = np.append(self.current_dataset.dxw, data_point) 
    298302                elif tagname == 'dQl': 
     303                    if self.current_dataset.dxl is None: self.current_dataset.dxl = np.empty(0) 
    299304                    self.current_dataset.dxl = np.append(self.current_dataset.dxl, data_point) 
    300305                elif tagname == 'Qmean': 
Note: See TracChangeset for help on using the changeset viewer.