Skip to content

Commit

Permalink
Adds control of the per-star per-result line MCMC parameters in sampl…
Browse files Browse the repository at this point in the history
…eMass to the YAML configuration
  • Loading branch information
argiopetech committed Jun 1, 2017
1 parent 724a8a5 commit 1bfafd7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions base9/Settings.cpp
Expand Up @@ -153,6 +153,8 @@ void Settings::fromYaml (const string& yamlFile)
scatterCluster.limitS2N = getOrRequest <double>(scatterConfNode, "limitS2N");
scatterCluster.crowded = getOrRequest <bool>(scatterConfNode, "crowded");

sampleMass.burnIters = getOrRequest <int>(sampleMassNode, "iters");
sampleMass.iters = getOrRequest <int>(sampleMassNode, "burnIters");
sampleMass.deltaMass = getOrRequest <double>(sampleMassNode, "deltaMass");
sampleMass.deltaMassRatio = getOrRequest <double>(sampleMassNode, "deltaMassRatio");

Expand Down
3 changes: 3 additions & 0 deletions base9/Settings.hpp
Expand Up @@ -110,6 +110,9 @@ class Settings

struct SampleMassSettings
{
int iters;
int burnIters;

double deltaMass;
double deltaMassRatio;
};
Expand Down
3 changes: 3 additions & 0 deletions conf/base9.yaml
Expand Up @@ -140,6 +140,9 @@ sampleWDMass:
# No sampleWDMass-specific settings yet

sampleMass:
burnIters: 1000
iters: 4000

deltaMass: 0.0005
deltaMassRatio: 0.001

Expand Down
9 changes: 3 additions & 6 deletions sampleMass/sampleMass.cpp
Expand Up @@ -256,7 +256,7 @@ class Application
}

void run();
std::tuple<double, double, double> sampleMass(const Isochrone&, StellarSystem);
std::tuple<double, double, double> sampleMass(const Isochrone&, StellarSystem, int, int);
};


Expand Down Expand Up @@ -341,7 +341,7 @@ void checkPriors(const Cluster &clust, const StellarSystem &s)
}


std::tuple<double, double, double> Application::sampleMass(const Isochrone &isochrone, StellarSystem star)
std::tuple<double, double, double> Application::sampleMass(const Isochrone &isochrone, StellarSystem star, const int burnIters, const int iters)
{
if (star.primary.mass < 0.1)
{
Expand All @@ -351,9 +351,6 @@ std::tuple<double, double, double> Application::sampleMass(const Isochrone &isoc
star.setMassRatio(tRat);
}

const int iters = 4000;
const int burnIters = 300;

std::ofstream nullstream;

double maxMass = 0;
Expand Down Expand Up @@ -525,7 +522,7 @@ void Application::run()
star.setMassRatio(0.0);
}

auto sampleTuple = sampleMass(*isochrone, star);
auto sampleTuple = sampleMass(*isochrone, star, settings.sampleMass.burnIters, settings.sampleMass.iters);

double postClusterStar = std::get<2>(sampleTuple);
postClusterStar *= (clust.getM_wd_up() - 0.15);
Expand Down

0 comments on commit 1bfafd7

Please sign in to comment.