Advertisement
Guest User

Untitled

a guest
May 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. def binfunctionII(stuff, binwidth):
  2. B = stuff[:,4]
  3. bins=np.linspace(min(B), max(B)+binwidth,
  4. ((max(B)+binwidth)-min(B))/binwidth)
  5. out = []
  6. for i in range(len(bins)-1):
  7. temp=(B>=bins[i])&(B<bins[i+1])
  8. out.append(stuff[temp])
  9. return out
  10.  
  11. for t in range(len(alldata)):
  12. certaindata = alldata[t]
  13. print t
  14. Vdata = certaindata[np.argsort(certaindata[:, 4])]
  15. print Vdata
  16. Vdatavals = list(binfunctionII(Vdata, 1))
  17.  
  18. [array([[ 12.11974609, 13.4 , 63.4 , 4.1 ,
  19. 129.98302733, 37.30872341]]),
  20. array([], shape=(0L, 6L), dtype=float64),
  21. array([], shape=(0L, 6L), dtype=float64),
  22. array([], shape=(0L, 6L), dtype=float64),
  23. array([[ 13.78698792, 16.12224827, 59. , 4.1 ,
  24. 174.01460895, 44.40542507]]),...]
  25.  
  26. [[12.11974609, 13.4, 63.4, 4.1, 129.98302733, 37.30872341],
  27. [13.78698792, 16.12224827, 59., 4.1, 174.01460895, 44.40542507],...]
  28.  
  29. Vdatavals = np.ndarray(binfunctionII(Vdata, 1)).tolist()
  30.  
  31. ValueError: sequence too large; must be smaller than 32
  32.  
  33. VdatavalsNONZERO = [x for x in Vdatavals if x != []]
  34.  
  35. #But this literally changes nothing
  36.  
  37. VdatavalsNONZERO = filter(None, Vdata)
  38.  
  39. ValueError: The truth value of an array with more than one element is ambiguous.
  40. Use a.any() or a.all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement