Changeset c54c965 in sasview for src/sas


Ignore:
Timestamp:
Sep 14, 2017 10:43:20 AM (7 years ago)
Author:
krzywon
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
4660990
Parents:
b1f20d1
Message:

Modify base file reader class and cansas reader to properly load save states.

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

Legend:

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

    ra78a02f rc54c965  
    204204        x = np.zeros(no_lines) 
    205205        y = np.zeros(no_lines) 
    206         dy = np.zeros(no_lines) 
    207         dx = np.zeros(no_lines) 
    208         self.current_dataset = plottable_1D(x, y, dx, dy) 
     206        self.current_dataset = plottable_1D(x, y) 
    209207 
    210208    @staticmethod 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    rcd57c7d4 rc54c965  
    130130                self.current_datainfo.meta_data[PREPROCESS] = self.processing_instructions 
    131131                self._parse_entry(entry) 
    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 
     132                self.data_cleanup() 
    138133        except FileContentsException as fc_exc: 
    139134            # File doesn't meet schema - try loading with a less strict schema 
     
    507502            for error in self.errors: 
    508503                self.current_datainfo.errors.add(error) 
    509             self.errors.clear() 
    510             self.send_to_output() 
     504            self.data_cleanup() 
     505            self.sort_one_d_data() 
     506            self.sort_two_d_data() 
     507            self.reset_data_list() 
    511508            empty = None 
    512509            return self.output[0], empty 
     510 
     511    def data_cleanup(self): 
     512        """ 
     513        Clean up the data sets and refresh everything 
     514        :return: None 
     515        """ 
     516        has_error_dx = self.current_dataset.dx is not None 
     517        has_error_dy = self.current_dataset.dy is not None 
     518        self.remove_empty_q_values(has_error_dx=has_error_dx, 
     519                                   has_error_dy=has_error_dy) 
     520        self.send_to_output()  # Combine datasets with DataInfo 
     521        self.current_datainfo = DataInfo()  # Reset DataInfo 
    513522 
    514523    def _is_call_local(self): 
Note: See TracChangeset for help on using the changeset viewer.