code: def test_image_blur():
      """Test the focus scores of a random image
  
      The expected variance of a uniform distribution is 1/12 of the
      difference of the extents (=(0,1)). We divide this by the mean
      and the focus_score should be 1/6
  
      The local focus score is the variance among the 25 focus scores
      divided by the median focus score. This should be low.
      """
      numpy.random.seed(0)
      workspace = make_workspace(numpy.random.uniform(size=(100, 100)))
      q = workspace.module
      q.image_groups[0].check_blur.value = True
      q.image_groups[0].check_saturation.value = False
      q.image_groups[0].check_intensity.value = False
      q.image_groups[0].calculate_threshold.value = False
      q.image_groups[0].scale_groups[0].scale.value = 20
      q.run(workspace)
      m = workspace.measurements
      for feature_name, value in (
          ("ImageQuality_FocusScore_my_image", 1.0 / 6.0),
          ("ImageQuality_LocalFocusScore_my_image_20", 0),
          ("ImageQuality_PercentSaturation_my_image", None),
          ("ImageQuality_PercentMaximal_my_image", None),
      ):
          if value is None:
              assert not m.has_current_measurements(
                  "Image", feature_name
              ), ("Feature %s should not be present" % feature_name)
          else:
              assert m.has_current_measurements(
                  "Image", feature_name
              ), ("Missing feature %s" % feature_name)
  
              m_value = m.get_current_measurement("Image", feature_name)
              assert (
                  round(abs(m_value - value), 2) == 0
              ), "Measured value, %f, for feature %s was not %f" % (
                  m_value,
                  feature_name,
                  value,
              )
      features_and_columns_match(m, q)
  
imports: import io
  import centrosome.threshold
  import numpy
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, EXPERIMENT
  from cellprofiler_core.constants.module._identify import O_FOREGROUND, O_THREE_CLASS, O_WEIGHTED_VARIANCE, O_TWO_CLASS, O_ENTROPY, O_BACKGROUND
  import cellprofiler.modules.measureimagequality
  import cellprofiler_core.modules.namesandtypes
  import cellprofiler.modules.smooth
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 5 for calling a global function with example usage: test_image_blur() without return types