def simulate_timestamps_mix(self, max_rates, populations, bg_rate,<EOL>rs=None, seed=<NUM_LIT:1>, chunksize=<NUM_LIT:2>**<NUM_LIT:16>,<EOL>comp_filter=None, overwrite=False,<EOL>skip_existing=False, scale=<NUM_LIT:10>,<EOL>path=None, t_chunksize=None, timeslice=None):
self.open_store_timestamp(chunksize=chunksize, path=path)<EOL>rs = self._get_group_randomstate(rs, seed, self.ts_group)<EOL>if t_chunksize is None:<EOL><INDENT>t_chunksize = self.emission.chunkshape[<NUM_LIT:1>]<EOL><DEDENT>timeslice_size = self.n_samples<EOL>if timeslice is not None:<EOL><INDENT>timeslice_size = timeslice // self.t_step<EOL><DEDENT>name = self._get_ts_name_mix(max_rates, populations, bg_rate, rs=rs)<EOL>kw = dict(name=name, clk_p=self.t_step / scale,<EOL>max_rates=max_rates, bg_rate=bg_rate, populations=populations,<EOL>num_particles=self.num_particles,<EOL>bg_particle=self.num_particles,<EOL>overwrite=overwrite, chunksize=chunksize)<EOL>if comp_filter is not None:<EOL><INDENT>kw.update(comp_filter=comp_filter)<EOL><DEDENT>try:<EOL><INDENT>self._timestamps, self._tparticles = (self.ts_store<EOL>.add_timestamps(**kw))<EOL><DEDENT>except ExistingArrayError as e:<EOL><INDENT>if skip_existing:<EOL><INDENT>print('<STR_LIT>')<EOL>return<EOL><DEDENT>else:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT>self.ts_group._v_attrs['<STR_LIT>'] = rs.get_state()<EOL>self._timestamps.attrs['<STR_LIT>'] = rs.get_state()<EOL>self._timestamps.attrs['<STR_LIT>'] = __version__<EOL>ts_list, part_list = [], []<EOL>bg_rates = [None] * (len(max_rates) - <NUM_LIT:1>) + [bg_rate]<EOL>prev_time = <NUM_LIT:0><EOL>for i_start, i_end in iter_chunk_index(timeslice_size, t_chunksize):<EOL><INDENT>curr_time = np.around(i_start * self.t_step, decimals=<NUM_LIT:0>)<EOL>if curr_time > prev_time:<EOL><INDENT>print('<STR_LIT>' % curr_time, end='<STR_LIT>', flush=True)<EOL>prev_time = curr_time<EOL><DEDENT>em_chunk = self.emission[:, i_start:i_end]<EOL>times_chunk_s, par_index_chunk_s =self._sim_timestamps_populations(<EOL>em_chunk, max_rates, populations, bg_rates, i_start,<EOL>rs, scale)<EOL>ts_list.append(times_chunk_s)<EOL>part_list.append(par_index_chunk_s)<EOL><DEDENT>for ts, part in zip(ts_list, part_list):<EOL><INDENT>self._timestamps.append(ts)<EOL>self._tparticles.append(part)<EOL><DEDENT>self.ts_group._v_attrs['<STR_LIT>'] = rs.get_state()<EOL>self._timestamps.attrs['<STR_LIT>'] = rs.get_state()<EOL>self.ts_store.h5file.flush()<EOL>
Compute one timestamps array for a mixture of N populations.

        Timestamp data are saved to disk and accessible as pytables arrays in
        `._timestamps` and `._tparticles`.
        The background generated timestamps are assigned a
        conventional particle number (last particle index + 1).

        Arguments:
            max_rates (list): list of the peak max emission rate for each
                population.
            populations (list of slices): slices to `self.particles`
                defining each population.
            bg_rate (float, cps): rate for a Poisson background process
            rs (RandomState object): random state object used as random number
                generator. If None, use a random state initialized from seed.
            seed (uint): when `rs` is None, `seed` is used to initialize the
                random state, otherwise is ignored.
            chunksize (int): chunk size used for the on-disk timestamp array
            comp_filter (tables.Filter or None): compression filter to use
                for the on-disk `timestamps` and `tparticles` arrays.
                If None use default compression.
            overwrite (bool): if True, overwrite any pre-existing timestamps
                array. If False, never overwrite. The outcome of simulating an
                existing array is controlled by `skip_existing` flag.
            skip_existing (bool): if True, skip simulation if the same
                timestamps array is already present.
            scale (int): `self.t_step` is multiplied by `scale` to obtain the
                timestamps units in seconds.
            path (string): folder where to save the data.
            timeslice (float or None): timestamps are simulated until
                `timeslice` seconds. If None, simulate until `self.t_max`.