Skip to content

Commit b80d291

Browse files
committed
Correct scaling of epoch breakpoints
1 parent 6fec400 commit b80d291

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tsdate/prior.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,16 +974,23 @@ def fill_priors(
974974
datable_nodes[ts.samples()] = False
975975
datable_nodes = np.where(datable_nodes)[0]
976976

977-
coalescent_rate = 1 / (2 * population_size[:, 1])
977+
"""
978+
Convert piecewise constant demographic history to coalescent units,
979+
then convert coalescent time grid to generations
980+
"""
981+
_, epoch_start, coalescent_rate = util.change_time_measure(
982+
np.array([0]), population_size[:, 0], 2 * population_size[:, 1]
983+
)
978984
generations, _, _ = util.change_time_measure(
979-
timepoints, population_size[:, 0], coalescent_rate
985+
timepoints, epoch_start, coalescent_rate
980986
)
981987

982988
prior_times = base.NodeGridValues(
983989
ts.num_nodes,
984990
datable_nodes[np.argsort(ts.tables.nodes.time[datable_nodes])].astype(np.int32),
985991
generations,
986992
)
993+
print(population_size)
987994

988995
# TO DO - this can probably be done in an single numpy step rather than a for loop
989996
for node in tqdm(

0 commit comments

Comments
 (0)