Skip to content

Interpolating on Cubic Grids Using Scipy #261

@Ali-Tehrani

Description

@Ali-Tehrani

Rather than re-inventing the wheel, Scipy has interpn that only works on regular grids (grid axes are orthogonal to coordinate axes) and offers many different kinds of interpolating "linear”, “nearest”, “slinear”, “cubic”, “quintic”, “pchip”, and “splinef2d”. “splinef2d” i"

The following code shows how easy it is using Grid to incorporate inside UniformGrid (assuming grid axes are orthogonal)

    
    x, y, z = grid_cube.get_points_along_axes()
    electro = interpn((x, y, z), electro_cube, kverts, method="linear")#method="cubic", bounds_error=True)

    print("Electro static mean, std, min, max", electro,np.mean(electro), np.std(electro), np.min(electro), np.max(electro))

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions