You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-python/astroscrappy/files/astroscrappy-1.0.3-endian-f...

101 lines
3.8 KiB

From 5b5ce99c63d03e60b6027f09f72231db11a87bf2 Mon Sep 17 00:00:00 2001
From: Curtis McCully <cmccully@lcogt.net>
Date: Thu, 3 Dec 2015 12:02:38 -0800
Subject: [PATCH] Made tests not endian specific.
--- a/astroscrappy/tests/test_utils.py
+++ b/astroscrappy/tests/test_utils.py
@@ -56,7 +56,7 @@
def test_medfilt5():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed5 = ndimage.filters.median_filter(a, size=(5, 5), mode='nearest')
npmed5[:2, :] = a[:2, :]
npmed5[-2:, :] = a[-2:, :]
@@ -68,7 +68,7 @@
def test_medfilt7():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed7 = ndimage.filters.median_filter(a, size=(7, 7), mode='nearest')
npmed7[:3, :] = a[:3, :]
npmed7[-3:, :] = a[-3:, :]
@@ -80,7 +80,7 @@
def test_sepmedfilt3():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed3 = ndimage.filters.median_filter(a, size=(1, 3), mode='nearest')
npmed3[:, :1] = a[:, :1]
npmed3[:, -1:] = a[:, -1:]
@@ -95,7 +95,7 @@
def test_sepmedfilt5():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed5 = ndimage.filters.median_filter(a, size=(1, 5), mode='nearest')
npmed5[:, :2] = a[:, :2]
npmed5[:, -2:] = a[:, -2:]
@@ -110,7 +110,7 @@
def test_sepmedfilt7():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed7 = ndimage.filters.median_filter(a, size=(1, 7), mode='nearest')
npmed7[:, :3] = a[:, :3]
npmed7[:, -3:] = a[:, -3:]
@@ -125,7 +125,7 @@
def test_sepmedfilt9():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npmed9 = ndimage.filters.median_filter(a, size=(1, 9), mode='nearest')
npmed9[:, :4] = a[:, :4]
npmed9[:, -4:] = a[:, -4:]
@@ -174,7 +174,7 @@
def test_subsample():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
npsubsamp = np.zeros((a.shape[0] * 2, a.shape[1] * 2), dtype=np.float32)
for i in range(a.shape[0]):
for j in range(a.shape[1]):
@@ -189,8 +189,8 @@
def test_rebin():
a = np.ascontiguousarray(np.random.random((2002, 2002)), dtype=np.float32)
- a = a.astype('<f4')
- nprebin = np.zeros((1001, 1001), dtype=np.float32).astype('<f4')
+ a = a.astype('f4')
+ nprebin = np.zeros((1001, 1001), dtype=np.float32).astype('f4')
for i in range(1001):
for j in range(1001):
nprebin[i, j] = (a[2 * i, 2 * j] + a[2 * i + 1, 2 * j] +
@@ -202,7 +202,7 @@
def test_laplaceconvolve():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
k = np.array([[0.0, -1.0, 0.0], [-1.0, 4.0, -1.0], [0.0, -1.0, 0.0]])
k = k.astype('<f4')
npconv = ndimage.filters.convolve(a, k, mode='constant', cval=0.0)
@@ -211,8 +211,8 @@
def test_convolve():
- a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('<f4')
- k = np.ascontiguousarray(np.random.random((5, 5))).astype('<f4')
+ a = np.ascontiguousarray(np.random.random((1001, 1001))).astype('f4')
+ k = np.ascontiguousarray(np.random.random((5, 5))).astype('f4')
npconv = ndimage.filters.convolve(a, k, mode='constant', cval=0.0)
cconv = convolve(a, k)
assert_allclose(cconv, npconv, rtol=0, atol=1e-5)