def _sim_timestamps(self, max_rate, bg_rate, emission, i_start, rs,<EOL>ip_start=<NUM_LIT:0>, scale=<NUM_LIT:10>, sort=True):
counts_chunk = sim_timetrace_bg(emission, max_rate, bg_rate,<EOL>self.t_step, rs=rs)<EOL>nrows = emission.shape[<NUM_LIT:0>]<EOL>if bg_rate is not None:<EOL><INDENT>nrows += <NUM_LIT:1><EOL><DEDENT>assert counts_chunk.shape == (nrows, emission.shape[<NUM_LIT:1>])<EOL>max_counts = counts_chunk.max()<EOL>if max_counts == <NUM_LIT:0>:<EOL><INDENT>return np.array([], dtype=np.int64), np.array([], dtype=np.int64)<EOL><DEDENT>time_start = i_start * scale<EOL>time_stop = time_start + counts_chunk.shape[<NUM_LIT:1>] * scale<EOL>ts_range = np.arange(time_start, time_stop, scale, dtype='<STR_LIT>')<EOL>times_chunk_p = []<EOL>par_index_chunk_p = []<EOL>for ip, counts_chunk_ip in enumerate(counts_chunk):<EOL><INDENT>times_c_ip = []<EOL>for v in range(<NUM_LIT:1>, max_counts + <NUM_LIT:1>):<EOL><INDENT>times_c_ip.append(ts_range[counts_chunk_ip >= v])<EOL><DEDENT>t = np.hstack(times_c_ip)<EOL>times_chunk_p.append(t)<EOL>par_index_chunk_p.append(np.full(t.size, ip + ip_start, dtype='<STR_LIT>'))<EOL><DEDENT>times_chunk = np.hstack(times_chunk_p)<EOL>par_index_chunk = np.hstack(par_index_chunk_p)<EOL>if sort:<EOL><INDENT>index_sort = times_chunk.argsort(kind='<STR_LIT>')<EOL>times_chunk = times_chunk[index_sort]<EOL>par_index_chunk = par_index_chunk[index_sort]<EOL><DEDENT>return times_chunk, par_index_chunk<EOL>
Simulate timestamps from emission trajectories.

        Uses attributes: `.t_step`.

        Returns:
            A tuple of two arrays: timestamps and particles.