A script to mark ALL Fridger's galaxies

All about writing scripts for Celestia in Lua and the .cel system
Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #101by Cham » 23.05.2007, 03:40

Fridger's scripts are now part of CVS :

http://celestia.cvs.sourceforge.net/cel ... ortby=date

IMHO, these scripts are very important. Like Chris said, new users (and "old" users too) should be able to use them easily, without having to dig the directories. So a scripts menu ... :wink:
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #102by ElChristou » 23.05.2007, 10:48

dirkpitt wrote:So should scripts now be considered part of the official binary distribution? (i.e., not just CVS) I don't see any Makefile for scripts..


If scripts become part of the binaries, it would be cool to name them depending on what they do; example:

mark_galaxy_localg.celx
mark_galaxy_messiers.celx
mark_galaxy_redshiftz.celx
mark_galaxy_type.celx
....
mark_pulsars_density.celx
mark_pulsars_periods.celx
....
tour_DSOs.celx
tour_stars.celx
tour_solarsystem.celx
etc...

Note the naming convention here permit a logic sorting of files by name and give at first sight some significative information of what do the script...
Image

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #103by Vincent » 23.05.2007, 13:18

ElChristou wrote:If scripts become part of the binaries, it would be cool to name them depending on what they do; example:

mark_galaxy_localg.celx
mark_galaxy_messiers.celx
mark_galaxy_redshiftz.celx
mark_galaxy_type.celx
....
mark_pulsars_density.celx
mark_pulsars_periods.celx
....
tour_DSOs.celx
tour_stars.celx
tour_solarsystem.celx
etc...

Note the naming convention here permit a logic sorting of files by name and give at first sight some significative information of what do the script...

I agree with Christophe. Fixing this kind of convention would be really useful.
Besides, I've been already using the same convention for my own scripts :wink: :

Image
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re:

Post #104by Cham » 05.09.2008, 14:10

t00fri wrote:1) well the best Hubble constant 73.2 (km/s)/Mpc along
with full relativistic correction for a flat Universe Omega=1.
Image
This formula can still be inverted analytically and allows to
calculate z from the (comoving) distance d.

Just to indicate that this formula (with flat Universe Omega=1), used in the script, is only valid in the case of these parameters :

[tex]\Omega_{k} = 0[/tex], [tex]\Omega_{M} = 1[/tex] and [tex]\Omega_{\Lambda} = 0[/tex].

This means a matter dominated flat universe ([tex]k = 0[/tex]), without any "dark energy" (no cosmological constant : [tex]\Lambda = 0[/tex]). See for reference this paper :
http://www.physics.rutgers.edu/grad/608 ... tances.pdf, and more specifically equations (14) and (15).
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: Re:

Post #105by t00fri » 05.09.2008, 15:58

Cham wrote:
t00fri wrote:1) well the best Hubble constant 73.2 (km/s)/Mpc along
with full relativistic correction for a flat Universe Omega=1.
Image
This formula can still be inverted analytically and allows to
calculate z from the (comoving) distance d.

Just to indicate that this formula (with flat Universe Omega=1), used in the script, is only valid in the case of these parameters :

[tex]\Omega_{k} = 0[/tex], [tex]\Omega_{M} = 1[/tex] and [tex]\Omega_{\Lambda} = 0[/tex].

This means a matter dominated flat universe ([tex]k = 0[/tex]), without any "dark energy" (no cosmological constant : [tex]\Lambda = 0[/tex]). See for reference this paper :
http://www.physics.rutgers.edu/grad/608 ... tances.pdf, and more specifically equations (14) and (15).

This is a completely misleading statement! Any decent textbook will explain this to you.
This formula is of course an approximation only!
So it is entirely misleading to state that it is only valid for...

This simple formula is very often used in practice, since it's main benefits are
  • It's a simple closed form expression for a flat, matter dominated Universe
  • the approximation is NOT bad at all for reasonably small z, i.e late times, wenn we indeed have matter dominance (besides the cosmological constant term)
  • it implements 2 sensible limits: for [tex]z\to 0[/tex] we correctly get [tex]\approx z\,c/H_0[/tex] (Hubble law!) and formally for [tex]z \to \infty[/tex] we get a finite asymptotic distance [tex]\approx 2\,c/H_0[/tex].

There are also somewhat more sophisticated forms that implement a non-vanishing [tex]\Omega_{\Lambda}[/tex] and non-flat cosmologies. I have a corresponding formula in one of my scripts. Anyhow, from any of the online calculators that implement these formulae, one finds the difference to be negligible for the case of NGC/IC galaxies.

Fridger
Last edited by t00fri on 05.09.2008, 16:24, edited 1 time in total.
Image

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #106by t00fri » 05.09.2008, 16:21

Just for completeness let me quote below again my old Perl script that calculates the comoving distance for a flat Universe also for [tex]\Omega_\Lambda \ne 0[/tex] and [tex]\Omega_{radiation}[/tex] given in terms of 3 neutrinos.
This formula does the integration numerically, in terms of 50 supporting points.

This was all discussed at length by me 1.5 years ago HERE:
viewtopic.php?f=10&t=10906&start=0

and the comoving distance formula was given here:
viewtopic.php?f=10&t=10906&start=9

Code: Select all

#!/usr/bin/perl -w
#
use Math::Trig;

$H0 = 73.2;       # today's Hubble constant [km/sec/Mpc], WMAP 2007, 3 years
$c = 299792.458;  # Celestia's speed of light [km/sec]
$Omega_matter = 0.27;    # flat Universe
$Omega_lambda = 0.73;
$pc2ly = 3.26167; # parsec-to-lightyear conversion
print "Enter redshift z:  ";
$z = <STDIN>;
$d0= &dcmr( $Omega_matter, $Omega_lambda, $z)/($pc2ly * 1e6);
$d1= $c *$z/$H0;

printf "Comoving (cosmological) distance: %10.2f Mpc\nNaive distance = c*z/H0:          %10.2f Mpc\n",$d0,$d1;

sub dcmr {
# calculate the comoving distance appropriate for Hubble law,
# given z, Omega_matter=Wm, Omega_lambda=Wlam.
    my($Wm, $Wlam, $z) = @_;
    my $Wr = 0.4165/($H0 * $H0); # 3 massless neutrinos to Omega (radiation)
    my $Wk = 1 - $Wm -$Wr -$Wlam; # flat universe, Omega (total) = 1
    my $az = 1/($z + 1);
    my $numpoints = 50; # for numerical integration
    # do integral over $a=1/(1+$z) from $az to 1 in $numpoints steps,
    # midpoint rule
     $dcmr = 0;
     #print "$Wm $Wlam $Wk  $Wr $az\n";
     for ($i = 0; $i < $numpoints; $i++) {
    my $a = $az + (1 - $az) * ($i + 0.5)/$numpoints;
    my $adot = sqrt($Wk + ($Wm/$a) + ($Wr/($a * $a)) + ($Wlam * $a * $a));
    $dcmr = $dcmr + 1/($a * $adot);
   }
   return $dcmr = $pc2ly * 1e6 * $c/$H0 * (1 - $az) * $dcmr/$numpoints;
}
Image

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Re:

Post #107by Cham » 05.09.2008, 17:06

t00fri wrote:This simple formula is very often used in practice, since it's main benefits are
  • It's a simple closed form expression for a flat, matter dominated Universe
  • the approximation is NOT bad at all for reasonably small z, i.e late times, wenn we indeed have matter dominance (besides the cosmological constant term)
  • it implements 2 sensible limits: for [tex]z\to 0[/tex] we correctly get [tex]\approx z\,c/H_0[/tex] (Hubble law!) and formally for [tex]z \to \infty[/tex] we get a finite asymptotic distance [tex]\approx 2\,c/H_0[/tex].

Fridger,

of course, I agree here. I was simply stating implicitely that the above formula (for a flat matter dominated universe) isn't formally valid in other cases, especially if there's a cosmological constant and at large 'z'. However, it was already evident to me that the same formula could be used as an approximation for small 'z', even if there's a cosmological constant.

It would be interesting to plot the various scenarios in Celestia. I already made a scale of 'z' values, in the case of the good old' scenario (flat matter dominated universe without CC), for 0 < 'z' < 2. I'll do another one for the present scenario with a CC and dark matter.

EDIT : Also, take note that the asymptotic distance [tex]\approx 2\,c/H_0[/tex] (from the limit of large 'z') may be not valid at all, if there's a CC, dark matter, etc... It strongly depends on the scenario.

In the case of the SLOAN distribution I made (and the one made by Selden), there may be some interesting differences, depending of the scenario used. Selden told me by email the formula that he used, for the distance formula :

[tex]d(z) = (c/H_{0})\frac{(1 + z)^2 - 1}{(1 + z)^2 + 1}[/tex]

This is the special relativistic Doppler formula only and doesn't take into consideration any gravitation effect at all. Yet, it's an approximation which gives, roughly, the same as the formula defined for the flat matter dominated scenario (at small and medium 'z'). Its limit is

[tex]d(\infty) = c/H_{0}[/tex]

which is half the value for the flat matter dominated scenario (this is probably associated to the limit [tex]v \to c[/tex] in special relativity, but I didn't checked). In the case of small 'z', the Doppler formula gives back the Hubble law too.
Last edited by Cham on 05.09.2008, 18:15, edited 2 times in total.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #108by t00fri » 05.09.2008, 17:29

Cham,

you should be able to easily transscribe my above Perl script into Mathematica, if you prefer not to work with Perl. Then you got the best available calculation of the comoving distance for your purposes. It agrees perfectly with the "official" online distance calculators.

Fridger
Image

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: A script to mark ALL Fridger's galaxies

Post #109by Cham » 05.09.2008, 17:37

It's extremelly easy to numerically solve the general relativisitc distance integral in Mathematica. I simply need the parameters values (the various [tex]\Omega[/tex]), which is easy too...
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #110by t00fri » 05.09.2008, 17:51

Cham wrote:It's extremelly easy to numerically solve the general relativisitc distance integral in Mathematica. I simply need the parameters values (the various [tex]\Omega[/tex]), which is easy too...

Of course, it's VERY easy. That's precisely what I did in my above short Perl script. But as far as I remember the general case has no analytical solution for the integral. Also not in Mathematica or Maple ;-)

The main trick is to rewrite the integral over t (that is a functional of the scale factor a(t)) as an integral over a = 1/(1+z)

[tex]\eta[a] = \int_{t[a]}^{t_0} \frac{d\,t^\prime}{a(t^\prime)} = \int_a^1 \frac{d\,a^\prime}{a^{\prime\,2}\,H(a^\prime)}[/tex]

This brings in the additional Jacobian factor in the denominator

[tex]\frac{d\,a}{d\,t} = a\,H(a)[/tex]
for which one can insert the general cosmological ansatz in terms of the various [tex]\Omega[/tex]'s ...

Fridger
Last edited by t00fri on 05.09.2008, 19:24, edited 3 times in total.
Image

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: Re:

Post #111by t00fri » 05.09.2008, 18:18

Cham wrote:...
Selden told me by email the formula that he used, for the distance formula :

[tex]d(z) = (c/H_{0})((1 + z)^2 - 1)/((1 + z)^2 + 1)[/tex]

This is the special relativistic Doppler formula only and doesn't take into consideration any gravitation effect at all. Yet, it's an approximation which gives, roughly, the same as the formula defined for the flat matter dominated scenario (at small and medium 'z'). Its limit is

[tex]d(\infty) = c/H_{0}[/tex]

which is half the value for the flat matter dominated scenario. In the case of small 'z', the Doppler formula gives back the Hubble law too.

Yes, here I agree completely. The fact that the relativistic corrections to the Doppler formula and the matter dominated flat Universe approximation are so similar, is at the root of why that simple analytic formula accounts correctly of the next correction in z to Hubble's law! And that rather independently from the underlying cosmological model ([tex]\Omega_\Lambda[/tex] etc).

Clearly the specific distance value for [tex]z\to \infty[/tex] is NOT reliable, but what is comforting is that it's a FINITE constant, characterizing the finite size (life time) of the Universe [tex]\propto c/H_0[/tex]


Fridger
Last edited by t00fri on 05.09.2008, 20:12, edited 1 time in total.
Image

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #112by t00fri » 05.09.2008, 18:29

Something entirely different:
I just noticed that this thread has been read

30196 times!

This is INSANE ;-) My first name must be famous by now :lol:

Fridger
Image

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: A script to mark ALL Fridger's galaxies

Post #113by Cham » 05.09.2008, 20:27

This is interesting. Here's a layer I made to show the redshift, with the Sloan distribution. The blue circles represents the redshift values for the classical flat space, matter dominated scenario (without any cosmological constant). The red arrows are pointing to the z = 1 and z = 2 circles. The red circles are associated to the scenario with [tex]\Omega_{\Lambda} = 0.73[/tex] and [tex]\Omega_{M} = 0.27[/tex] :
redshift.jpg


Maybe we should continue this discussion in the addon forum ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #114by t00fri » 05.09.2008, 20:44

Cham wrote:This is interesting. Here's a layer I made to show the redshift, with the Sloan distribution. The blue circles represents the redshift values for the classical flat space, matter dominated scenario (without any cosmological constant). The red arrows are pointing to the z = 1 and z = 2 circles. The red circles are associated to the scenario with [tex]\Omega_{\Lambda} = 0.73[/tex] and [tex]\Omega_{M} = 0.27[/tex] :
redshift.jpg


Maybe we should continue this discussion in the addon forum ?

Yes, I am aware of that difference, once z >= O(1). Because then we are getting quite sensitive to the specific underlying cosmology, and matter domination becomes increasingly incorrect. I think I even wrote this in one of my many emails to you.

I think this kind of discussion actually belongs to our CelestialMatters forum into the "Cosmological Visualization Project". Here at shatters, there is not much active interest and know-how in that subject, it seems to me ;-) . Usually, I am not interested in add-ons...

Fridger
Image

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: A script to mark ALL Fridger's galaxies

Post #115by Cham » 05.09.2008, 20:53

I'm starting to see a "large" deviation at z = 0.3. There's a 9% relative deviation, in this case. For z = 0.4, there's a 15% relative deviation between the [tex]\Omega_{\Lambda} = 0[/tex] and [tex]\Omega_{\Lambda} = 0.73[/tex] scenarios (relative to the later case).
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #116by t00fri » 05.09.2008, 21:05

Cham wrote:I'm starting to see a "large" deviation at z = 0.3. There's a 9% deviation, in this case. For z = 0.4, there's a 15% deviation between the [tex]\Omega_{\Lambda} = 0[/tex] and [tex]\Omega_{\Lambda} = 0.73[/tex] scenarios.

So what! As to my NGC/IC/local group galaxy data base (deepsky.dsc), the maximal value of z is for IC 2657: z= 0.184 corresponding to a distance of about 664 Mpc.

This maximal z value is so small that the sensitivity to the underlying cosmology is negligible! Notably in view of the fact that most distances above 500 Mpc are uncertain by more than 10 % anyway. So one has to consider the various uncertainties always in proper relation...

But clearly this discussion becomes highly relevant, if one turns to the proper regime of cosmological distances! Like I am going to address in Cosmo-Celestia one day ;-) ...As you noted, the Sloan data are already getting interesting in that respect...

Fridger
Image

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 17 years 1 month

Re: A script to mark ALL Fridger's galaxies

Post #117by BobHegwood » 05.09.2008, 21:20

t00fri wrote:I think this kind of discussion actually belongs to our CelestialMatters forum into the "Cosmological Visualization Project". Here at shatters, there is not much active interest and know-how in that subject, it seems to me ;-) .

Not fair...
Some of us are interested in the realistic demonstration of the Universe's properties even if we don't
know what the hell you are talking about half of the time. Well, okay, seven eighths of the time. :wink:
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #118by t00fri » 05.09.2008, 21:33

BobHegwood wrote:
t00fri wrote:I think this kind of discussion actually belongs to our CelestialMatters forum into the "Cosmological Visualization Project". Here at shatters, there is not much active interest and know-how in that subject, it seems to me ;-) .

Not fair...
Some of us are interested in the realistic demonstration of the Universe's properties even if we don't
know what the hell you are talking about half of the time. Well, okay, seven eighths of the time. :wink:

Bob,

I think that's perfectly fair ;-)

You and all other shatters users with a special interest in Cosmology are also friends of CelestialMatters and that's where that type of discussion fits best!

Over the years, I have written pages and pages of posts HERE, trying to trigger off an ACTIVE engagement for Cosmological visualization BEYOND Celestia.

However, apart from more or less sceptical remarks, there was never much echo, unfortunately. So ...


Fridger
Image

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: A script to mark ALL Fridger's galaxies

Post #119by Cham » 05.09.2008, 21:40

Here's a simple graph showing the differences between the matter dominated scenario (no cosmological constant) and the one with a CC :
distance.jpg
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: A script to mark ALL Fridger's galaxies

Post #120by t00fri » 05.09.2008, 21:55

Cham wrote:Here's a simple graph showing the differences between the matter dominated scenario (no cosmological constant) and the one with a CC :
distance.jpg

Martin,

please note that for the last official version of my deepsky.dsc database, the EXACT version (equivalent to my above Perl routine) of the comoving distance formula has been used to extract from given z values the galactic distances. So just for your info, I did not make any such low z approximation as we were discussing earlier.

In my Perlscript deepsky.pl in src/tools/galaxies, the respective subroutine is called
dcmr. It's located at the end of deepsky.pl.

I suppose in your above graph, you also entered [tex]\Omega_{M} = 0.27[/tex] besides [tex]\Omega_{\Lambda} = 0.73[/tex] as well as [tex]\Omega_{radiation}[/tex] in terms of 3 neutrinos...

Moreover, in your graph, you might also want to include the naive Hubble law distance d_Hubble = c*z/H0. Then you can appreciate how much better the first correction formula actually is...

Fridger
Image


Return to “Scripting”