Skip to content
Snippets Groups Projects
Select Git revision
  • 47ef924c404403c83fb3544846cc99f6b4cd8172
  • master default protected
  • L2SS-1914-fix_job_dispatch
  • TMSS-3170
  • TMSS-3167
  • TMSS-3161
  • TMSS-3158-Front-End-Only-Allow-Changing-Again
  • TMSS-3133
  • TMSS-3319-Fix-Templates
  • test-fix-deploy
  • TMSS-3134
  • TMSS-2872
  • defer-state
  • add-custom-monitoring-points
  • TMSS-3101-Front-End-Only
  • TMSS-984-choices
  • SDC-1400-Front-End-Only
  • TMSS-3079-PII
  • TMSS-2936
  • check-for-max-244-subbands
  • TMSS-2927---Front-End-Only-PXII
  • Before-Remove-TMSS
  • LOFAR-Release-4_4_318 protected
  • LOFAR-Release-4_4_317 protected
  • LOFAR-Release-4_4_316 protected
  • LOFAR-Release-4_4_315 protected
  • LOFAR-Release-4_4_314 protected
  • LOFAR-Release-4_4_313 protected
  • LOFAR-Release-4_4_312 protected
  • LOFAR-Release-4_4_311 protected
  • LOFAR-Release-4_4_310 protected
  • LOFAR-Release-4_4_309 protected
  • LOFAR-Release-4_4_308 protected
  • LOFAR-Release-4_4_307 protected
  • LOFAR-Release-4_4_306 protected
  • LOFAR-Release-4_4_304 protected
  • LOFAR-Release-4_4_303 protected
  • LOFAR-Release-4_4_302 protected
  • LOFAR-Release-4_4_301 protected
  • LOFAR-Release-4_4_300 protected
  • LOFAR-Release-4_4_299 protected
41 results

t_tmssapp_specification_REST_API.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    fftresampler.h 2.45 KiB
    #ifndef EVERYBEAM_COMMON_FFT_RESAMPLE_H_
    #define EVERYBEAM_COMMON_FFT_RESAMPLE_H_
    
    #include <aocommon/windowfunction.h>
    #include <aocommon/uvector.h>
    
    #include <vector>
    #include <thread>
    
    #include <fftw3.h>
    
    namespace everybeam {
    namespace common {
    
    /**
     * @brief FFT resampling from (coarse) input grid to (high resolution) output
     * grid
     *
     */
    class FFTResampler {
     private:
      struct Task {
        float *input, *output;
      };
    
     public:
      /**
       * @brief Construct a new FFTResampler object
       *
       * @param width_in input image width (int)
       * @param height_in input image height (int)
       * @param width_out output image width (int)
       * @param height_out output image height (int)
       */
      FFTResampler(size_t width_in, size_t height_in, size_t width_out,
                   size_t height_out);
    
      ~FFTResampler();
    
      /**
       * @brief Do the FFT resampling
       *
       * @param input Input image buffer
       * @param output Output image buffer
       */
      void Resample(float* input, float* output) {
        Task task;
        task.input = input;
        task.output = output;
        RunSingle(task, false);
      }
    
      /**
       * Only to be used with SingleFT (it makes resampling thread unsafe!)
       */
      void SetTukeyWindow(double inset_size, bool correct_window) {
        window_function_ = aocommon::WindowFunction::Tukey;
        tukey_inset_size_ = inset_size;
        correct_window_ = correct_window;
        window_row_in_.clear();
        window_col_in_.clear();
        window_out_.clear();
      }
    
      void SetWindowFunction(aocommon::WindowFunction::Type window,
                             bool correct_window) {
        window_function_ = window;
        correct_window_ = correct_window;
        window_row_in_.clear();
        window_col_in_.clear();
        window_out_.clear();
      }
    
     private:
      void RunSingle(const Task& task, bool skip_window) const;
      void ApplyWindow(float* data) const;
      void UnapplyWindow(float* data) const;
      void MakeWindow(aocommon::UVector<float>& data, size_t width) const;
      void MakeTukeyWindow(aocommon::UVector<float>& data, size_t width) const;
    
      size_t width_in_, height_in_;
      size_t width_out_, height_out_;
      size_t fft_width_, fft_height_;
      aocommon::WindowFunction::Type window_function_;
      double tukey_inset_size_;
      mutable aocommon::UVector<float> window_row_in_;
      mutable aocommon::UVector<float> window_col_in_;
      mutable aocommon::UVector<float> window_out_;
      bool correct_window_;
    
      fftwf_plan in_to_f_plan_, f_to_out_plan_;
    };
    }  // namespace common
    }  // namespace everybeam
    #endif  // EVERYBEAM_COMMON_FFT_RESAMPLE_H_