-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssertionError #106
Comments
Hi @WoolenWolfff , this error occurs because sometimes the Laguerre-Voronoi tessellation does not contain every seed particle. This sort of thing creates issues when trying to trace from seed to polygon to mesh element. That's why I threw the AssertionError in there, to avoid that issue. In terms of getting your script to run, I would try to embed the for loop within main, rather than call main 5 times. I don't know what gets saved locally vs restarted new on each call. |
You write "I would try to embed the for loop within main, rather than call main 5 times". The thing is, I tried different ways, the point is that I can't get a normal result without an error if I run the code several times. Let's say even if I run it from a jupyter notebook cell, the code only runs once, then I get an AssertionError. Maybe there is some way to completely clear the seeds before a new generation? |
Could you post the file you're running so I can attempt to reproduce? |
I just copy the code from the
|
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: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!
The text was updated successfully, but these errors were encountered: