import struct


def _parseMCCDHeader(header):
    """
    Parse experimental metadata from MCCD header. Byte-offsets of 
    experimental parameters are based on this `reference 
    <http://www.sb.fsu.edu/~xray/Manuals/marCCD165header.html>`_

    Parameters
    ----------
    header : bytes
        MCCD header
    """
    byte2int = struct.Struct("<I")
    metadata = {}
    metadata["dimensions"] = (byte2int.unpack(header[80:84])[0],
                              byte2int.unpack(header[84:88])[0])
    metadata["distance"] = float(byte2int.unpack(header[640:644])[0])/1e3
    metadata["center"] = (float(byte2int.unpack(header[644:648])[0])/1e3,
                          float(byte2int.unpack(header[648:652])[0])/1e3)
    metadata["pixelsize"] = (float(byte2int.unpack(header[772:776])[0])/1e3,
                             float(byte2int.unpack(header[776:780])[0])/1e3)
    metadata["wavelength"] = float(byte2int.unpack(header[908:912])[0])/1e5
    return metadata