Shape Parameter for Multiple Treatment Groups

You could change that to

idx = np.arange(n_count_data)[:, None]

This should allow the condition in the switch to broadcast well, and the indexing you do here:

should still work.