for star in cl_region:
if star[0] in id_list:
# Index of star in file.
i = id_list.index(star[0])
# Assign the probability stored in file for this star.
memb_probs_cl_region.append(memb_probs[i])
else:
# Stars not present in the list are assigned a fixed value.
memb_probs_cl_region.append(0.5)
N_not += 1
This block is the culprit