def load_file(self, file_handle, data_set=0, read_data=True):
        """Load the requested parts of the file into memory."""
        file_handle.seek(0, 2)
        self._file_size = file_handle.tell()
        file_handle.seek(0)
        data_segments = 0
        # seek the correct data set in fcs
        nextdata_offset = 0
        while data_segments <= data_set:
            self.read_header(file_handle, nextdata_offset)
            self.read_text(file_handle)
            if '$NEXTDATA' in self.annotation:
                data_segments += 1
                nextdata_offset = self.annotation['$NEXTDATA']
                file_handle.seek(nextdata_offset)
                if nextdata_offset == 0 and data_segments < data_set:
                    warnings.warn("File does not contain the number of data sets.")
                    break
            else:
                if data_segments != 0:
                    warnings.warn('File does not contain $NEXTDATA information.')
                break
        if read_data:
            self.read_data(file_handle)
def load_file ( self , file_handle , data_set = 0 , read_data = True ) : file_handle . seek ( 0 , 2 ) self . _file_size = file_handle . tell ( ) file_handle . seek ( 0 ) data_segments = 0 nextdata_offset = 0 while data_segments <= data_set : self . read_header ( file_handle , nextdata_offset ) self . read_text ( file_handle ) if '$NEXTDATA' in self . annotation : data_segments += 1 nextdata_offset = self . annotation [ '$NEXTDATA' ] file_handle . seek ( nextdata_offset ) if nextdata_offset == 0 and data_segments < data_set : warnings . warn ( "File does not contain the number of data sets." ) break else : if data_segments != 0 : warnings . warn ( 'File does not contain $NEXTDATA information.' ) break if read_data : self . read_data ( file_handle )
Load the requested parts of the file into memory.