Skip to content

Commit 3c2ba76

Browse files
committed
Added the IPython extension. Updated examples and added a Jupyter notebook example.
1 parent 2e91bba commit 3c2ba76

File tree

7 files changed

+450
-22
lines changed

7 files changed

+450
-22
lines changed

examples/coin.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/env python3
22

3-
import sys
4-
5-
sys.path.append("..")
6-
73
import treeppl
84
import matplotlib.pyplot as plt
95
import seaborn as sns

examples/crbd.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/env python3
22

3-
import sys
4-
5-
sys.path.append("..")
6-
73
import treeppl
84
import numpy as np
95
import pandas as pd

examples/crbd.tppl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function walk(node: Tree, time:Real, lambda: Real, mu: Real) {
3030
}
3131
}
3232

33-
model function crbd(tree: Tree): Real[] {
33+
model function crbd(tree: Tree): Real[] {
3434
assume lambda ~ Gamma(1.0, 1.0);
3535
assume mu ~ Gamma(1.0, 0.5);
3636
walk(tree.left, tree.age, lambda, mu);

examples/generative_crbd.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
#!/usr/bin/env python3
22

3-
import sys
4-
5-
sys.path.append("..")
6-
73
import treeppl
84
from Bio import Phylo
95

106

11-
params = {
12-
"time": 5.0,
13-
"lambda": 1.0,
14-
"mu": 0.1
15-
}
7+
params = {"time": 5.0, "lambda": 1.0, "mu": 0.1}
168

17-
with treeppl.Model(filename="generative_crbd.tppl", samples=1) as generative_simulate:
18-
result = generative_simulate(**params)
9+
with treeppl.Model(filename="generative_crbd.tppl", samples=1) as generative_crbd:
10+
result = generative_crbd(**params)
1911
tree = result.samples[0]
2012
tree = Phylo.BaseTree.Clade(
21-
branch_length=params["time"] - tree.age,
22-
clades=[tree.to_biopython()]
13+
branch_length=params["time"] - tree.age, clades=[tree.to_biopython()]
2314
)
2415
Phylo.draw(tree)

examples/treeppl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../treeppl

0 commit comments

Comments
 (0)