) parser.add_argument( '--gzip', metavar='GZIP compression 0-9.', type=int, default=0, help='''Level of GZIP compression 1-9. Default=0 (no compression)''', ) parser.add_argument( '--checksum', action='store_true', help='''Set this flag to turn on Hdf5 checksums''', ) args = parser.parse_args() reader = digital_rf_deprecated_hdf5.read_hdf5(args.source) # convert each channel separately for channel in reader.get_channels(): print('working on channel %s' % (channel)) metaDict = reader.get_rf_file_metadata(channel) bounds = reader.get_bounds(channel) # this code only works if the sample rate is an integer sample_rate = metaDict['sample_rate'][0] if math.fmod(sample_rate, 1.0) != 0.0: errstr = ( 'Cannot guess the numerator and denominator with a fractional' ' sample rate %f') raise ValueError(errstr % sample_rate) sample_rate_numerator = long(sample_rate)
parser.add_argument( "--drf1", metavar="drf1Dir", help="Digital RF v 1 top level directory to be compared", required=True, ) args = parser.parse_args() try: reader2 = digital_rf.DigitalRFReader(args.drf2) except: traceback.print_exc() sys.exit(-1) try: reader1 = digital_rf_deprecated_hdf5.read_hdf5(args.drf1) except: traceback.print_exc() sys.exit(-1) # compare each channel separately for channel in reader2.get_channels(): print("comparing channel %s" % (channel)) bounds2 = reader2.get_bounds(channel) bounds1 = reader1.get_bounds(channel) cont_blocks_2 = reader2.get_continuous_blocks(bounds2[0], bounds2[1], channel) cont_blocks_1 = reader1.get_continuous_blocks(bounds1[0], bounds1[1], channel) for i, key in enumerate(cont_blocks_2.keys()):