code: def test_means_of_distances(self):
      #
      # Regression test of issue #1409
      #
      # Make sure means of minimum and mean distances of children
      # are recorded properly
      #
      i, j = numpy.mgrid[0:14, 0:30]
      #
      # Make the objects different sizes to exercise more code
      #
      parent_labels = (i >= 7) * 1 + (j >= 15) * 2 + 1
      child_labels = numpy.zeros(i.shape)
      numpy.random.seed(0)
      # Take 12 random points and label them
      child_centers = numpy.random.permutation(numpy.prod(i.shape))[:12]
      child_centers = numpy.vstack(
          (i.flatten()[child_centers], j.flatten()[child_centers])
      )
      child_labels[child_centers[0], child_centers[1]] = numpy.arange(
          1, 13
      )
      parent_centers = numpy.array(
          [[3, 7], [10, 7], [3, 22], [10, 22]], float
      )
      parent_indexes = (
          parent_labels[child_centers[0], child_centers[1]] - 1
      )
      expected = numpy.sqrt(
          numpy.sum(
              (
                  parent_centers[parent_indexes, :]
                  - child_centers.transpose()
              )
              ** 2,
              1,
          )
      )
  
      workspace, module = self.make_workspace(
          parent_labels, child_labels
      )
      assert isinstance(
          module, cellprofiler.modules.relateobjects.Relate
      )
      module.find_parent_child_distances.value = (
          cellprofiler.modules.relateobjects.D_CENTROID
      )
      module.wants_per_parent_means.value = True
      mnames = module.get_measurements(
          workspace.pipeline,
          PARENT_OBJECTS,
          "_".join(
              (cellprofiler.modules.relateobjects.C_MEAN, CHILD_OBJECTS)
          ),
      )
      assert (
          cellprofiler.modules.relateobjects.FF_CENTROID
          % PARENT_OBJECTS
          in mnames
      )
      feat_mean = cellprofiler.modules.relateobjects.FF_MEAN % (
          CHILD_OBJECTS,
          cellprofiler.modules.relateobjects.FF_CENTROID
          % PARENT_OBJECTS,
      )
      mcolumns = module.get_measurement_columns(workspace.pipeline)
      assert any(
          [
              c[0] == PARENT_OBJECTS and c[1] == feat_mean
              for c in mcolumns
          ]
      )
      m = workspace.measurements
      m[CHILD_OBJECTS, M_LOCATION_CENTER_X, 1] = child_centers[1]
      m[CHILD_OBJECTS, M_LOCATION_CENTER_Y, 1] = child_centers[0]
      module.run(workspace)
  
      v = m[PARENT_OBJECTS, feat_mean, 1]
  
      plabel = m[
          CHILD_OBJECTS,
          "_".join((C_PARENT, PARENT_OBJECTS)),
          1,
      ]
  
      assert len(v) == 4
      for idx in range(4):
          if numpy.any(plabel == idx + 1):
              assert (
                  round(
                      abs(
                          v[idx]
                          - numpy.mean(expected[plabel == idx + 1])
                      ),
                      4,
                  )
                  == 0
              )
  
imports: import numpy
  import unittest
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.module
  from cellprofiler_core.constants.measurement import C_PARENT, GROUP_NUMBER, GROUP_INDEX, COLTYPE_FLOAT, COLTYPE_INTEGER, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, FF_PARENT
  import cellprofiler.modules.relateobjects
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.workspace
label_desc: Use image node_id 12 for calling the TestRelateObjects obj's underlying member method code with example usage: obj.test_means_of_distances() without return types