I have a grid of data on a 3D Cartesian grid and I would like to find a routine that will allow me to input this data and output a spherical harmonic transform for specific values of radial distances. Does anyone know if such a routine exists??


  • 1
    $\begingroup$ Welcome to SciComp.SE! Can you provide more information about what you want to do? An example would be really helpful. $\endgroup$ – nicoguaro May 15 '15 at 19:29

To do precisely what you are describing, you likely want to interpolate your grid data to a set of discrete spheres with prescribed radii, then perform the spherical transform on each set of data.

Another possibility, and a generalization of the above, would be to define a spherical basis set with the spherical harmonics as the $(\theta, \phi)$-varying functions, and some sort of radial basis function defined on $r \in \left[0,a\right]$, where $a$ is the radius of the largest sphere that will fit inside your grid box. You can then solve for the coefficients of these functions via a point-matching testing procedure and inverting the coefficient matrix. This will give you a continuous function whose value coincides with your grid data at the grid points and interpolates the grid data between grid points, and which you can evaluate at each radius of interest to give you the data you want.

I don't know if there is an extant piece of software that suits your exact needs, but both approaches I described above are easily implemented in a few lines of Matlab or Python code.

| cite | improve this answer | |
  • $\begingroup$ As stated above, you need to add a radial component to your usual spherical harmonic functions. This is done for example in Equation 2 (the first equation in the paper) in the following publication. books.google.com/… Also as stated above, this can be handled by a few lines of Matlab code. Good luck. $\endgroup$ – Khaled Khairy Jun 23 '15 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.