docstr: Do any sort of adjustment to the settings required for the given values
  
  setting_values - the values for the settings
  
  This method allows a module to specialize itself according to
  the number of settings and their value. For instance, a module that
  takes a variable number of images or objects can increase or decrease
  the number of relevant settings so they map correctly to the values.
  
  See cellprofiler.modules.measureobjectsizeshape for an example.
docstr_tok: ["Do","any","sort","of","adjustment","to","the","settings","required","for","the","given","values","setting_values","-","the","values","for","the","settings","This","method","allows","a","module","to","specialize","itself","according","to","the","number","of","settings","and","their","value",".","For","instance",",","a","module","that","takes","a","variable","number","of","images","or","objects","can","increase","or","decrease","the","number","of","relevant","settings","so","they","map","correctly","to","the","values",".","See","cellprofiler.modules.measureobjectsizeshape","for","an","example","."]
code: def prepare_settings(self, setting_values):
      """Do any sort of adjustment to the settings required for the given values
  
      setting_values - the values for the settings
  
      This method allows a module to specialize itself according to
      the number of settings and their value. For instance, a module that
      takes a variable number of images or objects can increase or decrease
      the number of relevant settings so they map correctly to the values.
  
      See cellprofiler.modules.measureobjectsizeshape for an example.
      """
      value_count = len(setting_values)
      if (
          value_count - FIXED_SETTING_COUNT
      ) % VARIABLE_SETTING_COUNT != 0:
          raise ValueError(
              "Invalid # of settings (%d) for the CalculateStatistics module"
              % value_count
          )
      dose_count = (
          value_count - FIXED_SETTING_COUNT
      ) / VARIABLE_SETTING_COUNT
      if len(self.dose_values) > dose_count:
          del self.dose_values[dose_count:]
      while len(self.dose_values) < dose_count:
          self.add_dose_value()
  
imports: import functools
  import os
  import numpy
  import scipy.optimize
  from cellprofiler_core.constants.measurement import EXPERIMENT
  from cellprofiler_core.constants.measurement import IMAGE
  from cellprofiler_core.constants.measurement import NEIGHBORS
  from cellprofiler_core.constants.module import IO_FOLDER_CHOICE_HELP_TEXT, IO_WITH_METADATA_HELP_TEXT
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import ABSOLUTE_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_SUBFOLDER_NAME
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.do_something import DoSomething
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.text import Directory
  from cellprofiler_core.setting.text import Text
label_desc: Use image node_id 5 for calling the CalculateStatistics obj's underlying member method code with example usage: obj.prepare_settings(setting_values) without return types