def fit_transform(self, X, y=None):
        """Learn and return the Fourier coeeficients to keep.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Training vector, where n_samples in the number of samples and
            n_features is the number of features.

        y : None or array-like, shape = (n_samples,) (default = None)
            Class labels for each data sample.

        Returns
        -------
        X_new : array, shape (n_samples, n_coefs)
            The selected Fourier coefficients for each sample.

        """
        if self.anova:
            X, y = check_X_y(X, y, dtype='float64')
        else:
            X = check_array(X, dtype='float64')
        n_samples, n_timestamps = X.shape
        n_coefs = self._check_params(n_timestamps)

        scaler = StandardScaler(self.norm_mean, self.norm_std)
        X = scaler.fit_transform(X)
        X_fft = np.fft.rfft(X)
        X_fft = np.vstack([np.real(X_fft), np.imag(X_fft)])
        if n_timestamps % 2 == 0:
            X_fft = X_fft.reshape(n_samples, n_timestamps + 2, order='F')
            X_fft = np.c_[X_fft[:, 0], X_fft[:, 2:-1]]
        else:
            X_fft = X_fft.reshape(n_samples, n_timestamps + 1, order='F')
            X_fft = np.c_[X_fft[:, 0], X_fft[:, 2:]]
        if self.drop_sum:
            X_fft = X_fft[:, 1:]
        if self.anova:
            self.support_ = self._anova(X_fft, y, n_coefs, n_timestamps)
        else:
            self.support_ = np.arange(n_coefs)
        return X_fft[:, self.support_]
Learn and return the Fourier coeeficients to keep.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Training vector, where n_samples in the number of samples and
            n_features is the number of features.

        y : None or array-like, shape = (n_samples,) (default = None)
            Class labels for each data sample.

        Returns
        -------
        X_new : array, shape (n_samples, n_coefs)
            The selected Fourier coefficients for each sample.

        
pyts/approximation/dft.py