Hello, this is probably one of those questions that is going to seem simple
after reading responses...

I'm trying to get the original array indices out of a row number from a
reshaped array... shouldn't this be possible somehow? 

import numpy as np
a = np.ones((3,5,10))
#for testing, I've done the following:
a[0,:,:5] = np.eye(5,5)*1
a[1,:,:5] = np.eye(5,5)*10
a[2,:,:5] = np.eye(5,5)*20

#Ok, so I reshape the array:
b = a.reshape(15,10)

#now I want to be able to 'back out' the original shape indices from the row
number of the new array.

#I thought I could do something like this:
d0,d1,d2 = a.shape
new_d0 = row/d1
new_d1 = row/d0

#But it doesn't quite work... any suggestions as to what I am missing?

-- 
View this message in context: 
http://www.nabble.com/probably-simple%2C-reverse-a-reshape...-tp22171584p22171584.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to