Skip to content

Commit

Permalink
Fix error validating number of demes when the genetic value input is a
Browse files Browse the repository at this point in the history
list and effect sizes are multivariate but the DES itself is not a list.
  • Loading branch information
molpopgen committed Nov 3, 2023
1 parent e25c4d6 commit 7905172
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions fwdpy11/_evolvets.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,19 @@ def evolvets(
assert isinstance(r, fwdpy11.mvDES), f"{type(r)}"
assert isinstance(r.des, fwdpy11.Sregion) # type: ignore
nd = demographic_model.number_of_demes()
if nd > params.gvalue.ndemes:
msg = f"maxmimum number of demes in model ({nd})"
msg += " is not compatible with genetic value"
msg += f" number of demes {params.gvalue.ndemes}"
raise ValueError(msg)
if isinstance(params.gvalue, list):
for g in params.gvalue:
if nd > g.ndemes:
msg = f"maxmimum number of demes in model ({nd})"
msg += " is not compatible with genetic value"
msg += f" number of demes {params.gvalue.ndemes}"
raise ValueError(msg)
else:
if nd > params.gvalue.ndemes:
msg = f"maxmimum number of demes in model ({nd})"
msg += " is not compatible with genetic value"
msg += f" number of demes {params.gvalue.ndemes}"
raise ValueError(msg)
if r.des.beg < 0:
raise ValueError(f"{r} has begin value < 0.0")
if r.des.end > pop.tables.genome_length:
Expand Down

0 comments on commit 7905172

Please sign in to comment.