def get_waveform_info():
    dpo.write('acquire:stopafter sequence')
    dpo.write('acquire:state on')
    dpo.query('*OPC?')
    binaryFormat = dpo.query('wfmoutpre:bn_fmt?').rstrip()
    print('Binary format: ', binaryFormat)
    numBytes = dpo.query('wfmoutpre:byt_nr?').rstrip()
    print('Number of Bytes: ', numBytes)
    byteOrder = dpo.query('wfmoutpre:byt_or?').rstrip()
    print('Byte order: ', byteOrder)
    encoding = dpo.query('data:encdg?').rstrip()
    print('Encoding: ', encoding)
    if 'RIB' in encoding or 'FAS' in encoding:
        dType = 'b'
        bigEndian = True
    elif encoding.startswith('RPB'):
        dType = 'B'
        bigEndian = True
    elif encoding.startswith('SRI'):
        dType = 'b'
        bigEndian = False
    elif encoding.startswith('SRP'):
        dType = 'B'
        bigEndian = False
    elif encoding.startswith('FP'):
        dType = 'f'
        bigEndian = True
    elif encoding.startswith('SFP'):
        dType = 'f'
        bigEndian = False
    elif encoding.startswith('ASCI'):
        raise visa.InvalidBinaryFormat('ASCII Formatting.')
    else:
        raise visa.InvalidBinaryFormat
    return dType, bigEndian
    def get_waveform_info(self):
        """Gather waveform transfer information from scope."""
        self.inst.write('acquire:stopafter sequence')
        self.inst.write('acquire:state on')
        self.inst.query('*OPC?')

        # dType is a single format character from Python's struct module
        # https://docs.python.org/2/library/struct.html#format-characters
        encoding = self.inst.query('data:encdg?').rstrip()
        if 'RIB' in encoding or 'FAS' in encoding:
            self.dType = 'b'
            self.bigEndian = True
        elif 'RPB' in encoding:
            self.dType = 'B'
            self.bigEndian = True
        elif 'SRI' in encoding:
            self.dtype = 'b'
            self.bigEndian = False
        elif 'SRP' in encoding:
            self.dtype = 'B'
            self.bigEndian = False
        elif 'FP' in encoding:
            self.dType = 'f'
            self.bigEndian = True
        elif 'SFP' in encoding:
            self.dType = 'f'
            self.bigEndian = False
        elif 'ASCI' in encoding:
            raise visa.InvalidBinaryFormat('ASCII Formatting.')
        else:
            raise visa.InvalidBinaryFormat

        self.numPoints = int(self.inst.query('wfmoutpre:nr_pt?'))
        self.xIncr = float(self.inst.query('wfmoutpre:xincr?'))
        self.yMult = float(self.inst.query('wfmoutpre:ymult?'))
        self.yOff = float(self.inst.query('wfmoutpre:yoff?'))