EADF Main Module¶
This class is the central object where everything else is centered around. It has convenient methods and properties to handle:
- Fourier interpolation along Co-Elevation and Azimuth of the provided measurement data, see
eadf.eadf.EADF.pattern,- Fourier interpolation of the measurement data’s first and second order derivatives, see
eadf.eadf.EADF.gradientandeadf.eadf.EADF.hessian,- Spline interpolation along excitation frequency of the provided measurement data, see
eadf.eadf.EADF.operatingFrequencies,- reduction of the coefficients used for the Fourier interpolation to allow denoising and/or faster computations, see
eadf.eadf.EADF.blockSizeandeadf.eadf.EADF.optimizeBlockSize,- convenient definition of stationary subbands via
eadf.eadf.EADF.defineSubBandsandeadf.eadf.EADF.subBandIntervals,- execution control of the calculations with respect to used datatypes, lower memory consumption and the used computation device, see
eadf.backendand- easy storage and loading from disk, see
eadf.eadf.EADF.saveandeadf.eadf.EADF.load.
EADF.__init__(arrData: numpy.ndarray, arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray, arrFreq: numpy.ndarray, arrPos: numpy.ndarray, **options) → None¶Initialize an EADF Object
Here we assume that the input data is given in the internal data format already. If you have antenna data, which is not in the internat data format, we advice you to use one of the importers, or implement your own.
In direction of co-elevation, we assume that both the north and the south pole were sampled, where the first sample represents the north pole and the last one the south pole. So arrCoEle must run from 0 to pi. In azimuth direction, we truncate the last sample, if we detect in arrAzi that both the first and last sample match. Both arrays have to contain values that are evenly spaced and ascending in value.
Parameters:
- arrData (np.ndarray) – Co-Ele x Azi x Freq x Pol x Element
- arrCoEle (np.ndarray) – Co-elevation sampling positions in radians, both poles should be sampled
- arrAzi (np.ndarray) – Azimuth sampling positions in radians.
- arrFreq (np.ndarray) – Frequencies sampled at.
- arrPos (np.ndarray) – (3 x numElements) Positions of the single antenna elements. this is just for vizualisation purposes.
-
class
eadf.eadf.EADF(arrData: numpy.ndarray, arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray, arrFreq: numpy.ndarray, arrPos: numpy.ndarray, **options)¶ Bases:
object-
_calcActiveSubBands() → numpy.ndarray¶
-
_calcSubBandAssignment() → numpy.ndarray¶ Assing operating frequencies to their stationary subbands
This function iterates through the currently set operating frequencies and assigns them to the respective subband, just by simple search for the right interval. This way we can avoid calculating the antenna response several times for a single stationary subband.
Returns: Indexing array. Return type: np.ndarray
-
_eval(arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray, funCall) → numpy.ndarray¶ Unified Evaluation Function
This function allows to calculate the Hessian, Jacobian and the values themselves with respect to the parameters angle and frequency.
Parameters: - arrCoEle (np.ndarray) – Sample at these elevations in radians
- arrAzi (np.ndarray) – Sample at these azimuths in radians
- funCall (function) – evaluatePattern, evaluateGradient, evaluateHessian
Returns: pattern, gradient or Hessian array
Return type: np.ndarray
-
_interpolateFourierData() → numpy.ndarray¶ Interpolate the Fourier Data along Frequency
Given the currently set operating frequencies, we evaluate splines of order 5, which were generated from the measurement data.
Returns: CoEle x Azi x operatingFreq x Pol x Elem Return type: np.ndarray
-
activeSubBands¶ Actually used stationary subbands
If the operation frequencies are such that some stationary subbands do not contain any operation frequency, we can save some computation time.
Returns: indices of active subbands. Return type: np.ndarray
-
arrAzi¶ Return Array Containing the sampled Azimuth Angles
Note
This property is read only.
Returns: Sampled Azimuth Angles in radians Return type: np.ndarray
-
arrCoEle¶ Return Array Containing the sampled Co-Elevation Angles
Note
This property is read only.
Returns: Sampled Co-Elevation Angles in radians Return type: np.ndarray
-
arrDataCalc¶ Calculation Data used for the pattern and derivatives
This data is ready to be fed into the pattern and derivatives routine. As such it is the periodified measurement data Fourier transformed along Co-Elevation and azimuth, possibly interpolated along measurement frequency and restricted to the indices determined by the compression factor. Moreover it is already in the correct datatype and also has been transferred to the computation device if necessary.
Note
This property is cacheable.
Returns: Description of returned object. Return type: np.ndarray
-
arrFourierData¶ Return the Fourier Data used to represent the antenna.
Note
It is important to know that this property’s meaning depends on the fact if the user has defined stat. subbands or not. If there are no defined subbands, this property returns the Fourier data that is used to calculate the beampatterns at the specified
eadf.eadf.EADF.operatingFrequencies. In this case it is the result of an interpolation process along the measured frequencies.In case when there are stationary subbands, each slice along axis=2 of this property represents the data that is used to represent the beampattern on the subband with the same slice index.
Note
This property is read only.
Returns: CoEle x Azi x Freq x Pol x Port shaped Fourier Data Return type: np.ndarray
-
arrFreq¶ Return Array Containing the Sampled Frequencies
Note
This property is read only.
Returns: Sampled Frequencies in Hertz Return type: np.ndarray
-
arrIndAziCompress¶ Subselection indices for the compressed array in azimuth
This is influenced by
eadf.eadf.EADF.compressionFactorNote
This property is cacheable.
Returns: Subselection in spatial Fourier domain in azimuth Return type: np.ndarray
-
arrIndCoEleCompress¶ Subselection indices for the compressed array in elevation (ro)
This is influenced by
eadf.eadf.EADF.compressionFactor.Note
This property is cacheable.
Returns: Subselection in spatial Fourier domain in elevation Return type: np.ndarray
-
arrPos¶ Positions of the Elements as 3 x numElements
Cartesian coordinates.
Note
This property is read only.
Returns: Positions of the Elements as 3 x numElements Return type: np.ndarray
-
arrRawData¶ Return the Raw Data used during construction.
This is the already correctly along Co-Elevation and Azimuth periodified data. It is basically the measurement data in such a form that we can Fourier transform it conveniently along Co-Elevation and azimuth.
Note
This property is read only.
Returns: Raw Data in 2 * Co-Ele x Azi x Freq x Pol x Element Return type: np.ndarray
-
blockSize¶ Block Size for the Evaluation Functions
See
eadf.eadf.EADF.optimizeBlockSizeandeadf.eadf.EADF.lowMem.Returns: block size Return type: int
-
compressionFactor¶ Compression Factor
Returns: Compression factor in (0,1] Return type: float
-
defineSubBands(intervals: numpy.ndarray, data: numpy.ndarray) → None¶ Define Stationary SubBands
Stationary subband define intervals in frequency over which we can describe the antenna response reasonably well with one single set of CoEle x Azi x Pol x Port data values (not necessarily measurement data). This happens if the pattern changes only negligibly for the application at hand and as such can be considered constant/stationary.
If now several operating frequencies reside in the same stationary subband, one can save memory and computation time when calculating the pattern or its derivatives.
Note
Using this function triggers the spline generation and the regeneration of all the data used for calculating the pattern and so forth. Be patient.
Parameters: - intervals (np.ndarray) – Array containing the intervals bounds. Its first element must coincide with arrFreq[0] and its last with arrFreq[-1]. It must be sorted.
- data (np.ndarray) – Description of parameter data.
-
dtype¶ Data Type to use during calculations
Especially if calculations are done on the GPU, switching to single floating precision can speed up calculations tremendously. Obviously one also saves some memory. It is set by the shell environment variable EADF_LOWMEM=single/double.
Note
This property is read cacheable.
Returns: either ‘single’ for single precision or ‘double’ for double precision Return type: str
-
frequencySplines¶ Frequency Interpolation Splines
These splines are used to get the pattern data for the specified
eadf.eadf.EADF.operatingFrequencies. Since these may or may not be resided on the grid used during measurement of the array we use these splines to interpolate this data.Note
This property is cacheable.
Returns: CoEle x Azi x Pol x Elem ndarray of Splines Return type: np.ndarray
-
gradient(arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray) → numpy.ndarray¶ Sample the Beampattern Gradient at given Angles
The supplied arrays need to have the same length. The returned array has again the same length. This method samples the EADF object for given angles at operating frequencies, all polarizations and array elements. So it yields a Ang x Freq x Pol x Element ndarray.
Note
If the GPU is used for calculation a cupy.ndarray is returned, so for further processing on the host, you need to copy ot yourself. otherwise you can simply continue on the GPU device. Moreover, if you supply cupy.ndarrays with the right data types, this also speeds up the computation, since no copying or conversion have to be done.
Parameters: - arrCoEle (np.ndarray) – Sample at these elevations in radians
- arrAzi (np.ndarray) – Sample at these azimuths in radians
Returns: (Ang x Freq x Pol x Elem x 2)
Return type: np.ndarray
-
hessian(arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray) → numpy.ndarray¶ Sample the Beampattern Hessian at given Angles
The supplied arrays need to have the same length. The returned array has again the same length. This method samples the EADF object for given angles at operating frequencies, all polarizations and array elements. So it yields a Ang x Freq x Pol x Element ndarray.
Note
If the GPU is used for calculation a cupy.ndarray is returned, so for further processing on the host, you need to copy ot yourself. otherwise you can simply continue on the GPU device. Moreover, if you supply cupy.ndarrays with the right data types, this also speeds up the computation, since no copying or conversion have to be done.
Parameters: - arrCoEle (np.ndarray) – Sample at these elevations in radians
- arrAzi (np.ndarray) – Sample at these azimuths in radians
Returns: (Ang x Freq x Pol x Elem x 2 x 2) result array, hermitian along the last two 2x2 dimensions.
Return type: np.ndarray
-
classmethod
load(path: str) → object¶ Load the Class from Serialized Data
Note
This is not safe! Make sure the requirements for pickling are met. Among these are different CPU architectures, Python versions, Numpy versions and so forth.
However we at least check the eadf package version when reading back from disk and issue a warning if the versions don’t match. then you are on your own!
Parameters: path (str) – Path to load from Returns: The EADF object Return type: object
-
lowMemory¶ Does this EADF object operate in Low-Memory mode?
Low memory mode can be switched on in order to split up the Antenna repsonse calculation in blocks along the requested angles. This way only the currently needed blocks in equation (7) in the EADF paper by Landman are used to calculate a block. It should always be used together with
eadf.eadf.EADF.blockSizein order to maximize the possibly lower computation speed. It is set by the shell environment variable EADF_LOWMEM=1/0.Note
This property is read cacheable.
Returns: Flag if low memory mode is switched on. Return type: bool
-
muAziCalc¶ Spatial Frequencies along Azimuth
These are already in the right data type, on the right device and subselected accoring to the chosen compression factor.
Note
This property is cacheable.
Returns: Description of returned object. Return type: np.ndarray
-
muCoEleCalc¶ Spatial Frequencies along Co-Elevation
These are already in the right data type, on the right device and subselected accoring to the chosen compression factor.
Note
This property is cacheable.
Returns: Description of returned object. Return type: np.ndarray
-
numElements¶ Number of Array Elements
Note
This property is read only.
Returns: Number of Antenna Elements / Ports Return type: int
-
operatingFrequencies¶ Frequencies where we whish to evaluate the pattern
Note
Setting this triggers the recalculation of all data used for calculating the pattern.
Note
This property is writeable.
Returns: Description of returned object. Return type: np.ndarray
-
optimizeBlockSize(maxSize: int) → None¶ Optimize the Blocksize during the Calculation
Instead of processing all angles and (possibly) frequencies all at once, we process them in blocks. This can produce a decent speedup and makes the transform scale nicer with increasing number of angles.
Simply call this function, which might take some time to determine the best block size. See
eadf.eadf.EADF.blockSizeandeadf.eadf.EADF.lowMem.Parameters: maxSize (int) – Largest Block Size?
-
pattern(arrCoEle: numpy.ndarray, arrAzi: numpy.ndarray) → numpy.ndarray¶ Sample the Beampattern at given Angles
The supplied arrays need to have the same length. The returned array has again the same length. This method samples the EADF object for given angles at operating frequencies, all polarizations and array elements. So it yields a Ang x Freq x Pol x Element ndarray.
Note
If the GPU is used for calculation a cupy.ndarray is returned, so for further processing on the host, you need to copy ot yourself. otherwise you can simply continue on the GPU device. Moreover, if you supply cupy.ndarrays with the right data types, this also speeds up the computation, since no copying or conversion have to be done.
Parameters: - arrCoEle (np.ndarray) – Sample at these elevations in radians
- arrAzi (np.ndarray) – Sample at these azimuths in radians
Returns: (Ang x Freq x Pol x Elem) result array
Return type: np.ndarray
-
save(path: str) → None¶ Save the object to disk in a serialized way
Note
This is not safe! Make sure the requirements for pickling are met. Among these are different CPU architectures, Python versions, Numpy versions and so forth.
However we at least check the eadf package version when reading back from disk.
Parameters: path (str) – Path to write to
-
subBandAssignment¶ Assigment of the operating frequencies to stationary subbands
This property returns a list of indices, which tells us which operating frequency is in which subband. See
eadf.eadf.EADF.subBandIntervalsandeadf.eadf.EADF.operatingFrequenciesNote
This property is cacheable.
Returns: Description of returned object. Return type: np.ndarray
-
subBandIntervals¶ Defining array of the stationary subbands
See
eadf.eadf.EADF.defineSubBands.Note
This property is read only.
Returns: Defining array of the stationary subbands Return type: np.ndarray
-
truncateCoefficients(numCoEle: int, numAzi: int) → None¶ Manually Truncate the Fourier Coefficients
Parameters: - numCoEle (int) – Truncation size in co-elevation
- numAzi (int) – Truncation size in azimuth
-
version¶ Return the version of the EADF package used to create the object
This is important, if we pickle an EADF object and recreate it from disk with a possible API break between two versions of the package. Right now we only use the property to issue a warning to the user when the versions dont match when reading an object from disk.
-