code: def test_find_adjacent_by_distance_hard():
      #
      # Feed "find_adjacent_by_distance" points whose "i" are not all
      # within the space_distance
      #
      workspace, module = make_workspace(numpy.zeros((20, 10), bool))
      assert isinstance(
          module,
          cellprofiler.modules.identifydeadworms.IdentifyDeadWorms,
      )
      module.space_distance.value = 10
      r = numpy.random.RandomState(44)
      for idx, scramble in enumerate(
          [numpy.arange(13)]
          + [r.permutation(numpy.arange(13)) for ii in range(10)]
      ):
          # Take find_adjacent_by_distance internals into account: non consecutive i
          # will create two cross-products
          #
          i = numpy.arange(13)
          j = numpy.arange(13)
          # Break into three groups: 0-2 (3x3), 3-6 (4x4) and 7-11 (5x5)
          # with one loner at end
          i[3:] += 10
          i[7:] += 10
          #
          # Make last in last group not match by i+j
          #
          i[-1] += 7
          j[-1] += 8
          a = numpy.zeros(13)
          #
          # Scramble i, j and a
          #
          i = i[scramble]
          j = j[scramble]
          a = a[scramble]
          #
          # a reported value of "n" corresponds to whatever index in scramble
          # that contains "n"
          #
          unscramble = numpy.zeros(13, int)
          unscramble[scramble] = numpy.arange(13)
          first, second = module.find_adjacent_by_distance(i, j, a)
          assert len(first) == 9 + 16 + 25 + 1
          assert len(second) == 9 + 16 + 25 + 1
          for f, s in zip(first, second):
              assert (i[f] - i[s]) ** 2 + (j[f] - j[s]) ** 2 <= 100
  
imports: import centrosome.cpmorphology
  import numpy
  import scipy.ndimage
  import six.moves
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import C_COUNT, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, COLTYPE_INTEGER, COLTYPE_FLOAT, M_NUMBER_OBJECT_NUMBER, FF_COUNT
  import cellprofiler.modules.identifydeadworms
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 11 for calling a global function with example usage: test_find_adjacent_by_distance_hard() without return types