<span class="o">=</span> <span class="n">miss</span><span class="o">.</span><span class="n">ne</span><span class="p">(</span><span class="n">miss</span><span class="o">.</span><span class="n">shift</span><span class="p">())</span><span class="o">.</span><span class="n">cumsum</span><span class="p">()</span>

        <span class="c1"># identify beginning (min time) of each state</span>
        <span class="n">count</span> <span class="o">=</span> <span class="n">s</span><span class="o">.</span><span class="n