glotzerlab / freud

Powerful, efficient particle trajectory analysis in scientific Python.
https://freud.readthedocs.io
BSD 3-Clause "New" or "Revised" License
282 stars 49 forks source link

Voronoi diagram with missing cells #1295

Open michaelmaalouly opened 4 days ago

michaelmaalouly commented 4 days ago

Description

Hello,

I am trying to create a Voronoi diagram from a lagrangian simulation where I have particles. The expectations for the particles in terms of the PDF of the Voronoi cell areas are good; however when I look at the diagram I see some empty spaces.

Here is an example: Figure_1_test

Steps to Reproduce

L=2*pi
path_npz=appendpath+'lagr/output/npz/'
coord_tra=np.load(path_npz+'./xycoord.%.2d.npz'%(irun))
xtra=coord_tra['x']
ytra=coord_tra['y']
flatxy=zip_xy(xtra,ytra,ifr)
voro = freud.locality.Voronoi()
flatxy3d=flat2dto3d_shift(flatxy,-pi)

box = freud.box.Box.square(L)

voro.compute((box, flatxy3d))
vol=voro.volumes
# Plot Voronoi with points and a custom cmap
plt.figure()
ax = plt.gca()
voro.plot(ax=ax, cmap="RdBu")
ax.scatter(flatxy3d[:, 0], flatxy3d[:, 1], s=2, c="k")
plt.savefig('./lagr/output/img/vordiag.png')
plt.show()

Error Output

There is no output error, just a visualization issue.

freud Version

v3.1.0

Python Version

v3.13.0

System Platform

MacOS

Installation method

Download from conda-forge

Developer

None