docstr: Calculate experiment-wide threshold mean, median and standard-deviation
docstr_tok: ["Calculate","experiment-wide","threshold","mean",",","median","and","standard-deviation"]
code: def calculate_experiment_threshold(self, image_group, workspace):
      """Calculate experiment-wide threshold mean, median and standard-deviation"""
      m = workspace.measurements
      statistics = []
      all_threshold_groups = self.get_all_threshold_groups(image_group)
      if image_group.calculate_threshold.value:
          for image_name in self.images_to_process(
              image_group, workspace
          ):
              for threshold_group in all_threshold_groups:
                  values = m.get_all_measurements(
                      "Image",
                      threshold_group.threshold_feature_name(
                          image_name
                      ),
                  )
  
                  values = values[numpy.isfinite(values)]
  
                  for feature in (F_THRESHOLD,):
                      for fn, agg in (
                          (numpy.mean, AGG_MEAN),
                          (numpy.median, AGG_MEDIAN),
                          (numpy.std, AGG_STD),
                      ):
                          feature_name = (
                              threshold_group.threshold_feature_name(
                                  image_name, agg=agg
                              )
                          )
                          feature_description = (
                              threshold_group.threshold_description(
                                  image_name, agg=agg
                              )
                          )
                          val = fn(values)
                          m.add_experiment_measurement(
                              feature_name, val
                          )
                      statistics.append([feature_description, str(val)])
      return statistics
  
imports: import itertools
  import logging
  import cellprofiler_core.utilities.image
  import centrosome.cpmorphology
  import centrosome.haralick
  import centrosome.radial_power_spectrum
  import centrosome.threshold
  import centrosome.threshold
  import numpy
  import scipy.linalg.basic
  import scipy.ndimage
  from cellprofiler_core.constants.image import C_SCALING
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, EXPERIMENT, MCA_AVAILABLE_POST_RUN
  from cellprofiler_core.constants.module._identify import O_WEIGHTED_VARIANCE, O_ENTROPY, O_FOREGROUND, O_BACKGROUND
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import get_headless
  from cellprofiler_core.setting import Divider, HiddenCount, SettingsGroup, Binary, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.subscriber import ImageListSubscriber
  from cellprofiler_core.setting.text import ImageName, Integer, Float
  from cellprofiler.modules.threshold import O_THREE_CLASS, O_TWO_CLASS
label_desc: Use image node_id 36 for calling the MeasureImageQuality obj's underlying member method code with example usage: obj.calculate_experiment_threshold(image_group, workspace) and returns: statistics