Minor stylistic nit-picking: np.abs(phi_alpha1) > 1e100) will always be true if np.isinf(phi_alpha1). Though stating both might be more explicit and readable...
Minor stylistic nit-picking: `np.abs(phi_alpha1) > 1e100)` will always be true if `np.isinf(phi_alpha1)`. Though stating both might be more explicit and readable...