# Creating a 3D spatial density map from simulation results

I want so visualize the spatial density for my simulation. The result of my simulation is a (time-dependent) system of large number (~100k) of moving particles in a confined space. Each particle has its own Cartesian coordinates as well as a weight ($w$) in the form of $(x_i,y_i,z_i;w_i)$.

I am looking for a software/app/package to create a snapshot of the 3D spatial density map of these particles (something like this). Like you see in this figure, the particles are not going to be displayed individually, but only a transparent cloud will be drawn whose local intensity is proportional with the local number of particles.

The final goal is to create a movie of the changing 3D spatial density with time. So far, I have tried R, Matlab, Origin, and ImageJ. But no success!

• Welcome to SciComp.SE. It is not completely clear to me what you want. Do you want to obtain a function of particle density (number of particles per unit volume) for the whole space and then visualize it? If that's the case, I haven't seen any software that has that option available. Nevertheless, you can compute the density function by yourself and then use a well-known technique to visualize it (iso-surface, 3D rendering). I don't get why is the weight ($w_i$) important to the question. – nicoguaro Jul 28 '15 at 17:53
• Nope, I dont want any function or anything like that. I have large number (~100k) of particles with known coordinates and weights. In fact, each particle $i$ represents the location of an interaction in the 3D space with a particular strength. Thus, each particle has $(x_i,y_i,z_i;w_i)$ which are the coordinates plus a weight factor between 0 and 1, showing the strength of interaction in that point. I am looking for a way to visualize the 3D spatial density map of those particles, which will reveal how interactions are spread in the space (plz see the link in the main question). – deeep Jul 29 '15 at 3:10
• You can't just expect people to expend more time answering your question than the one you used to formulate it, you should provide enough details from the paper you are referring to. Besides that, the link you provide is a paywall to the article, the abstract and caption of the figure are not good enough. At least you can provide a link to a preprint or its pdf version. Still, you are not explaining density of what variable you want to visualize. – nicoguaro Jul 29 '15 at 3:18
• Also, remember that cross-posts are discouraged. Normally, you should wait and then ask to the post to be migrated or delete it and re post it in another site. – nicoguaro Jul 29 '15 at 4:28
• You could certainly do this with Matlab. I think yt may have more automate facilities for what you want, though: yt-project.org. – David Ketcheson Jan 25 '16 at 6:07

I'm not sure if there is a specific software for that but it should be relatively simple, you could always make a routine that computes the sum of all $w_i$ at all $z$ values at a particular $(x,y)$ coordinate and then you would have the density at that particular $(x,y)$, for example:
$f(x,y)=\sum_k w(x,y,k)$,
where $k$ is an index summed across all z coordinates at a particular constant (x,y), and $f(x,y)$ is your density.
$f(x,y)$ now then is a density function of two dimensions so you could plot it with any plotting software, whether gnuplot, matlab, mathematica etc.