docs: def _set_current_subscript(self, active):
          """
          sets the current subscript and keeps a counter of how ofter a particular subscript has been executed
          this information is usefull when implementing a status update or plotting functions that depend on which subscript is being executed
  
          keeps track of the following dictionary:
          self._current_subscript_stage = {
              'current_subscript' : reference to the current subscrit
              'subscript_exec_count' : dictionary where key is the subscript name and value how often is has been executed
              'subscript_exec_duration' : dictionary where key is the subscript name and value the average duration of executing the subscript
          }
  
          Args:
              active: True if the current subscript is just started, False if it just finished
          """
  
          current_subscript = self.sender()
  
  
          if active:
              for subscript_name in list(self._current_subscript_stage['subscript_exec_count'].keys()):
                  if subscript_name == current_subscript.name:
                      self._current_subscript_stage['subscript_exec_count'][subscript_name] += 1
              self._current_subscript_stage['current_subscript'] = current_subscript
          else:
              self._current_subscript_stage['current_subscript'] = current_subscript
              for subscript_name in list(self._current_subscript_stage['subscript_exec_count'].keys()):
                  # calculate the average duration to execute the subscript
                  if subscript_name == current_subscript.name:
                      duration = current_subscript.end_time - current_subscript.start_time
                      if subscript_name  in self._current_subscript_stage['subscript_exec_duration']:
                          duration_old = self._current_subscript_stage['subscript_exec_duration'][subscript_name]
                      else:
                          duration_old = datetime.timedelta(0)
                      exec_count = self._current_subscript_stage['subscript_exec_count'][subscript_name]
  
                      duration_new = (duration_old * (exec_count - 1) + duration)
                      self._current_subscript_stage['subscript_exec_duration'][subscript_name] = (duration_old * (
                      exec_count - 1) + duration) / exec_count