Re: data removal from array [message #51224] |
Sun, 05 November 2006 14:46 |
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 #51227 is a reply to message #51226] |
Sun, 05 November 2006 10:48  |
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  |
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.")
|
|
|