[Python] Generating a galaxy density wave field [closed]

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    https://beltoforion.de/en/spiral_galaxy_renderer/ is a good introduction to galaxy density waves. Here is a link to an image from the blog that shows several elliptical orbits around the galaxy and how the orbits bunch up at certain locations.

    I want to create a 2D image that contains the relative density of a galactic disk based on these density waves. So for example, a galaxy with no spirals would just be a constant image of 1s, and a galaxy with spirals would have values ranging from 0 to infinity, but in practice probably not much higher than 2 or so.

    It's trivial to render out a bunch of elliptical orbits like the above image, but it is not trivial to convert these into a continuous field image. One option I could go for would be to sample a bunch of points on various orbits (the longer the orbit, the more sample points) and then use a Kernel Density Estimation to create a density image. This would require a large number of points and a fast KDE library.

    Alternatively, a far more principled approach would be to treat a sequence of expanding ellipses as a curve at every pixel sample point, find the root of the curve at each point (so where an ellipse lies exactly on the sample point) and get the slope (derivative) of the curve at that point in order to calculate the density. In the case of multiple roots (where orbits cross over) then the density of each root should be summed.

    This second approach is far more elegant and appealing to me, but I feel like it might have multiple issues such as difficulty finding the exact number of roots. I've been using AI tools to try and generate an implementation, but both the tools and I are clearly out of our depth here. I'd really appreciate advise as to whether this is possible/practical.

    Continue reading...

Compartilhe esta Página