More minor fixes
This commit is contained in:
Родитель
15ef022420
Коммит
5f6021eeb2
|
@ -530,8 +530,12 @@ class Image(object):
|
|||
array = np.atleast_2d(array)
|
||||
array_ok = False
|
||||
|
||||
# NOTE: we need to be careful to allow both little and big-endian data,
|
||||
# hence the check of .kind and .itemsize.
|
||||
if mode == ImageMode.F32:
|
||||
array_ok = (array.ndim == 2 and array.dtype == np.dtype(np.float32))
|
||||
array_ok = (array.ndim == 2 and array.dtype.kind == 'f' and array.dtype.itemsize == 4)
|
||||
elif mode == ImageMode.F64:
|
||||
array_ok = (array.ndim == 2 and array.dtype.kind == 'f' and array.dtype.itemsize == 8)
|
||||
elif mode == ImageMode.RGB:
|
||||
array_ok = (array.ndim == 3 and array.shape[2] == 3 and array.dtype == np.dtype(np.uint8))
|
||||
elif mode == ImageMode.RGBA:
|
||||
|
|
|
@ -289,8 +289,6 @@ class PyramidIO(object):
|
|||
"""
|
||||
p = self.tile_path(pos, format=format)
|
||||
|
||||
print('read_image', format, p)
|
||||
|
||||
loader = ImageLoader()
|
||||
loader.desired_mode = mode
|
||||
|
||||
|
|
|
@ -151,7 +151,6 @@ def image_test(expected, actual, err_msg):
|
|||
class TestSampleLayer(object):
|
||||
def setup_method(self, method):
|
||||
self.base = mkdtemp()
|
||||
print(self.base)
|
||||
self.pio = PyramidIO(self.base)
|
||||
|
||||
# def teardown_method(self, method):
|
||||
|
@ -207,8 +206,8 @@ class TestSampleLayer(object):
|
|||
from ..samplers import healpix_fits_file_sampler
|
||||
|
||||
sampler = healpix_fits_file_sampler(test_path('earth_healpix_gal.fits'))
|
||||
sample_layer(self.pio, ImageMode.F32, sampler, 1, format='npy')
|
||||
self.verify_level1(ImageMode.F32, format='npy')
|
||||
sample_layer(self.pio, ImageMode.F32, sampler, 1, format='fits')
|
||||
self.verify_level1(ImageMode.F32, format='fits')
|
||||
|
||||
|
||||
class TestCliBasic(object):
|
||||
|
|
|
@ -460,7 +460,6 @@ def _sample_layer_serial(pio, mode, format, sampler, depth, cli_progress):
|
|||
tile.increasing,
|
||||
)
|
||||
sampled_data = sampler(lon, lat)
|
||||
print("FORMAT", format, mode)
|
||||
pio.write_image(tile.pos, Image.from_array(mode, sampled_data), format=format)
|
||||
progress.update(1)
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ def _float_to_rgb_do_one(buf, pos, pio, read_mode, transform):
|
|||
Do one float-to-RGB job. This problem is embarassingly parallel so we can
|
||||
share code between the serial and parallel implementations.
|
||||
"""
|
||||
img = pio.read_image(pos, read_mode)
|
||||
img = pio.read_image(pos, read_mode, format='npy')
|
||||
if img is None:
|
||||
return
|
||||
|
||||
|
@ -121,4 +121,4 @@ def _float_to_rgb_do_one(buf, pos, pio, read_mode, transform):
|
|||
buf[...,3] = 255 * valid
|
||||
|
||||
rgb = Image.from_array(ImageMode.RGBA, buf)
|
||||
pio.write_image(pos, rgb)
|
||||
pio.write_image(pos, rgb, format='png')
|
||||
|
|
Загрузка…
Ссылка в новой задаче