sample_xy_plane#

cherab.lhd.tools.sample_xy_plane(func, x_range, y_range, z=0.0)#

Sample a 3D function over the specified range with X-Y coords at a certain Z-axis value.

Parameters:
funcCallable[[double, double, double], double]

Python function or Function3D object.

x_rangetuple[double, double, int]

X-axis sampling range: \((X_\text{min}, X_\text{max}, N)\), where \(N\) is the number of samples.

y_rangetuple[double, double, int]

Y-axis sampling range: \((Y_\text{min}, Y_\text{max}, M)\), where \(M\) is the number of samples.

zdouble, optional

Z-axis value to evaluate the function, by default 0.0.

Returns:
x_points(N, ) array_like

X-axis sample points.

y_points(M, ) array_like

Y-axis sample points.

function_samples(N, M) array_like

Sampled function values.

Examples

>>> def f1(x, y, z):
>>>     return x**3 + y**2 + z
>>>
>>> x_pts, y_pts, f_vals = sample_xy_plane(f1, (1, 3, 3), (1, 3, 3), 0.0)
>>> x_pts
array([1., 2., 3.])
>>> y_pts
array([1., 2., 3.])
>>> f_vals
array([[ 2.,  5., 10.],
       [ 9., 12., 17.],
       [28., 31., 36.]])