def ecc(self, n):
ny, nx = self._profile.shape<EOL>xmax, ymax = self._xymax<EOL>xcm, ycm = self._cm<EOL>Y, X = np.mgrid[ymax:-ymax:<NUM_LIT>*ny, -xmax:xmax:<NUM_LIT>*nx]<EOL>X -= xcm<EOL>Y -= ycm<EOL>Rsq = X*X + Y*Y<EOL>if n == <NUM_LIT:1>:<EOL><INDENT>W = np.sqrt(Rsq, out=Rsq)<EOL><DEDENT>elif n == <NUM_LIT:2>:<EOL><INDENT>W = Rsq<EOL><DEDENT>else:<EOL><INDENT>if n & <NUM_LIT:1>:  <EOL><INDENT>W = np.sqrt(Rsq)<EOL><DEDENT>else:  <EOL><INDENT>W = np.copy(Rsq)<EOL><DEDENT>for _ in range(int((n-<NUM_LIT:1>)/<NUM_LIT:2>)):<EOL><INDENT>W *= Rsq<EOL><DEDENT><DEDENT>W *= self._profile<EOL>i_n_phi = np.zeros_like(X, dtype=complex)<EOL>np.arctan2(Y, X, out=i_n_phi.imag)<EOL>i_n_phi.imag *= n<EOL>exp_phi = np.exp(i_n_phi, out=i_n_phi)<EOL>exp_phi *= W<EOL>return abs(exp_phi.sum()) / W.sum()<EOL>
r"""
        Calculate eccentricity harmonic `\varepsilon_n`.

        :param int n: Eccentricity order.