code: def extract_one_trajectory(self):
          
          traj = []
          for t in reversed(range(self.T)):
              if t == self.T - 1:
                  n = rs.multinomial_once(self.wgt[-1].W)
              else:
                  n = self.A[t + 1][n]
              traj.append(self.X[t][n])
          return traj[::-1]
docs: Extract a single trajectory from the particle history.
  
          The final state is chosen randomly, then the corresponding trajectory 
          is constructed backwards, until time t=0.