Hi,
I like to use the new file2image2D field functionality.
I was not able to visualize our typical 2D surface meshes. Please find a file dump and a test routine attached.
I got the following error:
Traceback (most recent call last):
File "test.py", line 11, in <module>
matPlotFig = f.field2Image2D(title='Temperature', barRange=(0,9), matPlotFig=matPlotFig)
File "../../mupif/Field.py", line 458, in field2Image2D
xMin = vertexPointsArr[:,0].min()
IndexError: too many indices for array</module>
Can you help me to figure out what's wrong?
Thank you.
\Ralph
Dear Ralph,
the default parameter elevation = (-1.e-6, 1.e-6) picks up the 3rd coordinate, which should be 0.15 for your case. So calling field2Image2D() resulted in an empty dataset. I added log info into Field class that a dataset is empty to prevent such situations.
The fix is easy, just call
matPlotFig = f.field2Image2D(title='Temperature', elevation = (0.014, 0.016), figsize = (8,8), matPlotFig=matPlotFig)
At the end of script, the script kills the window and it disappears. If you need to keep the plot window open, call matPlotFig.waitforbuttonpress() or f.field2Image2DBlock().
Hope it helps. Vit
Thanks, Vit. Works like a charme.
(Shame on me. I set the wrong elevation values when testing this.)
Next question is:
Can I do this with multiple plots in a loop?
For example:
matPlotFig1 = fieldTemperature.field2Image2D(
title='Temperature',
elevation = (0.014, 0.016),
figsize = (8,8),
matPlotFig=matPlotFig1)
Unfortunately, only the second plot is updated in this case.
\Ralph