import numpy as np
from numpy.testing import assert_allclose

from ..ui import scale_image

DATA = np.array([0, 1., 2.])
DATASCL = 0.5 * DATA


class TestImageScaling(object):
    
    def test_linear(self):
        """Test linear scaling."""
        img = scale_image(DATA, scale='linear')
        assert_allclose(img, DATASCL, atol=0, rtol=1.e-5)

    def test_sqrt(self):
        """Test sqrt scaling."""
        img = scale_image(DATA, scale='sqrt')
        assert_allclose(img, np.sqrt(DATASCL), atol=0, rtol=1.e-5)

    def test_power(self):
        """Test power scaling."""
        power = 3.0
        img = scale_image(DATA, scale='power', power=power)
        assert_allclose(img, DATASCL**power, atol=0, rtol=1.e-5)

    def test_log(self):
        """Test log10 scaling."""
        img = scale_image(DATA, scale='log')
        ref = np.log10(1000 * DATASCL + 1.0) / np.log10(1001.0)
        assert_allclose(img, ref, atol=0, rtol=1.e-5)

@@ -169,20 +169,16 @@
 bject):%0A
-    
 %0A    def
@@ -918,28 +918,276 @@
 g, ref, atol=0, rtol=1.e-5)%0A
+%0A    def test_asinh(self):%0A        %22%22%22Test asinh scaling.%22%22%22%0A        a = 0.1%0A        img = scale_image(DATA, scale='asinh', asinh_a=a)%0A        ref = np.arcsinh(DATASCL / a) / np.arcsinh(1. / a)%0A        assert_allclose(img, ref, atol=0, rtol=1.e-5)%0A

Add test for asinh in scale_image