Is the dimension of counts equal to 228? If so, we would want to do some broadcasting inside the math operations so that we take arrays with shape (228,1) and (1,7) to get a raw array of shape (228,7) which we then sum over the second axis so that the resulting vector is 228 long.
As for the energy error, it’s quite hard to diagnose this without access to your data as there are multiple potential causes. Would it be possible for you to define a list / Numpy array providing the data within the script itself? For example, you would write counts = np.asarray([10, 2, 5, ... ,]). This can be done relatively quickly if you print out the value of that variable and then copy/paste its string representation. It’s okay if it turns into a long file - you can just make a gist which I can copy and run locally.