Example #1
0
def test_eq():
    input_shape = (8, 8)
    assert jpeg(input_shape) == jpeg(input_shape)
    assert not jpeg(input_shape) != jpeg(input_shape)
    assert jpeg(input_shape, quality=1) == jpeg(input_shape, quality=1)
    assert jpeg(input_shape, quality=1) != jpeg(input_shape, quality=90)
    assert jpeg(input_shape) != "foo"
    assert "foo" != jpeg(input_shape)
    assert not jpeg(input_shape) == "foo"
Example #2
0
def test_config():
    codec = jpeg(input_shape=(10, 10), quality=50)
    check_config(codec)
Example #3
0
import numpy as np
import pytest
from imagecodecs import jpeg_encode
from zarr_jpeg import jpeg
from zarr_jpeg.zarr_jpeg import validate_axis_reduction
from numcodecs.tests.common import check_config
from itertools import product

codecs = [
    jpeg(input_shape=(8, 8)),
    jpeg(input_shape=(8, 8, 8), quality=1),
    jpeg(input_shape=(8, 8, 8), quality=1),
    jpeg(input_shape=(8, 9, 10, 11), quality=100),
]

# only uint8 data
# 2D shapes and larger
# mix of orders: C, F
arrays = [
    np.zeros((8, 8), dtype='uint8'),
    np.random.randint(0, 255, size=8 * 8 * 8, dtype="u1").reshape(8,
                                                                  8,
                                                                  8,
                                                                  order="F"),
    np.random.randint(0, 255, size=8 * 8 * 8, dtype="u1").reshape(8,
                                                                  8,
                                                                  8,
                                                                  order="C"),
    np.random.randint(0, 255, size=8 * 9 * 10 * 11,
                      dtype="u1").reshape(8, 9, 10, 11, order="C"),
]
Example #4
0
def test_eq():
    assert jpeg() == jpeg()
    assert not jpeg() != jpeg()
    assert jpeg(1) == jpeg(1)
    assert jpeg(1) != jpeg(90)
    assert jpeg() != "foo"
    assert "foo" != jpeg()
    assert not jpeg() == "foo"
Example #5
0
def test_config():
    codec = jpeg(quality=50)
    check_config(codec)
Example #6
0
import itertools

import numpy as np
import pytest

from zarr_jpeg import jpeg
from numcodecs.tests.common import check_encode_decode, check_config, check_repr

from itertools import product

codecs = [
    jpeg(),
    jpeg(quality=1),
    jpeg(quality=50),
    jpeg(quality=100),
]

# only uint8 data
# only 2D and 3D shapes
# mix of orders: C, F
arrays = [
    np.arange(100, dtype="u1").reshape((10, 10)),
    np.random.randint(0, 255, size=10 * 11 * 12,
                      dtype="u1").reshape(10, 11, 12, order="F"),
    np.random.randint(0, 255, size=10 * 11 * 12,
                      dtype="u1").reshape(10, 11, 12, order="C"),
]


def test_config():
    codec = jpeg(quality=50)