def get_dtype(i):
    """
    Identify bit depth for a matrix of maximum intensity i.
    """
    depths = [8, 16]
    for depth in depths:
        if i <= 2 ** depth - 1:
            return "uint%d" % (depth,)
    return "uint"