I center each point on my graph and take the rms with the points that are within 8's of that centered point. However, the points at the ends skew my results. I would like to know how to disregard these extreme points when removing the rms but without disregarding them in the total analysis
my code is
from scipy import spatial
# arvore dos dados(pontos azuis)
points2 = np.c_[x2.ravel(), y2.ravel(), z2.ravel()]
# pontos de contagens(pontos vermelhos)
points3 = np.c_[x3.ravel(), y3.ravel(), z3.ravel()]
# construo a arvore dos pontos azuis
tree = spatial.KDTree(points3)
# contagem usando os pontos vermelhos como centro de contagem
I = tree.query_ball_point(points3, 8)
x = np.array(points3[:, 0])
y = np.array(points3[:, 1])
sig8 = []
for i in range(len(I)):
# massa HI dos pontos de contagem
Mi = m2[I[i]]
sig8.append(np.sqrt(np.var(Mi)))
sig8 = np.array(sig8)
ax = plt.subplots(figsize=(10, 6), dpi=80)
plt.hist(sig8, bins=40)
print(np.mean(sig8))