#! /usr/bin/env python3
###############################################################################
# (c) Roger Whittaker 2015-2023
# roger@disruptive.org.uk
# Free software licenced under the GPL
###############################################################################


def good(f):
    out = True
    sections = ["iterations", "scale", "params"]
    filled = 0
    for item in sections:
        if item in f:
            filled = filled + 1
    if filled == 0:
        out = True
        return out
    if filled in [1, 2]:
        out = False
        return out
    if filled == 3:
        try:
            x = int(f["iterations"].value.strip())
        except ValueError:
            out = False
        try:
            x = float(f["scale"].value.strip())
        except ValueError:
            out = False
        try:
            for i in f["params"].value.split():
                y = float(i.strip())
        except ValueError:
            out = False
        if len(f["params"].value.split()) < 3:
            out = False
        return out
