def check_contrast(logfile):
    """Check the logfile of the job for the contrast value

    Parameters
    ----------
    logfile : str
        Path to the logfile

    Returns
    -------
    float
        Contrast score in log file
    """

    contrasts = []
    with open(logfile, "r") as f:
        for line in f:
            if "Contrast" in line:
                fields = line.split()
                if len(fields) > 3:
                    pass
                else:
                    contrasts.append(float(fields[-1]))

    if len(contrasts) < 1:
        return 0.0
    else:
        return max(contrasts)