sph_harmonics module

sphericalharmonics

Plots and animates spherical harmonics functions for different l and m values

Created on Sun June 01 06:45:00 2025 @author: Dan Kotlyar Last updated on Sun June 19 03:00:00 2025 @author: Jonathon Faulkner

email: dan.kotlyar@me.gatech.edu

email: jfaulkner31@gatech.edu

sph_harmonics.BibicallyAccurateSphericalHarmonics(l: int, m: int, sphType: str, nangles: int, elev: float, azimRot: float, dpi: int, filename: str, doPlot: bool)

Plot the spherical harmonics data but cooler looking this time!

Bibically accurate spherical harmonics - e.g. plots the shapes.

Parameters:
  • l (int) – order of the moment

  • m (int) – order of the sub-moment

  • sphType (str) – real or imag

  • nangles (int) – number of angles for meshing theta and phi

  • azimRot (str) – Rotation of the Azimuthal on the plot.

  • elev (int) – Elevation degrees. use zero for a flat 2D plot

  • dpi (int) – Resolution of the generated figure

  • filename (str) – Filename that we want to save as (if empty we do not save any figures.)

  • doPlot (bool) – Whether or not to plot the figure saved in memory at the end.

sph_harmonics.animateSphHarm(nFrames, l, m, sphType='real', nangles=100, elev=30)

Plot the spherical harmonics data for the full range of theta and phi

Parameters:
  • nFrames (int) – number of frames

  • l (int) – order of the moment

  • m (int) – order of the sub-moment

  • sphType (str) – real or imag

  • nangles (int) – number of angles for meshing theta and phi

  • elev (int) – elevation degrees. use zero for a flat 2D plot

sph_harmonics.getSphHarm(l, m, sphType, nangles=100)

Get the spherical harmonics data for the full range of theta and phi

Parameters:
  • l (int) – order of the moment

  • m (int) – order of the sub-moment

  • sphType (str) – real or imag

  • nangles (int) – number of angles for meshing theta and phi

sph_harmonics.gifMaker(output_filename: str, duration: float, filenames: list)

Creates a GIF from a list of image files.

Parameters:
  • output_filename (str) – Filename that we want to save as.

  • duration (float) – Time between frames in milliseconds

  • filenames (list) – List of filenames (in order) of what pictures to use in gif.

sph_harmonics.imageCropper(filename: str, outname: str, left_inches: float, right_inches: float, top_inches: float, bottom_inches: float, dpi: int)

Crops an image given dimensions to crop off.

Parameters:
  • filename (str) – Filename of the image to crop.

  • outname (str) – Output name of the image that is cropped

  • left_inches (float) – Number of inches to cut off the left

  • right_inches (float) – Number of inches to cut off the right

  • top_inches (float) – Number of inches to cut off the top

  • bottom_inches (float) – Number of inches to cut off the bottom

  • dpi (int) – DPI of the original image

sph_harmonics.plotSphHarm(l, m, sphType='real', nangles=100, elev=30, azimRot=0)

Plot the spherical harmonics data on a unit sphere for the full range of theta and phi

Parameters:
  • l (int) – order of the moment

  • m (int) – order of the sub-moment

  • sphType (str) – real or imag

  • nangles (int) – number of angles for meshing theta and phi

  • pltMode (str) – plot mode with either “sphere” or “radial” as options

  • elev (int) – elevation degrees. use zero for a flat 2D plot