eadf: representation of far-field antenna responses in Python

Understanding and analysis of antennas is crucial for the development of modern telecommunication technologies, like 5G or massive MIMO. Research in this area has the need for software to measure, analyze and test antenna systems. For instance, one needs a convenient way to transform large amounts of antenna measurement data into a concise representation. The herein described eadf package aims at providing this functionality. On top of that, it offers routines to interpolate the beam-pattern of an antenna as well as compressing it in spatial frequency domain. As such, it can be used for the development of high resolution parameter estimation algorithms and analysis of antenna beam-patterns. In summary, the package provides a flexible and extensible framework for dealing with


Motivation and significance
Antenna engineering plays a vital role in the application and advancement of telecommunications technologies. Several key areas of research and development like 5G, Massive MIMO, and radar benefit from antenna modeling and array signal processing techniques [1][2][3][4].
For the reliable application of antenna arrays in practical scenarios, one must account for the electromagnetic properties of the array in the form of its beam-pattern. The beam-pattern describes the complex and frequency-dependent radiation pattern in the far-field as a function of direction typically defined using the spherical coordinates (azimuth and co-elevation angles) [5]. The beam-pattern is dependent on polarization and frequency of the radiated electromagnetic wave. Although in principle the beam-pattern can be calculated using the solutions to Maxwell's equations [6], analytical expressions for describing the beam-pattern for every antenna design are usually not attainable. Hence, numerical simulations based on antenna models or even actual beam-pattern measurements are required for understanding the characteristics of an antenna system [6]. The precision of these simulations in depicting the antenna design depends on the accuracy of the simulated model, knowledge about the simulated materials, considerations of the radio environment, and so forth.
A concise representation of the beam-pattern is necessary for applications like high-performance antenna design, radio channel modeling [7] and high-resolution parameter estimation [8] these applications one of the most important necessities is to be able to efficiently interpolate the beam-pattern at an arbitrary angular point, i.e. it is usually sampled or simulated for a discrete set of incident angles. Thus, we need to retrieve a continuous description of the so-called array manifold and its derivatives. For instance, using the latter, performance analysis based on metrics like the Cramèr-Rao Lower Bound (CRLB) [9,10] becomes possible, which allows us to quantify the minimum variance of an unbiased estimator based on an antenna array. Moreover, derivatives of the beam-pattern enable the implementation of gradient-based parameter estimation techniques, which usually represent an estimator that can be evaluated utilizing the CRLB.
To these ends, a robust framework for the effective generation, representation, and modification of the frequency-dependent polarimetric antenna beam-pattern referred to as the Effective Aperture Distribution Function (EADF) [11,Section 4.3.3], [12,13] is indispensable. The herein described Python-based eadf package provides the necessary means to handle antenna beam-patterns which are measured, simulated, or can be described using existing analytical expressions, to tackle the above-mentioned tasks.

Software description
As a starting point, we introduce the so called polarimetric array manifold function a being defined as which models the response of an antenna array to a plane wave impinging from the direction (θ , ϕ). The response is obtained over 2 × N port outputs, accounting for the two polarizations (horizontal and vertical) and the number of ports N port . Here, θ and ϕ denotes the co-elevation and azimuthal angles of the spherical coordinate system respectively. While, f denotes the frequency of the impinging wave. Additionally R + denotes the non-negative real numbers and C denotes complex numbers. It can be shown that the function a suffices to describe the antenna response to a plane wave. One can usually attain samples of a in the form, where ∆ θ = π/N coele , ∆ ϕ = 2π /N azim and 0 ⩽ i < N coele , 0 ⩽ j < N azim , 0 ⩽ k < N freq . Since, we wish to calculate a Discrete Fourier Transform (DFT) along the two angles as described below, we assume a uniform sampling in the 2D angular grid, but not in the excitation frequency dimension. So formally, the complete antenna array response is represented by means of a multi-dimensional array A ∈ C N coele ×N azim ×N freq ×2×Nport .
As physics dictates, the function a is naturally periodic in its second argument ϕ. If we extend a to a functionâ : [0, π) × [0, 2π ) × R + → C 2×Nport , which is also periodic in θ it reads as, The domain ofâ covers the sphere twice, however, for θ > π the polarization of the impinging waves has to be altered, hence the minus (−) sign and we have to move to the right corresponding point on the original sphere, hence the ϕ + π. This naturally extends the sampled data A to its periodified version A ∈ C 2·N coele −1×N azim ×N freq ×2×Nport , such that it is periodic in its first two dimensions. For a given excitation frequency, polarization, and antenna port, if we consider a 2D slice S k,ℓ,m =Â ·,·,k,ℓ,m ∈ C 2·N coele −1×N azim , we can apply a 2D DFT to it to obtain T k,ℓ,m ∈ C 2·N coele −1×N azim , which we call the effective aperture distribution function of the antenna's beam-pattern. The remarkable property of T k,ℓ,m now is that if N coele and N azim have been chosen large enough, we can apply the continuous 2D inverse DFT, such that, where the two vectors µ θ and µ ϕ are defined as, This means that we have derived an interpolation of the complete beam-pattern for arbitrary angles just by utilizing the finite number of elements in S k,ℓ,m or T k,ℓ,m , and thus have derived an analytical description of the antenna's far-field beam-pattern. Examples for both S k,ℓ,m and T k,ℓ,m taken from measurement data can be found in Fig. 1. This analytical representation has several advantages and applications. For instance, it allows us to calculate the derivatives of the beam-pattern with respect to the angles via Naturally, one can also compute higher order derivatives or mixed derivatives.
In summary, the EADF enables us to interpolate the beampattern and its derivatives. The herein described eadf package provides the capability to exploit the above-described theoretical findings and the associated preprocessing routines in an accessible, convenient yet computationally efficient framework.

Software architecture
The whole architecture of the package revolves around the EADF class, where each instance represents an antenna array.
It handles the necessary preprocessing of the input data A and allows to specify some metadata aboutÂ, like the sampled coelevation and azimuth angles, the sampled frequencies f k , and the number of antenna array elements. This EADF object can be completely initialized with the data A and minimal metadata. As such, it also provides the routines to evaluate the beampattern and its derivatives using the functions EADF.pattern, EADF.gradient for first-order derivatives and EADF.hessian for all second-order derivatives, see Section 3 for details. For easy interfacing with other antenna modeling software (e.g. HFSS), various measurement systems (e.g. our research group's internal system), or just another computing language (e.g. Matlab), we collect different importers in the importers sub-module. Since the EADF object is simple to initialize, it is also very easy to write importers that convert given data to the format of the data array A. However, we also provide some theory-based importers. A non-trivial case for an importer occurs if the angles were not sampled on a uniform and thus full grid. This can easily happen because of mechanical constraints during the beam-pattern measurement of an antenna array. For this, we enable to approximate the non-uniformly sampled data by the so-called spherical harmonic functions, which then can be interpolated on the necessary uniform angular grid points.
Since our goal, among others, is to use the EADF object for high-resolution parameter estimators, it is of high priority to fully utilize available hardware. In some cases, the acquired measurement data has such a low dynamic range that calculations in single precision are sufficient since the accuracy is not limited by the datatype, but the data itself. In these cases, substantial speedups can be attained without sacrificing estimation accuracy.
To this end, the EADF_DTYPE shell environment variable allows the choice between single or double floating-point precision.
Additionally, there are routines to generate the data array A for synthetic antenna arrays in the arrays sub-module, all of which produce an EADF object. The preprocessing routines, including periodification and DFT, are in a dedicated preprocess module.

Software functionalities
The architecture described above was designed with several goals for the functionality of the package. First, it is simple to import various kinds of measurement and simulation data that describe an antenna array with the provided importers. Second, the package allows to efficiently interpolate the complex polarimetric beam-pattern of an arbitrary antenna array from a finite number of samples. As such this represents the main feature of the package. This analytical representation also allows to calculate higher order derivatives of the beam-pattern.
Actually the transformation from S k,ℓ,m to T k,ℓ,m represents a form of compression, since usually the energy in T k,ℓ,m is concentrated in a few entries. So, by removing rows or columns of the matrix T k,ℓ,m in Eq. (3) with little or no signal energy one can achieve a form of de-noising of the beam-pattern, which also directly decreases the computational cost of the interpolation as well as the required storage for the fully preprocessed representation of the beam-pattern. This can be achieved by setting EADF.compressionFactor to some number 0 < ρ ⩽ 1. If used in an high-resolution parameter estimator this can yield substantial runtime improvements.
Lastly, we provide routines to generate representations for idealized arrays, where each antenna element is either a dipole or a rectangular patch antenna. In both cases one can calculate the polarimetric and frequency dependent array response analytically. For instance, one can create an array where the elements are placed on a line with constant distance --a so called Uniform Linear Array (ULA, eadf.generateULA), or a Uniform Circular Array (UCA, eadf.generateUCA), where elements are placed at uniform distance on a circle of given radius.

Sample code snippets analysis
The code in Listing 1 demonstrates how one can create a ULA based on the far-field pattern of a rectangular patch [6, neglecting coupling effects between the elements, set its compression factor and then sample the pattern on a uniform 30 × 60, co-elevation × azimuth angular grid.

Illustrative examples
The determination of the angle of arrival (AoA) of an electromagnetic wave is of importance for many present research topics related to wave propagation. For example, channel sounding measurement (see Fig. 2) is used to characterize the mobile radio channel for planning the distribution of new mobile base stations. Also, more and more radar applications use direction finding approaches to localize obstacles, e.g. in the automotive industry.
As described earlier, the EADF enables us to interpolate the beam-pattern of an antenna system for a wave impinging from a given angular point. Given this analytical representation of the antenna array, it is also possible to estimate the AoA of the impinging wave based on the data received by the antenna array.
A common approach for the parameter estimation is to design a maximum-likelihood estimator, e.g. for i.i.d. Gaussian noise the estimator maximizes the log-likelihood function, (4) with respect to the desired parameters [θ, ϕ] ∈ R 2×1 . The measured data x ∈ C Nport is affected by additive noise of variance σ 2 .
The gradient ascent algorithm is a popular way for finding the maximum of a differentiable function. To find a local maximum of a function using gradient ascent, we take steps proportional to the gradient of the function at the current point. To ensure reaching the global maximum, a starting point close to the maximum is necessary, since the log-likelihood is usually non-convex and just locally convex around the global maximum. The iterative update of the parameters is obtained as, where ε > 0 is a step size and J L ([θ , ϕ] k ) ∈ C N port×2 denote the first-order derivatives of the log-likelihood function ] .
Now, calculating the first-order derivative of the log-likelihood function with respect to θ we get,

Listing 2: Simplified gradient iteration
One can refine this idea, such that, instead of maximizing the log-likelihood function, one searches for a zero over the derivative of the function. Starting with a rough initial estimate of the actual AoA this task is suitable for using an iterative gradientbased optimization approach, e.g. the Newton's method. Based on the initial estimate of the parameters [θ , ϕ] 0 , the updated parameters are obtained as The matrix with the second-order derivatives of the likelihoodfunction H L ([θ , ϕ]) ∈ C N port×2 is calculated as a further derivative of J L ([θ , ϕ]), which also depends on the second-order derivatives of the beam-pattern.
As described in Section 2, the EADF-package provides functionality for the calculation of derivatives of the beam-pattern. A gradient-based optimization technique can be easily implemented as shown in simplified Pseudo-Code in Listing 2 for the first-order derivative case.
As an example, we created some data representing a wave impinging an 32-port antenna array from Θ = 87 • and ϕ = 25 • angles. Starting with some initial estimates of the angles near the simulated ones, Newton's method yields the correct estimation of the angles after considerably few iterations. Fig. 3 shows the evolution of the estimation process over 10 iterations.

Research questions
The analytical representation of an antenna array allows us to directly quantify its performance through simulation of the estimation process as sketched out in Section 3 or by directly studying the CRLB in various settings. Not only is it possible to evaluate the properties of a particular antenna array, but it is also possible to directly compare different arrays with each other. This can also greatly facilitate the design process of antenna measurement systems that are composed of one or more antenna arrays.
Finally, the fact that the EADF object can represent the beampattern for a large band of operating frequencies, it is possible to develop high-resolution parameter estimation routines, which can operate on measurement data covering a wide frequency range.
The packages routines can directly be used in high-resolution parameter estimation routines [14][15][16], where one has to account for the beam-pattern of the involved antennas, while also allowing for high computation speed and high dimensional data to be handled. This will allow treating (for instance) channel estimation problems where data is sampled at increasingly higher rates, higher bandwidths, and with larger arrays. In channel estimation the beam-pattern models the influence of the antenna to the whole channel impulse response. For instance in a double directional model [17] the channel can be described as such that the functions a RX and a TX describe, the receive and transmit antennas contribution to the channel impulse response. Additionally, the initial phase of data acquisition through a measurement system is greatly facilitated by the fact that there is no need to directly sample on the full uniform grid, but we rather offer methods to circumvent this by estimating missing values optimally in a least-squares sense. This can speed up certain measurement processes tremendously.

Daily practice of the users
The primary user base currently consists of scientists at our research lab that work on different topics associated with antenna engineering. For instance, when designing new antenna arrays that operate over a certain frequency band, one must study the associated complex impulse response of the array. Another example is antenna beam-pattern measurements which allow us to characterize the beam-pattern of a manufactured array in practical scenarios that can be validated through an evaluation routine that utilizes the EADF representation.
Additionally, for over-the-air testing [18,19] via the radiated two-stage method of some device under test (DUT), one has to embed the antenna array of the DUT into the calculations, which is carried out by this package.
Finally, we have researchers who are developing highresolution parameter estimation routines. These are applied to a wide range of measurement data, acquired by the different antenna arrays, with high dimensional parameter spaces and large amounts of data. To this end, the package provides a simple interface to easily incorporate the antennas in the algorithms as well as in the analysis of their performance.

Conclusions
In addition to the described functionality, the package allows the interpolation of the input data along the frequency dimension via splines, thereby introducing a comprehensive framework for the analysis of modern antenna arrays. It provides the necessary tools to interpolate arbitrary complex vector-valued functions on a sphere, allowing its application to problems beyond the scope of antennas and wave propagation. Future versions of the package will provide features like the capability to rotate the beam-pattern along a designated axis by using vector spherical harmonics [20].
In summary, the eadf package has provided extensive utilization for antenna array signal processing applications. We illustrated how the concise representation of the antenna beampattern is a central building block in developing high-resolution parameter estimation algorithms and outlined how it can help researchers involved in topics with antennas.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.