[SciPy-User] re[SciPy-user] moving for loops...

mdekauwe mdekauwe at gmail.com
Tue Jun 8 17:08:30 EDT 2010


Hi,

Yes that works thanks again!!! I understand know what you mean about why I
need to broadcast the months as it is a different size to the arrays r and
c. Makes more sense!

 

josef.pktd wrote:
> 
> On Tue, Jun 8, 2010 at 12:00 PM, mdekauwe <mdekauwe at gmail.com> wrote:
>>
>> Similarly,
>>
>> mths = np.arange(12)
>> pts = np.arange(numpts)
>> out_array[mths, pts] = array[mths, 0, r, c]
> 
> If you want all months, this should work
> 
> out_array = array[:, 0, r, c]
> 
> or
> mths, r, c are all 1d but mths has different length, so needs broadcasting
> 
> out_array = array[mths[:,np.newaxis], 0, r, c]
> 
> or I guess
> 
> out_array[mths[:,np.newaxis], pts] = array[mths[:,np.newaxis], 0, r, c]
> 
> Josef
> 
>>
>> Does not work either...
>> --
>> View this message in context:
>> http://old.nabble.com/removing-for-loops...-tp28633477p28819859.html
>> Sent from the Scipy-User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
> 
> 

-- 
View this message in context: http://old.nabble.com/removing-for-loops...-tp28633477p28823221.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list