[cctbxbb] Inconsistency between numpy and flex (sclice notation)
Jan Marten Simons
marten at xtal.rwth-aachen.de
Mon Jan 2 09:40:38 PST 2012
Hi,
I've found a minor inconveniance using the flex type:
test case:
import numpy as np
np_grid=np.double(np.zeros((3,7)))
np_grid[1,3]=3.0
print(np_grid) # works
print(np_grid[1,:]) # works
from cctbx.array_family import flex
grid=flex.double(flex.grid(3,7))
grid[1,3]=3.0
flex.show(grid) #works
flex.show(grid[1,:]) #gives error (see below)
"TypeError: All items must be of same type."
Is there another simple way to do sclices with flex arrays or could this be
implemented the same way as in numpy by someone who is more into c++ than
myself?
Thanks,
Jan
More information about the cctbxbb
mailing list