after quite some time, I have finished a substantial update of my globular cluster package. Unfortunately, for family reasons, I had very little spare time / leisure for coding during the past weeks since end of November...
Here is the new patch for you to test:
+++++++++++++++++++++++++++++++
http://www.celestiaproject.net/~t00fri/images/ ... _r4602.zip
The archive contains BOTH a standard patch file, as well as all the modified C++ code files for a simple replacement. All refers to the latest SVN, r4602
+++++++++++++++++++++++++++++++
Let me summarize next the various points, where I have implemented significant improvements:
- There are now strictly no cluster stars beyond the tidal radius!
While before I did some "plumbing" with an approximate scaling law for the outer cluster stars, I now found an exact, highly efficient star generation algorithm, perfectly following the King luminosity distribution out to the tidal radius.
This progress became possible by exploiting some crucial mathematical/statistical tricks. Let me briefly summarize:
Von Neumann's "Acceptance-Rejection" method allows to sample random data (stars) following an arbitrary probability distribution, with the help of another (quickly generated) reference distribution, which majorizes the one in question everywhere. Initially, I used as a majorizing distribution p a uniform one (p ~ constant), which is very fast, but highly inefficient, given the strong central peaking of the desired King luminosity distribution! The uniform distribution was near at hand, since the random number methods in the code are always sampling uniformly (mathf::frand(),...)
The perfect remedy was to employ a p ~ 1/Z^3 inverse power distribution, instead of a uniform one for majorizing. Due to the particular scaling dependence of the parameters/variables in King's distribution, a single, new variable Z could be found for the power distribution that majorizes the King distribution for ALL values of the King parameters/variables, r_c, c, r:
[tex]Z = \sqrt {(1+r^2/r_c^2)/(1+r_t^2/r_c^2)}[/tex]
The second trick was that the random sampling according to a 1/Z^3 distribution can be VERY quickly done by means of the well-known "Inverse-transform" method. It uses the fact that the cumulative distribution F(y) (expressing the probability that x < y),
[tex]u = P(y) = \int_0^y p(x) dx[/tex]
is itself a random variable u, which will occur with uniform probability density on [0, 1]. Here p(x) would be the desired 1/Z^3 distribution, with the stochastic variable x being distributed according to p(x)!
In a few cases, including the 1/Z^3 distribution, this relation can be analytically inverted and thus the desired data x can be obtained from the /uniformly/ distributed ones as
[tex]x = P^{-1} (u)[/tex]
Hence, by sampling u with mathf::frand(), x is obtained immediately from a simple transformation formula in terms of u! This works beautifully and VERY fast.
+++++++++++++++++++++++
With this new method I could increase the efficiency of generating cluster stars following King's distribution out to r_tidal from a fraction of a percent to almost 100%!
+++++++++++++++++++++++
The approximate scaling trick by which I attempted initially to compensate for the low efficiency, has now become reluctant. The corresponding results were unfortunately quite inaccurate in certain cases. - Here are some plots, illustrating the achieved progress:
First, let us consider the 3d King luminosity profiles (solid colored lines) as function of the scaled distance [tex]\eta=r / r_t[/tex] for the relevant range of King concentration parameters c. The dashed lines are the majorizing 1/Z^3 distributions,
You see that small c corresponds to a more shallow light distribution, while large c shows a heavy central bias!
In terms of the above variable
[tex]Z = \sqrt {(1+r^2/r_c^2)/(1+r_t^2/r_c^2)}[/tex]
all these different curves collapse into a universal one, as you see in this plot:
In the next plot, I generated 20000 stars with the new algorithm. You can see yourself, how well the corresponding histogram of the generated stars matches the theoretical King profile function (red line). The black line is the normalized, intermediate 1/Z^3 profile. The efficiency is now 82%, while it was only a fraction of a percent before!!! - To avoid color inverted clusters in front of bright galactic clouds, the blending of the cloud sprite texture and the star sprite texture has been modified essentially as investigated by Chris . While this is perfect for the cloud sprite texture, it's only a compromise for the star sprite texture. But it seems for now, it's an improvement... At least there are NO black clusters anymore
- The sizes of the globular stars are now fixed numbers (unlike their proportionality to the cluster radius before). They are much smaller than before.
+++++++++++++++++++++++++++
At the same time I implemented a nice NEW option to travel right through the core of any globular cluster!!
Here is how to do it:
Enter the name of a globular into the command line (e.g. Omega Centauri, M 13, 47 Tuc, M 53, ...). Next type G (GoTo). Make sure that the field of view (FoV) corresponds to the default value 30-45 degrees (hit the middle mouse key to reset). The cluster should fill about 1/3 of the screen now. Next hit F7 and then use the 'A' and 'Z' keys for adjusting your travel speed. Don't go too fast (hit 'Z' to slow down, 'A to accelerate)! Once you passed through the center, you may hit ' * = SHIFT+8' and then you can look back, watching the cluster moving away from you...
How do you like it???
+++++++++++++++++++++++++++ - The new sizes of the globulars have been cross-checked in many ways!
This is quite a non-trivial task, since the clusters don't have a sharp boundary. Here is an example of such a decisive test:
I exploited that for King concentration c-> 0 the core radius r_c -> r_t, and the distribution of stars becomes very shallow, still vanishing exactly at the tidal radius r_t. Then I composed a test.dsc file with a fake "ring galaxy" of outer radius r_t and a corresponding globular that has precisely the angular diameter of the full Moon. Here you see how well everything matches:
This image tests the globular cluster sizes BOTH in terms of the solar system sizes (Moon) AND independently, via the galactic size scale! - The cluster star distribution is now considerably narrower than before, since the incorrectly placed stars further out have gone. Moreover, the low dynamic range of displays is simply unable to render > 10 magnitudes of faint cluster stars. Hence the outer region of clusters looks much more "depleted" than in reality, since the very faint stars can hardly be rendered along with the brightest ones.
I made a lot of experiments and found that the so-called half-light radius or it's theoretical counterpart, the half-mass radius is a much better looking radius for characterizing the clusters' extent in the computer (not in Nature!). The half-light radius is also a very basic globular cluster parameter and has various theoretical advantages: it has been shown to be almost time independent on galactic time scales, for example. Also, the half-light radius is used in various other fashionable research contexts, e.g. for satellite clusters consisting of Dark matter in the neighborhood of galaxies.
In Celestia, we cannot deny that for practical reasons certain significant "abstractions" are unavoidable:
-- total number of globular cluster stars: in Nature it ranges between 10^4 and 10^7! In my code I use only 8192 (for obvious reasons of speed!).
-- From the many available color-magnitude diagrams for globular clusters,
http://dipastro.pd.astro.it/globulars/
(click Databases->Ground-based data) or directly
http://dipastro.pd.astro.it/globulars/d ... abase.html
you may readily see that the apparent visual magnitude of cluster stars typically ranges over /many/ orders of magnitudes (>10), typically between mag=8-12 and mag=22-23! The vast majority of cluster stars has app.mags fainter than 20!
In Celestia, all these faint stars cannot be rendered together with the brightest cluster stars. In Nature these faint stars are responsible for defining the mu25 isophote radius that we presently use as a standard cluster size parameter! The half-light radius or correspondingly the half-mass radius is much less dependent on all these faint stars that Celestia cannot render...
On the other hand the mu25 isophote radius is the most correct radius from a researcher's point of view, say.
I therefore retained the correct mu25 isophote radius in the text output on the canvas, but used the more appropriate half-mass radius for the red selection cursor!
Note that I have implemented a patch by Chris that rotates the red selection cursor by 45 degrees, to avoid overwriting of labels, as I have proposed.
This also improves on aliasing artefacts...
The fake "galaxy ring" corresponds in it's outer rim to the half-mass radius - For reasons of speed, I account for the dependence on the King concentration in form of 8 discrete bins of c, rather than admitting the full continuous range 0.5 < c < 2.58. The resulting bin width is 0.26.
Here is a plot of the binned histogram for my actual data set of the 150 globular clusters in globulars.dsc.
This simplification greatly increases the performance, while graphically the simplification can hardly be noted.
Enjoy,
Fridger