|
Re: Mean preserving interpolation (conservative interpolation) [message #81798 is a reply to message #81795] |
Tue, 16 October 2012 10:14  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Tuesday, October 16, 2012 12:52:39 PM UTC-4, Coyote wrote:
>
>
> The keyword you are looking for is MINUS_ONE:
>
>
While the /MINUS_ONE keyword works for your particular example, I don't believe it is a general solution. I'd suggest frebin.pro ( http://idlastro.gsfc.nasa.gov/ftp/pro/image/frebin.pro ) as a flux-conserving alternative to CONGRID.
IDL> x = randomn(seed,100)*10
IDL> y = congrid(x,367,/minus_one,/interp)
IDL> z = frebin(x,367)
IDL> print,mean(x),mean(y),mean(z)
-0.593289 -0.546786 -0.593280
|
|
|
Re: Mean preserving interpolation (conservative interpolation) [message #81799 is a reply to message #81798] |
Tue, 16 October 2012 09:52  |
DavidF[1]
Messages: 94 Registered: April 2012
|
Member |
|
|
Brigitte writes:
> When I interpolate y=congrid(x,ny,/interp) an array, the mean of the original array (x) is different from the mean of the interpolated array (y). Is there a function or keyword to preserve the mean?
The keyword you are looking for is MINUS_ONE:
IDL> x = (Findgen(100)+1)*4
IDL> print, Mean(x)
202.000
IDL> print, mean(congrid(x, 200, /minus_one))
202.000
IDL> print, mean(congrid(x, 5250, /minus_one))
202.000
IDL> print, mean(congrid(x, 5250, /interp, /minus_one))
202.000
IDL> print, mean(congrid(x, 367, /interp, /minus_one))
202.000
Cheers,
David
|
|
|