I'm confused how to evaluate kde of 3D (x, y, z) data on a custom grid. I am trying to run below code:
import numpy as np
import pandas as pd
data=pd.read_excel('xyz.xlsx').to_numpy()
#Create a regular 3D grid with 256 points in each dimension
xmin, ymin, zmin = data.min(axis=0)
xmax, ymax, zmax = data.max(axis=0)
xi, yi, zi = np.mgrid[xmin:xmax:256j, ymin:ymax:256j, zmin:zmax:256j]
from KDEpy import FFTKDE
density = FFTKDE().fit(data).evaluate((xi, yi, zi))
It shows me this error "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()", how can I fix this? My goal is calculate density of (x,y,z) data in a custom grid, then create isosurface plot from this custom grid and density. Thank you for your help.
I'm confused how to evaluate kde of 3D (x, y, z) data on a custom grid. I am trying to run below code:
It shows me this error "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()", how can I fix this? My goal is calculate density of (x,y,z) data in a custom grid, then create isosurface plot from this custom grid and density. Thank you for your help.
Here is my 3D (x, y, z) data: https://docs.google.com/spreadsheets/d/1N0hoWf4jI9e7N_kov650jVxV8kdQI_La/edit?usp=sharing&ouid=108142352602992721076&rtpof=true&sd=true