Skip to content

Commit

Permalink
mt19937 fix + update approx thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroSant committed Sep 10, 2024
1 parent 199ef96 commit 771c7cf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
Binary file modified UserManual.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions src/EWF_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

namespace py = pybind11;

double dt_default = 0.08;
double bt_default = 0.025;
double dt_default = 0.1;
double bt_default = 0.04;

PYBIND11_MODULE(EWF_pybind, m) {
py::class_<WrightFisher>(m, "WrightFisher")
Expand Down
25 changes: 13 additions & 12 deletions src/WrightFisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10075,20 +10075,20 @@ void WrightFisher::DiffusionRunner(
ofstream saveFile;
saveFile.open(Filename);

boost::random::mt19937 gen;
int nosamples = 1, loader = max(static_cast<int>(floor(0.1 * nSim)), 1),
loader_count = 1;
while (nosamples < nSim + 1) {
if (non_neutral) {
saveFile
<< NonNeutralDrawEndpoint(x, startT, endT, Absorption, o, gen).first
<< "\n";
saveFile << NonNeutralDrawEndpoint(x, startT, endT, Absorption, o, WF_gen)
.first
<< "\n";
} else {
if (Absorption) {
saveFile << DrawUnconditionedDiffusion(x, endT - startT, o, gen).first
<< "\n";
saveFile
<< DrawUnconditionedDiffusion(x, endT - startT, o, WF_gen).first
<< "\n";
} else {
saveFile << DrawEndpoint(x, startT, endT, o, gen).first << "\n";
saveFile << DrawEndpoint(x, startT, endT, o, WF_gen).first << "\n";
}
}

Expand Down Expand Up @@ -10156,24 +10156,25 @@ void WrightFisher::BridgeDiffusionRunner(
ofstream saveFile;
saveFile.open(Filename);

boost::random::mt19937 gen;
int nosamples = 1, loader = max(static_cast<int>(floor(0.1 * nSim)), 1),
loader_count = 1;
while (nosamples < nSim + 1) {
if (non_neutral) {
saveFile << NonNeutralDrawBridgepoint(x, startT, endT, z, sampleT,
Absorption, o, gen)
Absorption, o, WF_gen)
.first
<< "\n";
} else {
if (Absorption) {
saveFile << DrawUnconditionedBridge(x, z, startT, endT, sampleT, o, gen)
saveFile << DrawUnconditionedBridge(x, z, startT, endT, sampleT, o,
WF_gen)
.first
<< "\n";
} else {
ThetaResetter();
saveFile << DrawBridgepoint(x, z, startT, endT, sampleT, o, gen).first
<< "\n";
saveFile
<< DrawBridgepoint(x, z, startT, endT, sampleT, o, WF_gen).first
<< "\n";
}
}

Expand Down
1 change: 1 addition & 0 deletions src/WrightFisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ ooO--(_)--Ooo-ooO--(_)--Ooo
Polynomial SelectionFunction, PhiFunction, AtildeFunction;
int thetaIndex;
vector<vector<double100>> akm;
boost::random::mt19937 WF_gen;

/// HELPER FUNCTIONS

Expand Down

0 comments on commit 771c7cf

Please sign in to comment.