Skip to content
Snippets Groups Projects
Commit f6666f97 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

update gaia script

parent 0f02c4c5
No related branches found
No related tags found
No related merge requests found
...@@ -57,8 +57,9 @@ $population->parse_args(); ...@@ -57,8 +57,9 @@ $population->parse_args();
# #
# #
# duplicity is 0 for single stars, 1 for binary stars # duplicity is 0 for single stars, 1 for binary stars
# and 2 for a mixed population sampled at equal times # 2 for a mixed population
my $duplicity = 1; # 3 for a mixed population sampled at equal times
my $duplicity = 2;
if($duplicity == 0) if($duplicity == 0)
{ {
...@@ -82,9 +83,9 @@ elsif($duplicity == 1) ...@@ -82,9 +83,9 @@ elsif($duplicity == 1)
{ {
# make a population of binary stars # make a population of binary stars
my $resolution = { my $resolution = {
m1 => 10, m1 => 100,
q => 10, q => 100,
P => 10 P => 100
}; };
my $mmin = 0.1; my $mmin = 0.1;
my $mmax = 80.0; my $mmax = 80.0;
...@@ -134,6 +135,26 @@ my \$eccentricity = 0.0; ...@@ -134,6 +135,26 @@ my \$eccentricity = 0.0;
'dphasevol'=>'$dln10per' 'dphasevol'=>'$dln10per'
); );
} }
elsif($duplicity == 2)
{
# Make a mixed population of single and binary stars
my $res = 100;
distribution_functions::bastard_distribution(
$population, {
mmin =>0.1,
mmax =>80.0,
nm1 => $res,
m2min =>0.1,
nm2 => $res,
nper => $res,
qmin =>0.0,
qmax =>1.0,
necc =>undef,
useecc =>undef,
agbzoom =>0,
time_adaptive=>undef,
});
}
else else
{ {
# Make a mixed population of single and binary stars # Make a mixed population of single and binary stars
...@@ -312,7 +333,8 @@ sub output ...@@ -312,7 +333,8 @@ sub output
open(my $fp, '>', $f)||die("cannot write to $f"); open(my $fp, '>', $f)||die("cannot write to $f");
print {$fp} "# GaiaHRD for binary fractions\n# Columns are : Teff, L, binary fraction\n"; print {$fp} "# GaiaHRD for binary fractions\n# Columns are : Teff, L, binary fraction\n";
my @teffs = uniq (keys %{$HRD->{0}}, keys %{$HRD->{1}}); my @teffs = uniq (keys %{$HRD->{0}},
keys %{$HRD->{1}});
foreach my $Teff (nsort @teffs) foreach my $Teff (nsort @teffs)
{ {
...@@ -321,10 +343,27 @@ sub output ...@@ -321,10 +343,27 @@ sub output
foreach my $L (nsort @Ls) foreach my $L (nsort @Ls)
{ {
my $Ltot = $HRD->{0}->{$Teff}->{$L}//0.0 + $HRD->{1}->{$Teff}->{$L}//0.0; my $dtp_both =
if($Ltot > 0.0) ($HRD->{0}->{$Teff}->{$L}//0.0) +
($HRD->{1}->{$Teff}->{$L}//0.0);
if($dtp_both > 0.0)
{ {
outbox($fp,$Teff,$L,$HRD->{1}->{$Teff}->{$L}/$Ltot); my $binfrac = $HRD->{1}->{$Teff}->{$L}/$dtp_both;
if($binfrac > 1)
{
printf "Binfrac = %g > 1 from %g %g sum %g\n",
$binfrac,
$HRD->{0}->{$Teff}->{$L},
$HRD->{1}->{$Teff}->{$L},
$dtp_both;
exit;
}
outbox($fp,
$Teff,
$L,
$binfrac);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment