code: def test_entropy(self):
      #  verify that entropy is coherent with bitdepth of the input data
  
      footprint = np.ones((16, 16), dtype=np.uint8)
      # 1 bit per pixel
      data = np.tile(np.asarray([0, 1]), (100, 100)).astype(np.uint8)
      assert np.max(rank.entropy(data, footprint)) == 1
  
      # 2 bit per pixel
      data = np.tile(np.asarray([[0, 1], [2, 3]]), (10, 10)).astype(
          np.uint8
      )
      assert np.max(rank.entropy(data, footprint)) == 2
  
      # 3 bit per pixel
      data = np.tile(
          np.asarray([[0, 1, 2, 3], [4, 5, 6, 7]]), (10, 10)
      ).astype(np.uint8)
      assert np.max(rank.entropy(data, footprint)) == 3
  
      # 4 bit per pixel
      data = np.tile(
          np.reshape(np.arange(16), (4, 4)), (10, 10)
      ).astype(np.uint8)
      assert np.max(rank.entropy(data, footprint)) == 4
  
      # 6 bit per pixel
      data = np.tile(
          np.reshape(np.arange(64), (8, 8)), (10, 10)
      ).astype(np.uint8)
      assert np.max(rank.entropy(data, footprint)) == 6
  
      # 8-bit per pixel
      data = np.tile(
          np.reshape(np.arange(256), (16, 16)), (10, 10)
      ).astype(np.uint8)
      assert np.max(rank.entropy(data, footprint)) == 8
  
      # 12 bit per pixel
      footprint = np.ones((64, 64), dtype=np.uint8)
      data = np.zeros((65, 65), dtype=np.uint16)
      data[:64, :64] = np.reshape(np.arange(4096), (64, 64))
      with expected_warnings(["Bad rank filter performance"]):
          assert np.max(rank.entropy(data, footprint)) == 12
  
      # make sure output is of dtype double
      with expected_warnings(["Bad rank filter performance"]):
          out = rank.entropy(data, np.ones((16, 16), dtype=np.uint8))
      assert out.dtype == np.float64
  
imports: import numpy
  import pytest
  from skimage import data, morphology, util
  from skimage._shared._warnings import expected_warnings
  from skimage._shared.testing import assert_allclose, assert_array_almost_equal, assert_equal, fetch, run_in_parallel
  from skimage.filters import rank
  from skimage.filters.rank import __all__
  from skimage.filters.rank import subtract_mean
  from skimage.morphology import ball, disk, gray
  from skimage.util import img_as_float, img_as_ubyte
label_desc: Use image node_id 26 for calling the TestRank obj's underlying member method code with example usage: obj.test_entropy() without return types