In J_k_tensor the line: `if (P_window != None):` Needs to be changed to: `if (P_window is not None):` as Python no longer supports comparing arrays via !=