view tvii/error.py @ 82:c05ce6b7f941

test distance calculations
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Dec 2017 13:45:44 -0800
parents 351fc97bb996
children
line wrap: on
line source

import numpy as np

def error(function, x, y):
    """
    computes true value and error and returns
    them both as a 2-tuple
    """

    yhat = np.array([function(*val) for val in x])
    error = yhat - np.array(y)

    return (yhat, error)