def open_record_file(self, record_file_name): self.close_file() f = record_folder.open_record_file(record_file_name) self.codec = record_codec.StreamDecoder(f) # create a new renderer mipmaps = compound_samples.MipMapList() mipmaps.add_level(compound_samples.CompoundSampleFromStream( self.codec)) self.plot = visualization.PlotView(mipmaps, self.codec.header) # display the filename in the GUI self.open_file_display.value = f.name # render result self.redraw_canvas() # print some values about this file for curious people print("full_integer_range: {:04X}".format( self.codec.header.full_integer_range)) print("units_per_measuring_range: {}".format( self.codec.header.units_per_measuring_range)) print("samples_per_second: {}".format( self.codec.header.samples_per_second))
def download_all_records(self, size_callback=lambda size: 0, progress_callback=lambda progress: 0): c = self.connection c.send(b'\x01') # protocol new_files = [] while c.receive(1) == b'\x01': filename = c_string(c.receive_struct(NAME_FORMAT)) print("downloading file: {}".format( filename )) new_files.append(filename) f = record_folder.open_record_file( filename, for_writing=True ) progress = 0 def next_chunk(chunk): nonlocal progress f.write(chunk) progress += len(chunk) progress_callback(progress) def next_size(size): size_callback(size) c.receive_variable_buffer( next_chunk, next_size ) f.close() return new_files
def download_all_records(self, size_callback=lambda size: 0, progress_callback=lambda progress: 0): c = self.connection c.send(b'\x01') # protocol new_files = [] while c.receive(1) == b'\x01': filename = c_string(c.receive_struct(NAME_FORMAT)) print("downloading file: {}".format(filename)) new_files.append(filename) f = record_folder.open_record_file(filename, for_writing=True) progress = 0 def next_chunk(chunk): nonlocal progress f.write(chunk) progress += len(chunk) progress_callback(progress) def next_size(size): size_callback(size) c.receive_variable_buffer(next_chunk, next_size) f.close() return new_files
def open_record_file(self, record_file_name): self.close_file() f = record_folder.open_record_file(record_file_name) self.codec = record_codec.StreamDecoder(f) # create a new renderer mipmaps = compound_samples.MipMapList() mipmaps.add_level(compound_samples.CompoundSampleFromStream(self.codec)) self.plot = visualization.PlotView(mipmaps, self.codec.header) # display the filename in the GUI self.open_file_display.value = f.name # render result self.redraw_canvas() # print some values about this file for curious people print("full_integer_range: {:04X}".format(self.codec.header.full_integer_range)) print("units_per_measuring_range: {}".format(self.codec.header.units_per_measuring_range)) print("samples_per_second: {}".format(self.codec.header.samples_per_second))