docs/support/ptypes.py
def touchstone_noise_data(obj):
    r"""
    Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.

    :param obj: Object
    :type  obj: any

    :raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
     token \*[argument_name]\* is replaced by the name of the argument the
     contract is attached to

    :rtype: None
    """
    if isinstance(obj, dict) and (not obj):
        return None
    if (not isinstance(obj, dict)) or (
        isinstance(obj, dict)
        and (sorted(obj.keys()) != sorted(["points", "freq", "nf", "rc", "res"]))
    ):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if not (isinstance(obj["points"], int) and (obj["points"] > 0)):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_increasing_real_numpy_vector(obj["freq"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_real_numpy_vector(obj["nf"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_number_numpy_vector(obj["rc"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if not (
        isinstance(obj["res"], np.ndarray)
        and (len(obj["res"].shape) == 1)
        and (obj["res"].shape[0] > 0)
        and np.all(obj["res"] >= 0)
    ):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    sizes = [obj["freq"].size, obj["nf"].size, obj["rc"].size, obj["res"].size]
    if set(sizes) != set([obj["points"]]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    return None
def touchstone_noise_data(obj):
    r"""
    Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.

    :param obj: Object
    :type  obj: any

    :raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
     token \*[argument_name]\* is replaced by the name of the argument the
     contract is attached to

    :rtype: None
    """
    if isinstance(obj, dict) and (not obj):
        return None
    if (not isinstance(obj, dict)) or (
        isinstance(obj, dict)
        and (sorted(obj.keys()) != sorted(["points", "freq", "nf", "rc", "res"]))
    ):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if not (isinstance(obj["points"], int) and (obj["points"] > 0)):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_increasing_real_numpy_vector(obj["freq"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_real_numpy_vector(obj["nf"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if _check_number_numpy_vector(obj["rc"]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    if not (
        isinstance(obj["res"], np.ndarray)
        and (len(obj["res"].shape) == 1)
        and (obj["res"].shape[0] > 0)
        and np.all(obj["res"] >= 0)
    ):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    sizes = [obj["freq"].size, obj["nf"].size, obj["rc"].size, obj["res"].size]
    if set(sizes) != set([obj["points"]]):
        raise ValueError(pexdoc.pcontracts.get_exdesc())
    return None
r"""
    Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.

    :param obj: Object
    :type  obj: any

    :raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
     token \*[argument_name]\* is replaced by the name of the argument the
     contract is attached to

    :rtype: None