Skip to content
Snippets Groups Projects
Select Git revision
  • 114716d91adf72189a1e3d80d848890dfbbf181f
  • MCCS-163 default
  • main
  • sar-277-update-docs-with-examples-for-lrc
  • st-946-automate
  • sar_302-log-fix
  • sar-287_subarray_commands_to_lrc
  • sar_302-POC_await_sub_device_state
  • sat_302_fix_pipelines
  • sar-286_lrc_one_subarry_command
  • sar-286_lrc_improvements
  • sar-288-async-controller
  • sar-276-combine-tango-queue
  • sar-255_remove_nexus_reference
  • sar-275-add-LRC
  • sar-273-add-lrc-attributes
  • sar-272
  • sp-1106-marvin-1230525148-ska-tango-base
  • sp-1106-marvin-813091765-ska-tango-base
  • sar-255/Publish-package-to-CAR
  • mccs-661-device-under-test-fixture
  • mccs-659-pep257-docstring-linting
  • 0.11.3
  • 0.11.2
  • 0.11.1
  • 0.11.0
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.1
  • 0.8.0
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.6
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
  • 0.6.1
  • 0.6.0
42 results

reference_base_device.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);
    }