示例#1
0
    def _op_approx_self(self,
                        waves: np.ndarray,
                        id: int,
                        corr_wave: Optional[np.ndarray] = None) -> np.ndarray:
        """The approximation of the operator of the
        self-steepening effect for the considered wave."""
        A = waves[id]
        res = np.zeros(A.shape, dtype=cst.NPFT)

        if (self.approx_type == cst.approx_type_1):
            res = FFT.dt_to_fft(A * np.conj(A) * A, self._omega, 1)
            if (corr_wave is None):
                corr_wave = waves[id]
            res[corr_wave == 0] = 0
            res = np.divide(res, corr_wave, out=res, where=corr_wave != 0)

        if (self.approx_type == cst.approx_type_2):

            res = (np.conj(A) * FFT.dt_to_fft(A, self._omega, 1) +
                   FFT.dt_to_fft(A * np.conj(A), self._omega, 1))

        if (self.approx_type == cst.approx_type_3):

            res = (2 * np.conj(A) * FFT.dt_to_fft(A, self._omega, 1) +
                   A * FFT.dt_to_fft(np.conj(A), self._omega, 1))

        return -1 * self._S[id] * res
示例#2
0
    def _op_approx_cross(self,
                         waves: np.ndarray,
                         id: int,
                         corr_wave: Optional[np.ndarray] = None) -> np.ndarray:
        """The approximation of the operator of the cross terms of the
        self-steepening effect."""
        A = waves[id]
        res = np.zeros(A.shape, dtype=cst.NPFT)

        if (corr_wave is None):
            corr_wave = waves[id]

        if (self.approx_type == cst.approx_type_1):
            for i in range(len(waves)):
                if (i != id):
                    res += waves[i] * np.conj(waves[i]) * A
            res = FFT.dt_to_fft(res, self._omega, 1)
            res[corr_wave == 0] = 0.
            res = np.divide(res, corr_wave, out=res, where=corr_wave != 0)

        if (self.approx_type == cst.approx_type_2
                or self.approx_type == cst.approx_type_3):
            for i in range(len(waves)):
                if (i != id):
                    res += waves[i] * np.conj(waves[i])
            res_ = np.zeros(A.shape, dtype=cst.NPFT)
            res_ = np.divide(res, corr_wave, out=res_, where=corr_wave != 0)
            res = (res_ * FFT.dt_to_fft(A, self._omega, 1) +
                   FFT.dt_to_fft(res, self._omega, 1))

        return -1 * self._S[id] * res
示例#3
0
    def op_approx_self(
            self,
            waves: Array[cst.NPFT],
            id: int,
            corr_wave: Optional[Array[cst.NPFT]] = None) -> Array[cst.NPFT]:
        """The approximation of the operator of the Raman effect for the
        considered wave."""
        A = waves[id]
        res = np.zeros(A.shape, dtype=cst.NPFT)

        if (self._approx_type == cst.approx_type_1
                or self._approx_type == cst.approx_type_2):

            res = FFT.dt_to_fft(A * np.conj(A), self._omega, 1)

        if (self._approx_type == cst.approx_type_3):

            res = (np.conj(A) * FFT.dt_to_fft(A, self._omega, 1) +
                   A * FFT.dt_to_fft(np.conj(A), self._omega, 1))

        return -1j * self._T_R * res
示例#4
0
    def op_approx_cross(
            self,
            waves: Array[cst.NPFT],
            id: int,
            corr_wave: Optional[Array[cst.NPFT]] = None) -> Array[cst.NPFT]:
        """The approximation operator of the cross terms of the Raman
        effect."""
        res = np.zeros(waves[id].shape, dtype=cst.NPFT)
        if (self._approx_type == cst.approx_type_1
                or self._approx_type == cst.approx_type_2
                or self._approx_type == cst.approx_type_3):
            for i in range(len(waves)):
                if (i != id):
                    res += waves[i] * np.conj(waves[i])
            res = FFT.dt_to_fft(res, self._omega, 1)

        return -1j * self._T_R * self._eta * res