# Correct values for first set of tests. # rcl_value = 0.9745614528656006 xave_value = 2165 yave_value = 2125.27777778 tval_value = 38.7428595367 rstd_value = 0.0251546076193 nptxy_value = 18 yint_value = 15.352282489361187 test_value("regline", rcl, rcl_value, delta=1e-7) test_value("regline tval", attrs["tval"], tval_value) test_value("regline xave", attrs["xave"], xave_value) test_value("regline yave", attrs["yave"], yave_value) test_value("regline rstd", attrs["rstd"], rstd_value) test_value("regline yintercept", attrs["yintercept"], yint_value) test_value("regline nptxy", attrs["nptxy"], nptxy_value) del rcl # # Extra side test for Ngl.betainc # df = attrs["nptxy"] - 2 prob = (1 - Ngl.betainc(df / (df + attrs["tval"]**2), df / 2., 0.5)) test_value("betainc", prob, 1.0) rcl = Ngl.regline(x, y, return_info=False) check_type(rcl, "nma") test_value("regline (ma)", rcl, rcl_value, delta=1e-7) test_value("regline (fill_value)", rcl._fill_value, 1e20)
import Ngl, types # # Leave these both alone, regardless of what module you are testing. # import numpy from utils import * # # Begin betainc tests. # x = 0.2 a = 0.5 b = 5.0 alpha1 = Ngl.betainc(x, a, b) x = 0.5 alpha2 = Ngl.betainc(x, a, b) # # Correct values for first set of tests. # alpha1_value = 0.855072394596 alpha2_value = 0.989880440265 test_value("betainc", alpha1, alpha1_value) test_value("betainc", alpha2, alpha2_value) check_type(alpha1) check_type(alpha2) # Test arrays of values.