from pylab import *
from scipy.ndimage import measurements
L = 100
pv = [0.2,0.3,0.4,0.5,0.6,0.7]
z = rand(L,L)
for i in range(len(pv)):
p = pv[i]
m = z<p
lw, num = measurements.label(m)
area = measurements.sum(m, lw, index=arange(lw.max() + 1))
areaImg = area[lw]
subplot(2,3,i+1)
tit = 'p='+str(p)
imshow(areaImg, origin='lower')
title(tit)
axis()
I’m trying to run this code in vscode but it is showing this thing on terminal
DeprecationWarning: Please import label
from the scipy.ndimage
namespace; the scipy.ndimage.measurements
namespace is deprecated and will be removed in SciPy 2.0.0.
lw, num = measurements.label(m)
DeprecationWarning: Please import sum
from the scipy.ndimage
namespace; the scipy.ndimage.measurements
namespace is deprecated and will be removed in SciPy 2.0.0.
area = measurements.sum(m, lw, index=arange(lw.max() + 1))
It’s supposed to show this
i actually new and dont know how to import label and sum.
AGNAR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.