comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Complex rebin

Re: Complex rebin
type: item
description: > Any reason why REBIN doesn't take complex args? I can't say why REBIN doesn't take complex args, but I can say that you have to be very careful when you interpolate complex values if you want to have meaningful results. Consider these two numbers z1 = complex(1,0) = 1. z2 = complex(-1,0) = -1. Suppose you were using rebin to redice the size of a linear array by 2. Which of the following behaviors would you want? You could separately average x and y like this, and get zero: z_avg = (complex(1,0) + complex(-1,0))/2. = complex(0,0) = 0 Or, you could respect the fact that the phase changes by 180 degrees but the amplitude doesn't change at all. So, z_avg = complex(0,1) = i This second value would come from z1 = r1*exp(i*theta1) z2 = r2*exp(i*theta2) ;--- note i = complex(0,1) z_avg = ((r1+r2)/2.) * exp(i * (theta1+theta2)/2.) To accomplish the first mode, you could break up and separately REBIN real(a) and imaginary(a). To accomplish the second mode, you could break up ans separately REBIN abs(a) and atan(a, /phase) M. Katz
creator: MKatz843
date: 2003-03-27T02:35:05-00:00

Re: Complex rebin
type: item
description: Ahh, of course. I knew it would be something like that - I had a similar problem with MEDIAN a few months ago. I'm only using REBIN to expand a 2D array to 3D (containing the same values) so I just separated Re and Im and REBINned them separately, easy. Thanks.
creator: the_cacc
date: 2003-03-27T14:24:55-00:00

Re: Complex rebin
type: item
description: MKatz843@onebox.com (M. Katz) writes: >> Any reason why REBIN doesn't take complex args? > > I can't say why REBIN doesn't take complex args, but I can say that > you have to be very careful when you interpolate complex values if you > want to have meaningful results. > > Consider these two numbers > z1 = complex(1,0) = 1. > z2 = complex(-1,0) = -1. > > Suppose you were using rebin to redice the size of a linear array by > 2. > Which of the following behaviors would you want? > > You could separately average x and y like this, and get zero: > z_avg = (complex(1,0) + complex(-1,0))/2. = complex(0,0) = 0 This one. It's what all the other flavors of REBIN do. It's the "compress" form of REBIN that I would be really interested in, i.e. the ability to sum up loads of complex values. Craig -- ------------------------------------------------------------ -------------- Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response ------------------------------------------------------------ --------------
creator: Craig Markwardt
date: 2003-03-28T09:12:26-00:00