code: def write_figures(
      prefix,
      directory,
      dose_name,
      dose_data,
      data,
      ec50_coeffs,
      feature_set,
      log_transform,
  ):
      """Write out figure scripts for each measurement
  
      prefix - prefix for file names
      directory - write files into this directory
      dose_name - name of the dose measurement
      dose_data - doses per image
      data - data per image
      ec50_coeffs - coefficients calculated by calculate_ec50
      feature_set - tuples of object name and feature name in same order as data
      log_transform - true to log-transform the dose data
      """
      from matplotlib.figure import Figure
      from matplotlib.backends.backend_pdf import FigureCanvasPdf
  
      if log_transform:
          dose_data = numpy.log(dose_data)
      for i, (object_name, feature_name) in enumerate(feature_set):
          fdata = data[:, i]
          fcoeffs = ec50_coeffs[i, :]
          filename = "%s%s_%s.pdf" % (prefix, object_name, feature_name)
          pathname = os.path.join(directory, filename)
          f = Figure()
          canvas = FigureCanvasPdf(f)
          ax = f.add_subplot(1, 1, 1)
          x = numpy.linspace(0, numpy.max(dose_data), num=100)
          y = sigmoid(fcoeffs, x)
          ax.plot(x, y)
          dose_y = sigmoid(fcoeffs, dose_data)
          ax.plot(dose_data, dose_y, "o")
          ax.set_xlabel("Dose")
          ax.set_ylabel("Response")
          ax.set_title("%s_%s" % (object_name, feature_name))
          f.savefig(pathname)
  
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 8 for calling a global function with example usage: write_figures(prefix, directory, dose_name, dose_data, data, ec50_coeffs, feature_set, log_transform) without return types