示例#1
0
    def __process_file__(self, _file, disp=False):
        if disp:
            if self.shuffle_data:
                print('Processing shuffled file: ' + str(_file) + '\n')
            else:
                print('Processing file: ' + str(_file) + '\n')
        file_data_source = DataVectorFileDataSource(_file=_file,
                               signal_index=self.signal_index,
                               annotation_index=self.annotation_index,
                               time_index=self.time_index,
                               headers_count=self.headers_count,
                               time_format=self.time_format,
                               separator=self.separator)
        data_vector = file_data_source.getDataVector()
        if data_vector.is_empty:
            if disp:
                print('No signal data or all data is skipped, check signal or time data columns !') # @IgnorePep8
            return True

        (ok, message) = self.__pp_generator__.precheck(reference_filename=_file) # @IgnorePep8
        if ok == False:
            if disp:
                print('\n' + message)
            return True

        start_progress = CSVStartProgressGenerator()
        start_progress.progress_mark = self.progress_mark
        start_progress.info_handler = self.info_handler
        start_progress.shuffle_data = self.shuffle_data
        return self.__pp_generator__.generate_CSV(data_vector, _file,
                            start_progress=start_progress,
                            progress_handler=CSVProgressHandlerGenerator())
示例#2
0
def get_data_accessor_from_file_specification(parent, file_specification):
    """
    function which creates data accessor object from file specification object
    """
    file_data_source_params = file_specification._asdict()
    file_data_source = DataVectorFileDataSource(**file_data_source_params)
    data = file_data_source.getDataVector()
    data_accessor = DataVectorAccessor(data)
    data_accessor.source_name = file_data_source.source_filename
    data_accessor.path_name = file_data_source.source_pathname
    data_accessor.changeXSignalUnit(parent, OrderUnit)
    return data_accessor
示例#3
0
    def __process_file_for_movie__(self, _file, disp=False):
        file_data_source = DataVectorFileDataSource(_file=_file,
                               signal_index=self.signal_index,
                               annotation_index=self.annotation_index,
                               time_index=self.time_index,
                               headers_count=self.headers_count,
                               time_format=self.time_format,
                               separator=self.separator)
        data_vector = file_data_source.getDataVector()
        if data_vector.is_empty:
            return True

        start_progress = MovieStartProgressGenerator()
        start_progress.progress_mark = self.progress_mark
        start_progress.info_handler = self.info_handler
        return self.__pp_generator__.generate_movie(data_vector, _file,
                                                start_progress=start_progress)
示例#4
0
    def __process_file_for_movie__(self, _file, disp=False):
        file_data_source = DataVectorFileDataSource(
            _file=_file,
            signal_index=self.signal_index,
            annotation_index=self.annotation_index,
            time_index=self.time_index,
            headers_count=self.headers_count,
            time_format=self.time_format,
            separator=self.separator)
        data_vector = file_data_source.getDataVector()
        if data_vector.is_empty:
            return True

        start_progress = MovieStartProgressGenerator()
        start_progress.progress_mark = self.progress_mark
        start_progress.info_handler = self.info_handler
        return self.__pp_generator__.generate_movie(
            data_vector, _file, start_progress=start_progress)
示例#5
0
    def __process_file__(self, _file, disp=False):
        if disp:
            if self.shuffle_data:
                print('Processing shuffled file: ' + str(_file) + '\n')
            else:
                print('Processing file: ' + str(_file) + '\n')
        file_data_source = DataVectorFileDataSource(
            _file=_file,
            signal_index=self.signal_index,
            annotation_index=self.annotation_index,
            time_index=self.time_index,
            headers_count=self.headers_count,
            time_format=self.time_format,
            separator=self.separator)
        data_vector = file_data_source.getDataVector()
        if data_vector.is_empty:
            if disp:
                print(
                    'No signal data or all data is skipped, check signal or time data columns !'
                )  # @IgnorePep8
            return True

        (ok, message) = self.__pp_generator__.precheck(
            reference_filename=_file)  # @IgnorePep8
        if ok == False:
            if disp:
                print('\n' + message)
            return True

        start_progress = CSVStartProgressGenerator()
        start_progress.progress_mark = self.progress_mark
        start_progress.info_handler = self.info_handler
        start_progress.shuffle_data = self.shuffle_data
        return self.__pp_generator__.generate_CSV(
            data_vector,
            _file,
            start_progress=start_progress,
            progress_handler=CSVProgressHandlerGenerator())
示例#6
0
 def __process_headers__(self, _file, _headers=None):
     file_data_source = DataVectorFileDataSource(_file=_file)
     _headers.append('File: ' + str(_file))
     _headers.append(file_data_source.headers_with_col_index)
示例#7
0
 def __process_annotations__(self, _file, _unique_annotations=None):
     file_data_source = DataVectorFileDataSource(
         _file=_file, annotation_index=self.annotation_index)
     _unique_annotations[len(_unique_annotations):] = \
                 file_data_source.getUniqueAnnotations()
示例#8
0
 def __process_annotations__(self, _file, _unique_annotations=None):
     file_data_source = DataVectorFileDataSource(_file=_file,
                             annotation_index=self.annotation_index)
     _unique_annotations[len(_unique_annotations):] = \
                 file_data_source.getUniqueAnnotations()