#
# Compare to fig 4, of Hogg, D. W., "Distance measures in cosmology",
#   astro-ph/9905116
#

use strict;

use PDL;
use PDL::Graphics::PGPLOT;
use PGPLOT;

use blib;
use PDL::Astro::Cosmology;

# cosmologies - h0 is NOT irrelevant here!

my $a = new PDL::Astro::Cosmology { matter =>   1.0, lambda =>  0.0, h0 => 100.0 };
my $b = new PDL::Astro::Cosmology { matter =>  0.05, lambda =>  0.0, h0 => 100.0 };
my $c = new PDL::Astro::Cosmology { matter =>   0.2, lambda =>  0.8, h0 => 100.0 };

# z range
my $z = 0.1 * sequence(51);

# calculate the distance modulus
# - remembering that lum_dist() returns an answer in Mpc
my $d_a = 5.0 * log10( $a->lum_dist( $z ) ) + 25.0;
my $d_b = 5.0 * log10( $b->lum_dist( $z ) ) + 25.0;
my $d_c = 5.0 * log10( $c->lum_dist( $z ) ) + 25.0;

# plot the graph
dev;

env 0, 5, 40, 50;
pglabel "redshift z", "distance modulus DM + 5 log h (mag)", "";

hold;

line $z, $d_a, { LINESTYLE => 'solid' };
line $z, $d_b, { LINESTYLE => 'dotted' };
line $z, $d_c, { LINESTYLE => 'dashed' };

release;

## End of the test
exit;

