docstr: Adjust the setting values for pipelines saved under old revisions
docstr_tok: ["Adjust","the","setting","values","for","pipelines","saved","under","old","revisions"]
code: def upgrade_settings(
      self, setting_values, variable_revision_number, module_name
  ):
      """Adjust the setting values for pipelines saved under old revisions"""
      if variable_revision_number < 2:
          raise NotImplementedError(
              "Automatic upgrade for this module is not supported in CellProfiler 3."
          )
  
      if variable_revision_number == 2:
          image_count = int(setting_values[0])
          idx_thr = image_count + 2
          setting_values = (
              setting_values[:idx_thr]
              + ["15.0"]
              + setting_values[idx_thr:]
          )
          variable_revision_number = 3
  
      if variable_revision_number == 3:
          num_images = int(setting_values[0])
          num_objects = int(setting_values[1])
          div_img = 2 + num_images
          div_obj = div_img + 2 + num_objects
          images_set = set(setting_values[2:div_img])
          thr_mode = setting_values[div_img : div_img + 2]
          objects_set = set(setting_values[div_img + 2 : div_obj])
          other_settings = setting_values[div_obj:]
          if "None" in images_set:
              images_set.remove("None")
          if "None" in objects_set:
              objects_set.remove("None")
          images_string = ", ".join(map(str, images_set))
          objects_string = ", ".join(map(str, objects_set))
          setting_values = (
              [images_string]
              + thr_mode
              + [objects_string]
              + other_settings
          )
          variable_revision_number = 4
      if variable_revision_number == 4:
          # Add costes mode switch
          setting_values += [M_FASTER]
          variable_revision_number = 5
      return setting_values, variable_revision_number
  
imports: import numpy
  import scipy.ndimage
  import scipy.stats
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Divider, Binary, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import LabelListSubscriber, ImageListSubscriber
  from cellprofiler_core.setting.text import Float
  from cellprofiler_core.utilities.core.object import size_similarly
  from centrosome.cpmorphology import fixup_scipy_ndimage_result
  from scipy.linalg import lstsq
label_desc: Use image node_id 19 for calling the MeasureColocalization obj's underlying member method code with example usage: obj.upgrade_settings(setting_values, variable_revision_number, module_name) and returns: setting_values,  variable_revision_number