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

Run.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    make_element_response_image.cpp 1.06 KiB
    #include <cmath>
    #include <iostream>
    #include <cstdlib>
    
    #include <oskarelementresponse.h>
    
    #include "../../external/npy.hpp"   // to save arrays in numpy format
    
    int main(int argc, char** argv){
    // int main() {
        everybeam::OSKARElementResponseSphericalWave element_response("oskar.h5");
        double freq = 50e6;
    
        int N;
        if (argc == 1){
            N = 256;
        }
        else{
            N = atoi(argv[1]);
        }
    
        std::vector<std::complex<double>> result(N*N*2*2);
        typedef std::complex<double>result_arr_t[N][N][2][2];
        result_arr_t &result_arr = * (result_arr_t*) result.data();
    
        for(int i=0; i<N; ++i) {
            double x = (2.0*i)/(N-1) - 1.0;
            for(int j=0; j<N; ++j) {
                double y = (2.0*j)/(N-1) - 1.0;
                double theta = asin(sqrt(x*x + y*y));
                double phi = atan2(y,x);
                element_response.Response(0, freq, theta, phi, result_arr[i][j]);
            }
        }
    
        const long unsigned leshape [] = {(long unsigned int) N, (long unsigned int) N, 2, 2};
        npy::SaveArrayAsNumpy("response.npy", false, 4, leshape, result);
    }