All studies

Scientific visualization

Electron Orbitals

A Python study of electron probability density, turning radial and angular expressions into high-resolution images.

Python · NumPy · SymPy · OpenCV

View source on GitHub
A high-resolution electron probability-density visualization with many orange and violet lobes on black
Render from the repository’s 8K output, resized for the web.

Making the calculation visible

I worked on this codebase to help my younger brother make his electron orbital visualizer more efficient. The useful change was moving symbolic work out of the per-pixel calculation: build the radial and angular expressions once, simplify them, and convert them to numerical functions with SymPy.

The renderer then evaluates those functions over a two-dimensional image. NumPy supports the numerical operations; OpenCV normalizes the result and maps it to the Inferno color palette.

From the render archive

Original outputs from the Electron Orbitals repository.

Four luminous central lobes with faint outer rings in an orbital render
out4k.png · original 3840 × 2160
Multiple small orbital lobes arranged around a dark center
out6.png · original 1000 × 1000

Inside the implementation

  1. Define the state. Principal, angular, and magnetic quantum numbers parameterize associated Laguerre and Legendre expressions.
  2. Evaluate a plane. Image coordinates are converted to a radius and angle. The radial and angular factors are evaluated, multiplied, and squared.
  3. Map values to color. The field is normalized to an 8-bit image, then OpenCV’s Inferno palette makes the variation visible.

The current script uses nested Python pixel loops and requests a 7680 × 4320 render. The symbolic expressions are prepared once; the entire renderer is not vectorized. I have not measured a speedup against a baseline.

Reading these images

These are two-dimensional visualizations of a probability-density field, not paths that electrons travel. The color scale is normalized separately for each image, so brightness should not be compared as an absolute probability across renders.

The archive does not record quantum numbers for each saved image. The current script’s defaults are n = 13, l = 7, m = 2; those values should not be assumed to describe every archived render.