(self, itr, cond, i)
Collect a sample from the agent.
        Args:
            itr: Iteration number.
            cond: Condition number.
            i: Sample number.
        Returns: None
Collect a sample from the agent.
        Args:
            itr: Iteration number.
            cond: Condition number.
            i: Sample number.
        Returns: None
Collect a sample from the agent . Args : itr : Iteration number . cond : Condition number . i : Sample number . Returns : None
def _take_sample(self, itr, cond, i):
        """
        Collect a sample from the agent.
        Args:
            itr: Iteration number.
            cond: Condition number.
            i: Sample number.
        Returns: None
        """
        if self.algorithm._hyperparams['sample_on_policy'] \
                and self.algorithm.iteration_count > 0:
            pol = self.algorithm.policy_opt.policy
        else:
            pol = self.algorithm.cur[cond].traj_distr
        if self.gui:
            self.gui.set_image_overlays(cond)   # Must call for each new cond.
            redo = True
            while redo:
                while self.gui.mode in ('wait', 'request', 'process'):
                    if self.gui.mode in ('wait', 'process'):
                        time.sleep(0.01)
                        continue
                    # 'request' mode.
                    if self.gui.request == 'reset':
                        try:
                            self.agent.reset(cond)
                        except NotImplementedError:
                            self.gui.err_msg = 'Agent reset unimplemented.'
                    elif self.gui.request == 'fail':
                        self.gui.err_msg = 'Cannot fail before sampling.'
                    self.gui.process_mode()  # Complete request.

                self.gui.set_status_text(
                    'Sampling: iteration %d, condition %d, sample %d.' %
                    (itr, cond, i)
                )
                self.agent.sample(
                    pol, cond,
                    verbose=(i < self._hyperparams['verbose_trials'])
                )

                if self.gui.mode == 'request' and self.gui.request == 'fail':
                    redo = True
                    self.gui.process_mode()
                    self.agent.delete_last_sample(cond)
                else:
                    redo = False
        else:
            self.agent.sample(
                pol, cond,
                verbose=(i < self._hyperparams['verbose_trials'])
            )
def _take_sample ( self , itr , cond , i ) : if self . algorithm . _hyperparams [ 'sample_on_policy' ] and self . algorithm . iteration_count > 0 : pol = self . algorithm . policy_opt . policy else : pol = self . algorithm . cur [ cond ] . traj_distr if self . gui : self . gui . set_image_overlays ( cond ) # Must call for each new cond. redo = True while redo : while self . gui . mode in ( 'wait' , 'request' , 'process' ) : if self . gui . mode in ( 'wait' , 'process' ) : time . sleep ( 0.01 ) continue # 'request' mode. if self . gui . request == 'reset' : try : self . agent . reset ( cond ) except NotImplementedError : self . gui . err_msg = 'Agent reset unimplemented.' elif self . gui . request == 'fail' : self . gui . err_msg = 'Cannot fail before sampling.' self . gui . process_mode ( ) # Complete request. self . gui . set_status_text ( 'Sampling: iteration %d, condition %d, sample %d.' % ( itr , cond , i ) ) self . agent . sample ( pol , cond , verbose = ( i < self . _hyperparams [ 'verbose_trials' ] ) ) if self . gui . mode == 'request' and self . gui . request == 'fail' : redo = True self . gui . process_mode ( ) self . agent . delete_last_sample ( cond ) else : redo = False else : self . agent . sample ( pol , cond , verbose = ( i < self . _hyperparams [ 'verbose_trials' ] ) )