I am having a spot of trouble with a seemingly simple problem. I have a list of atom coordinates in the format X,Y,Z. I have used numpy.linspace() to make a list of 'bins' from the Z coordinates. The Z coordinates are such that the difference between points after they are sorted may only decimals or whole numbers. I would like to move over the 'bins' and only add in the X,Y,Z of the coordinate sets that fall in the range 'bin0'-'bin1' then 'bin1-bin2'. Basically this is what I would like to do in some really bad pseudocode. I already have the evenly spaced numbers that I want to use as 'bin' ranges
1. Find XYZ coordinate sets that fall into first 'bin'
2. Do math on them and save the value out
3. Move on to next bin.
I know there is probably a simply python solution, but my understandings of list comprehensions working with ranges is limited. Any hints are greatly appreciated.
EDIT* tried to add a "SSCCE"
import numpy as np
xyz = [[2,-2,0.29],[ -2,0,1.9 ],[2,1,2.35],[2,-3,2.96],[ 2,0,4.97],[0,3,5.13],[-1,3,5.41]]
bins = [0,0.57,1.14,1.71,2.28,2.85555556, 3.42, 3.99, 4.56,5.14]
'''Now I want to add all of the xyz's with a z-value between 0 and .57 a list or somthing so that I can use them,
then I want to move on to the xyz's that fall between .57 and 1.14'''
workingXYZs = []
for x,y,z in xyz:
for i in bins:
if z > i: #but not greater than next I
#do math and move on to next interval