(self, policy, condition, verbose=False, save=True, noisy=True)
return new_sample
Runs a trial and constructs a new sample containing information
        about the trial.

        Args:
            policy: Policy to to used in the trial.
            condition (int): Which condition setup to run.
            verbose (boolean): Whether or not to plot the trial (not used here).
            save (boolean): Whether or not to store the trial into the samples.
            noisy (boolean): Whether or not to use noise during sampling.
Runs a trial and constructs a new sample containing information
        about the trial.
Runs a trial and constructs a new sample containing information about the trial .
def sample(self, policy, condition, verbose=False, save=True, noisy=True):
        """
        Runs a trial and constructs a new sample containing information
        about the trial.

        Args:
            policy: Policy to to used in the trial.
            condition (int): Which condition setup to run.
            verbose (boolean): Whether or not to plot the trial (not used here).
            save (boolean): Whether or not to store the trial into the samples.
            noisy (boolean): Whether or not to use noise during sampling.
        """
        self._worlds[condition].run()
        self._worlds[condition].reset_world()
        b2d_X = self._worlds[condition].get_state()
        new_sample = self._init_sample(b2d_X)
        U = np.zeros([self.T, self.dU])
        if noisy:
            noise = generate_noise(self.T, self.dU, self._hyperparams)
        else:
            noise = np.zeros((self.T, self.dU))
        for t in range(self.T):
            X_t = new_sample.get_X(t=t)
            obs_t = new_sample.get_obs(t=t)
            U[t, :] = policy.act(X_t, obs_t, t, noise[t, :])
            if (t+1) < self.T:
                for _ in range(self._hyperparams['substeps']):
                    self._worlds[condition].run_next(U[t, :])
                b2d_X = self._worlds[condition].get_state()
                self._set_sample(new_sample, b2d_X, t)
        new_sample.set(ACTION, U)
        if save:
            self._samples[condition].append(new_sample)
        return new_sample
def sample ( self , policy , condition , verbose = False , save = True , noisy = True ) : self . _worlds [ condition ] . run ( ) self . _worlds [ condition ] . reset_world ( ) b2d_X = self . _worlds [ condition ] . get_state ( ) new_sample = self . _init_sample ( b2d_X ) U = np . zeros ( [ self . T , self . dU ] ) if noisy : noise = generate_noise ( self . T , self . dU , self . _hyperparams ) else : noise = np . zeros ( ( self . T , self . dU ) ) for t in range ( self . T ) : X_t = new_sample . get_X ( t = t ) obs_t = new_sample . get_obs ( t = t ) U [ t , : ] = policy . act ( X_t , obs_t , t , noise [ t , : ] ) if ( t + 1 ) < self . T : for _ in range ( self . _hyperparams [ 'substeps' ] ) : self . _worlds [ condition ] . run_next ( U [ t , : ] ) b2d_X = self . _worlds [ condition ] . get_state ( ) self . _set_sample ( new_sample , b2d_X , t ) new_sample . set ( ACTION , U ) if save : self . _samples [ condition ] . append ( new_sample ) return new_sample