I have the code below, which works, but I want a list of integers only. How do I get python to only append the integer, and not the (array) portion?
import numpy as np
import matplotlib.pyplot as p
icp4 = np.loadtxt(icp4_img)
ptm = np.loadtxt(ptm_img)
inside, outside = [], []
with np.nditer(icp4, op_flags=['readwrite']) as icp_it, np.nditer(ptm, op_flags=['readonly']) as ptm_it:
for icp, ptm in zip(icp_it, ptm_it):
if icp[...] > 800:
icp[...] = 1
else:
icp[...] = 0
if np.all(icp > 0):
inside.append(ptm)
else:
outside.append(ptm)
p.imshow(icp4, interpolation='nearest', cmap='gray')
p.show()
print(insdie)
>>>[array(435.), array(945.), array(761.)]
if ptm.shape == ()does not change the output