code: def reset_generation(self, trigger):
          
          self.tone_lock.acquire()
  
          npts =  self.stim.size
          try:
              self.aotask = AOTaskFinite(self.aochan, self.fs, npts, trigsrc=trigger)
              self.aotask.write(self.stim)
              if self.attenuator is not None:
                  self.attenuator.SetAtten(self.atten)
              else:
                  # print "ERROR: attenuation not set!"
                  pass
                  # raise
  
              self.ngenerated +=1
              if self.stim_changed:
                  new_gen = self.stim
              else:
                  new_gen = None
              self.stim_changed = False
  
          except:
              print u'ERROR! TERMINATE!'
              self.tone_lock.release()
              raise
  
          self.tone_lock.release()
          return new_gen
docs: Re-arms the analog output according to current settings
  
          :param trigger: name of the trigger terminal. ``None`` value means generation begins immediately on run
          :type trigger: str