Sjoerd de Haan, DataDrivenLab · August 2025 · ML for materials and measurement

Exploring Banana Shape Particle Distribution, Part 2

Original data

This is part 2. In part 1, Gradient Descent for Spectral Reconstruction, I rebuilt the UV/Vis spectra of gold nanorods from a basis of simulated profiles, using data from Gleason et al. (2024). The result was a 2D map of length and diameter with two peaks, and the contour lines of those peaks were bent into banana shapes. I did not know what to make of that. This post is my attempt to find out. The first spectral decomposition I did showed banana shapes in the distribution of gold nanorods. Here I explore the banana shape and a possible relation to growth kinetics of gold crystals.

2D coefficients shape: (10747,)
Length range: 12.0 - 500.0 nm
Diameter range: 5.0 - 50.0 nm

Heat map of population coefficients over gold nanorod diameter and length, with banana-shaped contour lines

Figure 1: Population coefficients with banana-shaped contour lines

Contour lines

Let’s visualize those imagined contour lines:

Contour lines of the population coefficients in (length, diameter) coordinates, showing curvature

Indeed there is curvature visible in the contours.

Hypothesis

If the particle growth is constrained by crystal growth kinetics, we might expect the banana shape to be related to the aspect ratio of the particles. In this case we can

If aspect ration is fixed, then only diameter can vary. This not realistic. We expect variation in aspect ratio. This variation may be be independent of diameter, in which case the distribution factorizes into the product of the two marginals:

p(d,l/d)=p(u,v)=p(d)⋅p(l/d) p(d, l/d) = p(u, v) = p(d) \cdot p(l/d)

Coordinate Transformation

Gold crystals prefer to grow in certain directions. This can constrain the aspect ratios of nanoparticles.

To see if this is the case, we are going to transform to a new coordinate system from (l,d)(l, d) to (u,v)(u, v) where:

u=dv=ld \begin{align} u &= d \\ v &= \frac{l}{d} \end{align}

This is equivalently written as: (uv)=(dl/d) \begin{pmatrix} u \\ v \end{pmatrix} = \begin{pmatrix} d \\ l/d \end{pmatrix}

The inverse transformation is: d=ul=v⋅u \begin{align} d &= u \\ l &= v \cdot u \end{align}

Jacobian and Density Compensation

When transforming probability densities, we need to account for the change in volume elements. If pld(l,d)p_{ld}(l, d) is the probability density in the original coordinates and puv(u,v)p_{uv}(u, v) is the density in the new coordinates, they are related by:

puv(u,v)=pld(l,d)|det𝑱| p_{uv}(u, v) = p_{ld}(l, d) \left| \det \mathbf{J} \right|

where 𝑱\mathbf{J} is the Jacobian matrix of the transformation from (u,v)(u, v) to (l,d)(l, d):

𝑱=∂(l,d)∂(u,v)=(∂l∂u∂l∂v∂d∂u∂d∂v) \mathbf{J} = \frac{\partial(l, d)}{\partial(u, v)} = \begin{pmatrix} \frac{\partial l}{\partial u} & \frac{\partial l}{\partial v} \\ \frac{\partial d}{\partial u} & \frac{\partial d}{\partial v} \end{pmatrix}

Computing the partial derivatives:

Therefore: 𝑱=(vu10) \mathbf{J} = \begin{pmatrix} v & u \\ 1 & 0 \end{pmatrix}

The determinant is: det⁡𝑱=v⋅0−u⋅1=−u=−d \det \mathbf{J} = v \cdot 0 - u \cdot 1 = -u = -d

Since we need the absolute value: |det𝑱|=|d|=d \left| \det \mathbf{J} \right| = |d| = d

Density Transformation Formula

Thus, the density compensation factor is dd, and the transformed density is:

puv(u,v)=d⋅pld(l,d)=u⋅pld(v⋅u,u) p_{uv}(u, v) = d \cdot p_{ld}(l, d) = u \cdot p_{ld}(v \cdot u, u)

This means that when we transform our coefficients from (l,d)(l, d) coordinates to (d,l/d)(d, l/d) coordinates, we need to multiply by the diameter dd to preserve the total probability mass.

Implementing the Coordinate Transformation

The implementation is straightforward, thanks to xarray:

coeffs_compensated = coeffs_ds * coeffs_ds.diameter

# Create aspect ratio coordinate
aspect_ratio = coeffs.length / coeffs.diameter

# Add aspect ratio as a new coordinate
coeffs_with_ar = coeffs_compensated.assign_coords(aspect_ratio=aspect_ratio)

# Reset the current MultiIndex and create a new one with (diameter, aspect_ratio)
coeffs_transformed = coeffs_with_ar.reset_index('size_combo').set_index(size_combo=['diameter', 'aspect_ratio'])

Statistics

Here are the statistics of the old and new datasets:

Original index: (length, diameter)
New index: (diameter, aspect_ratio)
Number of data points: 10747

Unique diameters: 46
Unique aspect ratios: 6578
Actual data points: 10747

Scatter Plot Visualization

Now we have an irregular grid, we cannot use the heat map.
We can visualize the distribution in the new coordinate system using a scatter plot, where the color represents the coefficient values. This will help us see how the coefficients are distributed in the (d,l/d)(d, l/d) space.

Scatter plot of the coefficients in (d, l/d) coordinates, colored by coefficient value

This looks good! I see less curvature.

Interpolation to Regular Grid

To get a better image, I interpolate the data on a regular lattice, using scipy.interpolate.griddata. This will allow us to create a smooth surface that represents the distribution of coefficients in the (d,l/d)(d, l/d) space.

Regular grid shape: (100, 50)
Diameter grid: 50 points from 5.0 to 50.0 nm
Aspect ratio grid: 100 points from 1.51 to 10.00

Linear Interpolation

Linear interpolation creates a piecewise linear surface by:

The “blocky” artifacts come from the patches meeting at triangle boundaries. Clipping removes negative values that physically don’t make sense for coefficient values.

Linear interpolation of the coefficients on a regular (d, l/d) grid

Cubic Interpolation

Cubic interpolation uses CloughTocher2DInterpolator which:

The “blocky” artifacts come from the cubic polynomial patches meeting at triangle boundaries. Clipping removes negative values that physically don’t make sense for coefficient values.

Cubic interpolation of the coefficients on a regular (d, l/d) grid

Contour Plot of Cubic Interpolation

Contour plot of the cubic-interpolated coefficients in (d, l/d) coordinates

Observations

Discussion

The banana shape likely arises from a coupling between length end diameter growth rated. This may come from crystal facets with different growth kinetics due to crystal structure and surfactant binding affinities.

The bi-modal distribution is consistent with several growth scenarios, including twinning, aggregative growth, or competing crystal structures.

Working on a simulation or measurement pipeline that is too slow to iterate on? Book Free Consultation.