def unpack_binary(data_pointer, definitions, data):
if data_pointer.data_dimension:<EOL><INDENT>data_dimension = data_pointer.data_dimension<EOL><DEDENT>else:<EOL><INDENT>data_dimension = <NUM_LIT:1> <EOL><DEDENT>if data_pointer.data_type == "<STR_LIT:float>":<EOL><INDENT>data_type = "<STR_LIT:f>" * data_dimension<EOL><DEDENT>elif data_pointer.data_type == "<STR_LIT:int>":<EOL><INDENT>data_type = "<STR_LIT:i>" * data_dimension <EOL><DEDENT>elif data_pointer.data_type == "<STR_LIT>":<EOL><INDENT>data_type = "<STR_LIT:b>" * data_dimension <EOL><DEDENT>try: <EOL><INDENT>data_length = int(getattr(definitions, data_pointer.data_name))<EOL><DEDENT>except AttributeError:<EOL><INDENT>"""<STR_LIT>"""<EOL>try:<EOL><INDENT>data_length = int(getattr(definitions, '<STR_LIT>'))<EOL><DEDENT>except AttributeError:<EOL><INDENT>x, y, z = definitions.Lattice<EOL>data_length = x * y * z<EOL><DEDENT><DEDENT>output = numpy.array(struct.unpack('<STR_LIT:<>' + '<STR_LIT:{}>'.format(data_type) * data_length, data)) <EOL>output = output.reshape(data_length, data_dimension)<EOL>return output<EOL>
Unpack binary data using ``struct.unpack``

    :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream
    :type data_pointer: ``ahds.header.Block``
    :param definitions: definitions specified in the header
    :type definitions: ``ahds.header.Block``
    :param bytes data: raw binary data to be unpacked
    :return tuple output: unpacked data