Vector Spherical Harmonic Python Tools for FEKO

I recently found myself in a situation where I needed to simulate many antenna configurations while storing all of their far-field patterns. The far-field patterns themselves are described on a spherical grid using, in my case, 26×101 points. That is more than 2000 data points per frequency. If you are simulating 60 frequency points, this explodes to around 150000 data points per antenna simulation. This is fine if you are running the odd few simulations. However, on this occasion, I was attempting to simulate an unwieldy set of 4000 different antenna configurations. This might be more simulations than most people run in an entire lifetime. Nevertheless, I was determined. Just to translate the problem into hard drive space, 150k times 4000 is around 600M data points. Keep in mind that this is not your average byte sized data points. Every data point is a complex vector leading to a dataset well into the Gigabyte ranges. For a mere RF engineer, this is some serious big data territory.

Thankfully, we can compress the far-field dataset with a handy tool called Vector Spherical Harmonics (VSH). FEKO allows you to export the VSH modes which for the typical antenna only involves around 200 data points that need to be stored compared to 2000 from before.

The reason I wrote this post is to share my python implementation of the VSH used in FEKO. You can grab the code from the GitHub link. The code itself allows you to plot the far-field from the complex mode coefficients given by FEKO. It also includes functions to extract these coefficients from the FEKO outfile. Feel free to send me pull requests to make this code better.