(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor)
| 400 | return data.is_grid and channel(data).volume == 1 and data.spatial_rank == 3 |
| 401 | |
| 402 | def plot(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor): |
| 403 | dims = space.vector.item_names |
| 404 | xyz = StaggeredGrid(lambda x: x, math.extrapolation.BOUNDARY, data.geometry.bounds, data.resolution).staggered_tensor().numpy(dims + ('vector',))[:-1, :-1, :-1, :] |
| 405 | xyz = xyz.reshape(-1, 3) |
| 406 | values = data.values.numpy(dims).flatten() |
| 407 | if wrap(color == 'cmap').all: |
| 408 | color = 0 |
| 409 | col = matplotlib.colors.to_rgba(_plt_col(color)) |
| 410 | colors = np.zeros_like(values)[..., None] + col |
| 411 | norm_values = (values - min_val) / (max_val - min_val) |
| 412 | size = len(values) ** .3333 |
| 413 | exponent = size / 15 |
| 414 | alpha = float(alpha) * norm_values ** exponent |
| 415 | colors[..., -1] *= alpha |
| 416 | size = [data.dx.numpy()] * len(xyz) |
| 417 | cubes = plotCubeAt(xyz, size, colors) |
| 418 | subplot.add_collection3d(cubes) |
| 419 | |
| 420 | |
| 421 | def cuboid_data(min_xyz: np.ndarray, size=(1, 1, 1)): |
nothing calls this directly
no test coverage detected