Skip to content

AssertionError #106

@WoolenWolfff

Description

@WoolenWolfff

Hello!
If I run grain_neighborhoods.py once from the IDE by simply pressing "run" - everything works fine, a new image is generated each time. But if I want, say, to run it several times in a row, like this:

def main(num):
# here is the code from rain_neighborhoods.py

for i in range(5):
    main(i)

As a result, I do not get images with the names "trimesh0.png", "trimesh1.png", ..., but get an AssertionError. The same thing happens if you try to run a cell several times in jupyter:


AssertionError Traceback (most recent call last)
Cell In[2], line 79
76 repl_seeds.append(ring_seed)
78 #Create polygon and triangle meshes
---> 79 pmesh = msp.meshing.PolyMesh.from_seeds(repl_seeds, domain)
80 phases = [{'material_type': 'solid'} for i in range(4)]
81 phases[0]['material_type'] = 'matrix'

File
\microstructpy\src\microstructpy\meshing\polymesh.py:639, in PolyMesh.from_seeds(cls, seedlist, domain, edge_opt, n_iter, verbose)
636 removing_pts = False
638 missing_seeds = set(range(len(seedlist))) - set(bkdwn2seed)
--> 639 assert not missing_seeds, str(missing_seeds)
640 # compute voronoi diagram
641 voro_fun = {2: pyvoro.compute_2d_voronoi,
642 3: pyvoro.compute_voronoi}[n_dim]

AssertionError: {2, 11, 1038, ....}


If I understand correctly, the problem is that "missing_seeds" is not empty. I just don't understand how to fix it.
In the future, I will need to generate many different structures with different parameters. I would like to automate this. But until this problem is solved, I'm afraid it will not be possible.

Please help me solve this problem!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions