OSKAR-demo
==========

# Introduction

The scripts in this directory compare the implementations of the spherical wave model for the element response in OSKAR and EveryBeam. The comparison is made per basefunction. One basefunction has two complex components.

# Usage
Comparison plots can be generated by giving the following command in the build directory

    make comparison

This will generate a series of image files named basefunction*.png in the \<builddir\>/demo/comparison-oskar directory. The number of basefunctions depends on $L$, the maximum order, and is given by  $N = 2(L+1)^2-2$.

The maximum order can be set by the environment variable MAX_ORDER, for example

    MAX_ORDER=3 make comparison-oskar

computes the basefunctions up to order 3, generating 30 image files.

The application of the 'transpose' can be activated by the APPLY_TRANSPOSE environment variable, for example

    APPLY_TRANSPOSE=ON MAX_ORDER=3 make comparison-oskar

This option was needed to make the results of OSKAR and EveryBeam the same.
With the fix of the 'transpose' issue the default value was changed from 'ON' to 'OFF.

The environment variable TOLERANCE makes the demo a test that fails if the difference between OSKAR and EveryBeam results is larger its value. For example

    TOLERANCE=1e-16 make comparison-oskar

fails, while

    TOLERANCE=1e-12 make comparison-oskar

succeeds.

This test is part of the 'integration' configuration of CTests. It will be run when the integration configuration is run with

    ctest -C integration



# Notes
The `read_oskar_beam.py` script tranforms the polarization vector from a X,Y coordinate system to a theta,phi coordinate system. It still needs to be verified that this transformation is the same as in OSKAR.
