Skip to content

unhashable type: 'MassMigration' in Model.py #30

@David-Peede

Description

@David-Peede

Hi Patrick and Dr. Eaton,

I was running through the documentation and I came across an error with Model.py which I naively think is due to pre msprime v 1.+ syntax not properly working. Here is how to recreate my error:

# Print versions of our libraries.
print('toytree', toytree.__version__)
print('ipcoal', ipcoal.__version__)

toytree 2.0.5
ipcoal 0.1.5

# Generate a random tree with 8 tips and height of 1M generations.
tree1 = toytree.rtree.unittree(8, treeheight=1e6, seed=123)
# Initialize a model object given a species tree and Ne setting.
model = ipcoal.Model(tree=tree1, Ne=1e5)

TypeError Traceback (most recent call last)
/tmp/ipykernel_3888/2875736.py in
1 # Initialize a model object given a species tree and Ne setting.
----> 2 model = ipcoal.Model(tree=tree1, Ne=1e5)

~/Applications/JupyterLab.app/Contents/Resources/jlab_server/lib/python3.8/site-packages/ipcoal/Model.py in init(self, tree, > Ne, admixture_edges, admixture_type, nsamples, mut, recomb, recomb_map, seed, seed_mutations, substitution_model, debug, **kwargs)
240
241 # get .ms_demography dict for msprime input
--> 242 self._get_demography()
243
244 # get .ms_popconfig as msprime input

~/Applications/JupyterLab.app/Contents/Resources/jlab_server/lib/python3.8/site-packages/ipcoal/Model.py in _get_demography(self)
577 source = max([i._schild for i in node.children])
578 time = node.height # int(node.height)
--> 579 demog.add(ms.MassMigration(time, source, dest))
580
581 # for all nodes set Ne changes

TypeError: unhashable type: 'MassMigration'

Additionally, when I run this on the binder from the documentation I get the same exact error. What is weird is that looking through the code for Model.py I can't seem to find where this issue is, which is why I am reaching out because I naively think the code base is totally up to date with the latest msprime code. Any help would be greatly appreciated!

-Dave

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions