[Numpy-discussion] two tricky operations

Pete Shinners pete at shinners.org
Thu May 2 08:03:05 EDT 2002


help, i need help formatting some data in Numeric arrays. i can't quite 
seem to make it happen. here they come... (beware)


1: i want to create a simple 3d array, so that accessing it with any two 
indices gives me the same result as those two indices..
	myarray[1,2] == 1,2
	myarray[4,4] == 4,4
i would assume this just involves mixing two arange()'s together, but i 
can't seem to get them meshed together correctly. actually, this is 
something i think i'd want quite a bit, it'd be real real nice if arange 
could take multiple axes. :]  i thought this might be a good 
"fromfunction" situation, but i couldn't get that to go either.



2: i have a 3d array with image data (RGBs). i want to flatten only the 
first two dimensions so i have an array of RGB values. this one's got me 
completely stumped. i'm hoping there's just some function i'm not seeing 
in the docs, but i'd be just as happy with a bit of Numeric magic.



thanks, please, and all that good stuff!





More information about the NumPy-Discussion mailing list