comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: data removal from array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: data removal from array [message #51224] Sun, 05 November 2006 14:46
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Actually, David's way is three times faster than that (I'm not sure why
the rebin takes so long?). But this is several times faster still...

array=reform(array,768,4915200/768,/overwrite)
array=array[0:639,*]
array=reform(array,n_elements(array),/overwrite)

regards,
Greg
Re: data removal from array [message #51226 is a reply to message #51224] Sun, 05 November 2006 12:12 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
How about this one...

result=array[where(rebin(indgen(768) lt 640,768,4915200/768) gt 0)]

regards,
Greg
Re: data removal from array [message #51227 is a reply to message #51226] Sun, 05 November 2006 10:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> IDL> indices = Where(a ge 1)

Whoops! Obviously, this should be:

IDL> indices = Where (a eq 1)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: data removal from array [message #51228 is a reply to message #51227] Sun, 05 November 2006 10:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
StevenM writes:

> I have an array of data of size 4915200, I want to keep data points
> 0:639 and get rid of the next 128 data points and then keep the next
> 640 and get rid of the next 128 and so on to the end of the array
> i.e.
>
> 0:639 keep
> 640:767 discard
> 768: 1407 keep
> 1408: 1536 discard

I should think something like this

IDL> a=bytarr(4915200)
IDL> for j = 0L,4915200-(640+1),(640+128) do a[j:j+639] = 1
IDL> indices = Where(a ge 1)
IDL> array = array[indices]

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: data removal from array
Next Topic: Finding distributor for new ergonomic product for CTS and RSI

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:44 PDT 2025

Total time taken to generate the page: 0.00917 seconds