def test_ashrae_scalar(): thetas = -45. iam = _iam.ashrae(thetas, .05) expected = 0.97928932 assert_allclose(iam, expected, equal_nan=True) thetas = np.nan iam = _iam.ashrae(thetas, .05) expected = np.nan assert_allclose(iam, expected, equal_nan=True)
def test_ashrae(): thetas = np.array( [-90., -67.5, -45., -22.5, 0., 22.5, 45., 67.5, 89., 90., np.nan]) expected = np.array([ 0, 0.9193437, 0.97928932, 0.99588039, 1., 0.99588039, 0.97928932, 0.9193437, 0, 0, np.nan ]) iam = _iam.ashrae(thetas, .05) assert_allclose(iam, expected, equal_nan=True) iam_series = _iam.ashrae(pd.Series(thetas)) assert_series_equal(iam_series, pd.Series(expected))