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

Home » Public Forums » archive » Re: How to rebin complex array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to rebin complex array? [message #39019 is a reply to message #39016] Wed, 14 April 2004 00:39 Go to previous messageGo to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
On 13.04.04 at 15:57 -0700, Yunxiang Zhang wrote:

> I wanna do the following thing as fast as possible.
>
> ;creat a complex array
> a=complexarr(na)
> ;replicate the array k times
> b=rebin(a,na,k)
>
> But rebin won't accept complex array. :( What should I do?

This here is probably what you want:

a=complexarr(na) ; create a complex array
u = 1 + FLTARR(k) ; create unit vector with k elements
b = a # u ; matrix multiplication of a and u

By the way, there is a good reason for REBIN not to work on complex
arrays, and that is the fact that there is not really any proper way of
interpolating between two complex values. (You could argue that
next-neighbor sampling should still be possible.)

> Another similiar question is what is the best solution to replicate a 2d
> image eg dist(512,512) k times to get a k-frame "still movie" as a 3d array
> movie(512,512,k) without using any loops?

As previous posters have said, there's no reason why REBIN shouldn't work
here, given that DIST yields a real-valued result. But *if* you did have a
complex array that you wanted to replicate in the manner described above,
or if you want to avoid REBIN for some other reason, and not use loops,
then I'd probably do this:

s = SIZE(image)
movie = MAKE_ARRAY(s[1], s[2], TYPE=s[3])
movie[*] = image[*] # (1.0 + FLTARR(k))

Cheers,

Timm

--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading pixels from images from automated XYpositions
Next Topic: Re: Read & write data files b/w IDL & Fortran 90

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

Current Time: Wed Oct 08 15:45:10 PDT 2025

Total time taken to generate the page: 0.00388 seconds