Skip to content

Rectangle mesh creation #103

@saintnever

Description

@saintnever

Hi,

I am trying to generate a square mesh for EIT reconstruction, but not sure how to do that.
I am generating the pts and passing to the mesh.create function like this

    p1 = np.array([0, 0])  # bottom-left
    p2 = np.array([5, 5]) # top-right

    # Generate a grid of points within this rectangle
    x = np.linspace(p1[0], p2[0], num=50)  # 20 points along x
    y = np.linspace(p1[1], p2[1], num=50)  # 10 points along y
    xx, yy = np.meshgrid(x, y)
    pts_r = np.c_[xx.ravel(), yy.ravel()]
    
    rect = rectangle0(pts_r)
    mesh_obj = mesh.create(n_electrodes, fd=rect)  

however, I get the following error:
Exception has occurred: ValueError
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions