Changeset 3d950a9 in sasview for src/sas/sascalc/dataloader


Ignore:
Timestamp:
Oct 28, 2017 5:07:52 AM (7 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
ab5ff35, 3ca67dcf
Parents:
5582b078 (diff), 1576693 (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.
git-author:
Paul Butler <butlerpd@…> (10/28/17 05:07:52)
git-committer:
GitHub <noreply@…> (10/28/17 05:07:52)
Message:

Merge pull request #111 from SasView?/ticket-1013

Ticket 1013 - Reset FileReader? class state on every data load
Closes #1013

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

Legend:

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

    r9e6aeaf r1576693  
    8585 
    8686        # Return a list of parsed entries that data_loader can manage 
    87         return self.output 
     87        final_data = self.output 
     88        self.reset_state() 
     89        return final_data 
     90 
     91    def reset_state(self): 
     92        """ 
     93        Resets the class state to a base case when loading a new data file so previous 
     94        data files do not appear a second time 
     95        """ 
     96        self.current_datainfo = None 
     97        self.current_dataset = None 
     98        self.output = [] 
    8899 
    89100    def nextline(self): 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r2b538cd r61f329f0  
    6868        data files do not appear a second time 
    6969        """ 
    70         self.current_datainfo = None 
    71         self.current_dataset = None 
    72         self.current_data1d = None 
     70        super(Reader, self).reset_state() 
    7371        self.data = [] 
    7472        self.process = Process() 
     
    7977        self.names = [] 
    8078        self.cansas_defaults = {} 
    81         self.output = [] 
    8279        self.ns_list = None 
    8380        self.logging = [] 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r2b538cd r61f329f0  
    6565        """ 
    6666        # Reinitialize when loading a new data file to reset all class variables 
    67         self.reset_class_variables() 
     67        self.reset_state() 
    6868 
    6969        filename = self.f_open.name 
     
    101101                            raise FileContentsException("Fewer than 5 data points found.") 
    102102 
    103     def reset_class_variables(self): 
     103    def reset_state(self): 
    104104        """ 
    105105        Create the reader object and define initial states for class variables 
    106106        """ 
    107         self.current_datainfo = None 
    108         self.current_dataset = None 
     107        super(Reader, self).reset_state() 
    109108        self.data1d = [] 
    110109        self.data2d = [] 
     
    112111        self.errors = set() 
    113112        self.logging = [] 
    114         self.output = [] 
    115113        self.parent_class = u'' 
    116114        self.detector = Detector() 
Note: See TracChangeset for help on using the changeset viewer.