def _sim_trajectories(self, time_size, start_pos, rs,<EOL>total_emission=False, save_pos=False, radial=False,<EOL>wrap_func=wrap_periodic):
time_size = int(time_size)<EOL>num_particles = self.num_particles<EOL>if total_emission:<EOL><INDENT>em = np.zeros(time_size, dtype=np.float32)<EOL><DEDENT>else:<EOL><INDENT>em = np.zeros((num_particles, time_size), dtype=np.float32)<EOL><DEDENT>POS = []<EOL>for i, sigma_1d in enumerate(self.sigma_1d):<EOL><INDENT>delta_pos = rs.normal(loc=<NUM_LIT:0>, scale=sigma_1d,<EOL>size=<NUM_LIT:3> * time_size)<EOL>delta_pos = delta_pos.reshape(<NUM_LIT:3>, time_size)<EOL>pos = np.cumsum(delta_pos, axis=-<NUM_LIT:1>, out=delta_pos)<EOL>pos += start_pos[i]<EOL>for coord in (<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:2>):<EOL><INDENT>pos[coord] = wrap_func(pos[coord], *self.box.b[coord])<EOL><DEDENT>Ro = sqrt(pos[<NUM_LIT:0>]**<NUM_LIT:2> + pos[<NUM_LIT:1>]**<NUM_LIT:2>)  <EOL>Z = pos[<NUM_LIT:2>]<EOL>current_em = self.psf.eval_xz(Ro, Z)**<NUM_LIT:2><EOL>if total_emission:<EOL><INDENT>em += current_em.astype(np.float32)<EOL><DEDENT>else:<EOL><INDENT>em[i] = current_em.astype(np.float32)<EOL><DEDENT>if save_pos:<EOL><INDENT>pos_save = np.vstack((Ro, Z)) if radial else pos<EOL>POS.append(pos_save[np.newaxis, :, :])<EOL><DEDENT>start_pos[i] = pos[:, -<NUM_LIT:1>:]<EOL><DEDENT>return POS, em<EOL>
Simulate (in-memory) `time_size` steps of trajectories.

        Simulate Brownian motion diffusion and emission of all the particles.
        Uses the attributes: num_particles, sigma_1d, box, psf.

        Arguments:
            time_size (int): number of time steps to be simulated.
            start_pos (array): shape (num_particles, 3), particles start
                positions. This array is modified to store the end position
                after this method is called.
            rs (RandomState): a `numpy.random.RandomState` object used
                to generate the random numbers.
            total_emission (bool): if True, store only the total emission array
                containing the sum of emission of all the particles.
            save_pos (bool): if True, save the particles 3D trajectories
            wrap_func (function): the function used to apply the boundary
                condition (use :func:`wrap_periodic` or :func:`wrap_mirror`).

        Returns:
            POS (list): list of 3D trajectories arrays (3 x time_size)
            em (array): array of emission (total or per-particle)