code: def _estimate_progress(self):
          estimate = True
          current_subscript = self._current_subscript_stage['current_subscript']
          num_subscripts = len(self.scripts)
          if self.iterator_type == 'loop':
              num_iterations = self.settings['num_loops']
          elif self.iterator_type == 'sweep':
              sweep_range = self.settings['sweep_range']
              if self.settings['stepping_mode'] == 'value_step':
                  num_iterations = int((sweep_range['max_value'] - sweep_range['min_value']) / sweep_range['N/value_step']) + 1
              elif self.settings['stepping_mode'] == 'N':
                  num_iterations = sweep_range['N/value_step']
              else:
                  raise KeyError('unknown key' + self.settings['stepping_mode'])
          else:
              print('unknown iterator type in Iterator receive signal - can\'t estimate ramining time')
              estimate = False
          if estimate:
              loop_index = self.loop_index
              if num_subscripts > 1:
                  loop_execution_time = 0.
                  sub_progress_time = 0.
                  if current_subscript is not None:
                      current_subscript_exec_duration = self._current_subscript_stage['subscript_exec_duration'][
                          current_subscript.name].total_seconds()
                  else:
                      current_subscript_exec_duration = 0.0
                  current_subscript_elapsed_time = (datetime.datetime.now() - current_subscript.start_time).total_seconds()
                  if current_subscript_exec_duration == 0.0:
                      remaining_time = current_subscript.remaining_time.total_seconds()
                      current_subscript_exec_duration = remaining_time + current_subscript_elapsed_time
                  remaining_scripts = 0
                  for subscript_name, duration in self._current_subscript_stage['subscript_exec_duration'].items():
                      if duration.total_seconds() == 0.0:
                          remaining_scripts += 1
                      loop_execution_time += duration.total_seconds()
                      if self._current_subscript_stage['subscript_exec_count'][subscript_name] == loop_index \
                              and subscript_name is not current_subscript.name:
                          sub_progress_time += duration.total_seconds()
                  sub_progress_time += current_subscript_elapsed_time
                  if remaining_scripts == num_subscripts:
                      loop_execution_time = num_subscripts * current_subscript_exec_duration
                  elif remaining_scripts > 1:
                      loop_execution_time = 1. * num_subscripts / (num_subscripts - remaining_scripts)
                  elif remaining_scripts == 1:
                      loop_execution_time += current_subscript_exec_duration
                  if loop_execution_time > 0:
                      progress_subscript = 100. * sub_progress_time / loop_execution_time
                  else:
                      progress_subscript = 1. * progress_subscript / num_subscripts
              progress = 100. * (loop_index - 1. + 0.01 * progress_subscript) / num_iterations
          else:
              progress = 50
          return progress