Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty plots with large number of particles #35

Open
jegarfa opened this issue May 17, 2024 · 3 comments
Open

empty plots with large number of particles #35

jegarfa opened this issue May 17, 2024 · 3 comments

Comments

@jegarfa
Copy link

jegarfa commented May 17, 2024

Hi! I'm trying to plot a DM-only simulation using py-sphviewer. The simulation consists of 2048^3 particles. However, the result I'm getting is either a completely white or black plot. Below is the code, which I've taken from the examples.

Particles = sph.Particles(pos, mass, nb=4)
hsml      = Particles.get_hsml()
Scene     = sph.Scene(Particles)

fig = plt.figure(1, figsize=(15,7))
ax1 = fig.add_subplot(111)
ax1.imshow(qv_perspective.get_image(), extent=qv_perspective.get_extent(),
           origin='lower', cmap=cmaps.twilight(), 
           vmin=-0.5)
plt.show()

When I plot smaller simulations, everything works fine, and I get pretty plots. I suspect this issue might not be related to py-sphviewer but rather to matplotlib. I've noticed that when I create a simple 2D scatter plot with matplotlib for the 2048^3 particles (x, y), it results in an empty figure. So, I do not get errors, only empty plots.

Have you ever faced a similar issue when plotting large amounts of data? do you have any hint on what could be causing the problem?
thanks,

@alejandrobll
Copy link
Owner

alejandrobll commented May 20, 2024 via email

@jegarfa
Copy link
Author

jegarfa commented May 22, 2024

Hi Alejandro, right, in fact after loading the particles I am computing the hsml
hsml = Particles.get_hsml()
I tried varying the vmin and vmax. I noticed something odd after render.

Render = sph.Render(Scene)
img = Render.get_image()

the image only contains zeros, however, it loaded all the particles and hsml. And since I don't get an error I was not able to track the issue.

I also did a test with random data but I got the same result, an empty plot.
N = int(2048**3) pos = np.random.rand(N, 3)

@alejandrobll
Copy link
Owner

alejandrobll commented May 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants