Skip to content
Snippets Groups Projects
Select Git revision
  • bd5a6964da4d8cf5a852d1a63e98bf50892bf4d1
  • 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

schedulingunitflow.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    OSKARElementResponse.cc 2.36 KiB
    #include "OSKARElementResponse.h"
    #include "oskar.h"
    #include "config.h"
    #include <iostream>
    
    namespace everybeam {
    
    void OSKARElementResponseDipole::response(
        double freq, double theta, double phi,
        std::complex<double> (&response)[2][2]) const {
      double dipole_length_m = 1;  // TODO
      std::complex<double>* response_ptr = (std::complex<double>*)response;
    
      double phi_x = phi;
      double phi_y = phi + M_PI_2;
      oskar_evaluate_dipole_pattern_double(1, &theta, &phi_x, freq, dipole_length_m,
                                           response_ptr);
      oskar_evaluate_dipole_pattern_double(1, &theta, &phi_y, freq, dipole_length_m,
                                           response_ptr + 2);
    }
    
    OSKARElementResponseSphericalWave::OSKARElementResponseSphericalWave() {
      std::string path = get_path("oskar.h5");
      m_datafile.reset(new Datafile(path));
    }
    
    OSKARElementResponseSphericalWave::OSKARElementResponseSphericalWave(
        const std::string& path) {
      m_datafile.reset(new Datafile(path));
    }
    
    void OSKARElementResponseSphericalWave::response(
        double freq, double theta, double phi,
        std::complex<double> (&response)[2][2]) const {
      // This ElementResponse model is element specific, so an element_id is
      // required to know for what element the response needs to be evaluated A
      // std::invalid_argument exception is thrown although strictly speaking it are
      // not the given arguments that are invalid, but the response(...) method with
      // a different signature should have been called.
      throw std::invalid_argument(
          "OSKARElementResponseSphericalWave: missing argument element_id");
    }
    
    void OSKARElementResponseSphericalWave::response(
        int element_id, double freq, double theta, double phi,
        std::complex<double> (&response)[2][2]) const {
      auto dataset = m_datafile->get(freq);
      auto l_max = dataset->get_l_max();
    
      std::complex<double>* response_ptr = (std::complex<double>*)response;
      std::complex<double>* alpha_ptr = dataset->get_alpha_ptr(element_id);
    
      double phi_x = phi;
      double phi_y = phi + M_PI_2;
      oskar_evaluate_spherical_wave_sum_double(1, &theta, &phi_x, &phi_y, l_max,
                                               alpha_ptr, response_ptr);
    }
    
    std::string OSKARElementResponseSphericalWave::get_path(
        const char* filename) const {
      std::stringstream ss;
      ss << EVERYBEAM_DATA_DIR << "/";
      ss << filename;
      return ss.str();
    }
    
    }  // namespace everybeam