def flow(self, n, k, error=False, imaginary='<STR_LIT>'):
cnk = self.cumulant(n, k, error=error)<EOL>if error:<EOL><INDENT>cnk, cnk_err = cnk<EOL><DEDENT>vnk_to_k = self._cnk_prefactor[k] * cnk<EOL>kinv = <NUM_LIT:1>/k<EOL>if vnk_to_k >= <NUM_LIT:0>:<EOL><INDENT>vnk = vnk_to_k**kinv<EOL><DEDENT>else:<EOL><INDENT>if imaginary == '<STR_LIT>':<EOL><INDENT>vnk = -<NUM_LIT:1>*(-vnk_to_k)**kinv<EOL><DEDENT>elif imaginary == '<STR_LIT>':<EOL><INDENT>vnk = <NUM_LIT:0.><EOL><DEDENT>else:<EOL><INDENT>warnings.warn('<STR_LIT>', RuntimeWarning)<EOL>vnk = float('<STR_LIT>')<EOL><DEDENT><DEDENT>if k == <NUM_LIT:2> and error:<EOL><INDENT>return vnk, <NUM_LIT>/np.sqrt(abs(cnk)) * cnk_err<EOL><DEDENT>else:<EOL><INDENT>return vnk<EOL><DEDENT>
r"""
        Calculate `v_n\{k\}`,
        the estimate of flow coefficient `v_n` from the `k`-particle cumulant.

        :param int n: Anisotropy order.
        :param int k: Correlation order.

        :param bool error:
            Whether to calculate statistical error (for `v_n\{2\}` only).
            If true, return a tuple ``(vn2, vn2_error)``.

        :param str imaginary: (optional)
            Determines behavior when the computed flow is imaginary:

            - ``'nan'`` (default) -- Return NaN and raise a ``RuntimeWarning``.
            - ``'negative'`` -- Return the negative absolute value.
            - ``'zero'`` -- Return ``0.0``.