Skip to content
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

Equation example gives error #9

Open
JennaVergeynst opened this issue Dec 20, 2017 · 0 comments
Open

Equation example gives error #9

JennaVergeynst opened this issue Dec 20, 2017 · 0 comments

Comments

@JennaVergeynst
Copy link

Hi,

I installed stl_tools, but when I try the equation example:

from pylab import imread
from stl_tools import numpy2stl, text2png, text2array

text = ("$\oint_{\Gamma} (A\, dx + B\, dy) = \iint_{U} \left(\\frac{\partial "
        "B}{\partial x} - \\frac{\partial A}{\partial y}\\right)\ dxdy$ \n\n "
        "$\\frac{\partial \\rho}{\partial t} + \\frac{\partial}{\partial x_j}"
        "\left[ \\rho u_j \\right] = 0$")
text2png(text, "Greens-Theorem_Navier-Stokes", fontsize=50) #save png

A = imread("Greens-Theorem_Navier-Stokes.png") # read from rendered png
A = A.mean(axis=2) #grayscale projection
A = gaussian_filter(A.max() - A, 1.)

numpy2stl(A, "Greens-Theorem_Navier-Stokes.stl", scale=0.2, mask_val = 5.)

This gives following error:

ValueError                                Traceback (most recent call last)
<ipython-input-78-d36112c9354d> in <module>()
     12 A = gaussian_filter(A.max() - A, 1.)
     13 
---> 14 numpy2stl(A, "Greens-Theorem_Navier-Stokes.stl", scale=0.2, mask_val = 5.)

/Applications/miniconda3/envs/work/lib/python3.5/site-packages/stl_tools/numpy2stl.py in numpy2stl(A, fn, scale, mask_val, ascii, max_width, max_depth, max_height, solid, min_thickness_percent, force_python)
    187             facets = np.concatenate([facets, bottom])
    188 
--> 189     xsize = facets[:, 3::3].ptp()
    190     if xsize > max_width:
    191         facets = facets * float(max_width) / xsize

ValueError: zero-size array to reduction operation maximum which has no identity

This is the same error as when I use it for my own numpy arrays. Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant