Skip to content

Commit a1173c7

Browse files
nspopehyanwong
authored andcommitted
fix cli tests
1 parent 3476835 commit a1173c7

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

tests/test_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def test_default_values(self):
5757
assert args.population_size is None
5858
assert args.mutation_rate is None
5959
assert args.recombination_rate is None
60-
assert args.epsilon == 1e-10
60+
assert args.epsilon == 1e-8
61+
assert args.min_branch_length == 1e-8
6162
assert args.num_threads is None
6263
assert args.probability_space is None # Use the defaults
6364
assert args.method == "variational_gamma"

tests/test_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ def test_node_metadata_inside_outside(self):
15461546
)
15471547
algorithm = InsideOutsideMethod(ts, mutation_rate=1, population_size=10000)
15481548
mn_post, *_ = algorithm.run(
1549-
eps=1e-10,
1549+
eps=1e-8,
15501550
outside_standardize=True,
15511551
ignore_oldest_root=False,
15521552
probability_space=tsdate.node_time_class.LOG_GRID,
@@ -1743,7 +1743,7 @@ def test_sites_time_insideoutside(self):
17431743
dated = tsdate.inside_outside(ts, mutation_rate=1, population_size=1)
17441744
algorithm = InsideOutsideMethod(ts, mutation_rate=1, population_size=1)
17451745
mn_post, *_ = algorithm.run(
1746-
eps=1e-10,
1746+
eps=1e-8,
17471747
outside_standardize=True,
17481748
ignore_oldest_root=False,
17491749
probability_space=LOG_GRID,

tsdate/cli.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,20 @@ def tsdate_cli_parser():
124124
type=float,
125125
default=core.DEFAULT_EPSILON,
126126
help=(
127-
"Specify minimum distance separating time points. Also "
128-
"specifies the error factor in time difference calculations. "
127+
"Specify the error factor in time difference calculations. "
129128
f"Default: {core.DEFAULT_EPSILON}"
130129
),
131130
)
131+
parser.add_argument(
132+
"-b",
133+
"--min-branch-length",
134+
type=float,
135+
default=core.DEFAULT_MIN_BRANCH_LENGTH,
136+
help=(
137+
"Specify the minimum difference in age between parent and child nodes. "
138+
f"Default: {core.DEFAULT_MIN_BRANCH_LENGTH}"
139+
),
140+
)
132141
parser.add_argument(
133142
"--method",
134143
choices=["inside_outside", "maximization", "variational_gamma"],
@@ -169,7 +178,7 @@ def tsdate_cli_parser():
169178
),
170179
default=None,
171180
)
172-
# TODO array specification from file?
181+
# arguments for discrete time methods
173182
parser.add_argument(
174183
"-n",
175184
"--population_size",
@@ -283,7 +292,7 @@ def run_date(args):
283292
params = dict(
284293
recombination_rate=args.recombination_rate,
285294
method=args.method,
286-
eps=args.epsilon,
295+
min_branch_length=args.min_branch_length,
287296
progress=args.progress,
288297
max_iterations=args.max_iterations,
289298
rescaling_intervals=args.rescaling_intervals,
@@ -299,6 +308,7 @@ def run_date(args):
299308
population_size=args.population_size,
300309
recombination_rate=args.recombination_rate,
301310
method=args.method,
311+
min_branch_length=args.min_branch_length,
302312
eps=args.epsilon,
303313
progress=args.progress,
304314
probability_space=args.probability_space,

0 commit comments

Comments
 (0)