[SciPy-User] Best method to pick-up every N-th sample of an array

Matthieu Rigal rigal@rapideye...
Wed Aug 11 03:29:47 CDT 2010

Thanks Ryan and Ben,

Indeed, this was a much better idea I had not explored...
It is much faster and directly usable on numpy arrays !
I just did not thought about it and I was looking hopeless for a numpy 
subfunction ...

Have a nice day,
Best regards,


On Tuesday 10 August 2010 17:12:01 scipy-user-request@scipy.org wrote:
> Would slicing the array help?
> >>> a = numpy.array([0, 1, 2, 3, 4, 5])
> >>> a[::2]   # every second element
> array([0, 2, 4])
> As a side benefit, you can save on memory because this 'slice' is actually
> a view into the original array.
> I hope that helps,
> Ben Root

RapidEye AG
Molkenmarkt 30
14776 Brandenburg an der Havel
Follow us on Twitter! www.twitter.com/rapideye_ag
Head Office/Sitz der Gesellschaft: Brandenburg an der Havel
Management Board/Vorstand: Wolfgang G. Biedermann
Chairman of Supervisory Board/Vorsitzender des Aufsichtsrates: 
Juergen Breitkopf 
Commercial Register/Handelsregister Potsdam HRB 17 796
Tax Number/Steuernummer: 048/100/00053
VAT-Ident-Number/Ust.-ID: DE 199331235
DIN EN ISO 9001 certified
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
The information in this e-mail is intended for the named recipients
only. It may contain privileged and confidential information. If you
have received this communication in error, any use, copying or
dissemination of its contents is strictly prohibited. Please erase all
copies of the message along with any included attachments and notify
RapidEye AG or the sender immediately by telephone at the number
indicated on this page.

More information about the SciPy-User mailing list