def sim_timetrace_bg2(emission, max_rate, bg_rate, t_step, rs=None):
if rs is None:<EOL><INDENT>rs = np.random.RandomState()<EOL><DEDENT>emiss_bin_rate = np.zeros((emission.shape[<NUM_LIT:0>] + <NUM_LIT:1>, emission.shape[<NUM_LIT:1>]),<EOL>dtype='<STR_LIT>')<EOL>emiss_bin_rate[:-<NUM_LIT:1>] = emission * max_rate * t_step<EOL>if bg_rate is not None:<EOL><INDENT>emiss_bin_rate[-<NUM_LIT:1>] = bg_rate * t_step<EOL>counts = rs.poisson(lam=emiss_bin_rate).astype('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>counts = rs.poisson(lam=emiss_bin_rate[:-<NUM_LIT:1>]).astype('<STR_LIT>')<EOL><DEDENT>return counts<EOL>
Draw random emitted photons from r.v. ~ Poisson(emission_rates).

    This is an alternative implementation of :func:`sim_timetrace_bg`.