Skip to content

Equation example gives error #9

@JennaVergeynst

Description

@JennaVergeynst

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?

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