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

Home » Public Forums » archive » Re: re-binning with linear interpolation
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: re-binning with linear interpolation [message #76368 is a reply to message #76367] Wed, 01 June 2011 06:35 Go to previous messageGo to previous message
abc is currently offline  abc
Messages: 46
Registered: March 2011
Member
On Jun 1, 11:55 am, Wox <s...@nomail.com> wrote:
> On Wed, 1 Jun 2011 01:17:10 -0700 (PDT), abc <deearvin...@gmail.com>
> wrote:
>
>> I want to re-bin the wavelength at a step of 1 A and also the flux at
>> the same step but with linear interpolation.
>
> a=[[5201.720215,0.0097],$
>    [5205.345215,0.0088],$
>    [5208.970703,0.0080],$
>    [5212.596191,0.0094],$
>    [5216.221680,0.0133],$
>    [5219.846680,0.0167],$
>    [5223.472168,0.0169],$
>    [5227.097656,0.0156],$
>    [5230.722656,0.0145],$
>    [5234.348145,0.0138],$
>    [5237.973633,0.0130],$
>    [5241.599121,0.0118],$
>    [5245.224121,0.0110],$
>    [5248.849609,0.0116],$
>    [5252.475098,0.0134],$
>    [5256.100586,0.0147],$
>    [5259.725586,0.0139],$
>    [5263.351074,0.0126]]
>
> ; New wavelengths
> b=floor(a[0,0])
> e=ceil(a[0,-1])
> inc=1.
> x=b+inc*lindgen(1,(e-b)/inc+1)
>
> ; Linear interpolate flux
> y=interpol(a[1,*],a[0,*],x)
>
> ; Plot
> pa=plot(a,'+r-')
> pb=plot(x,y,'+-',/overplot)

Dear Wox,
Thanks a lot for your help. I tried to run the program as
u mention and it works fine. But the problem is that as you took
e=ceil(a[0,1]) it stops at 5206A. and it is not proceeding further. I
have total 30000 data point. and I want to run the code for all of
them.
I tried with
b=floor(a[0,*])
e=ceil(a[0,*])
but then I am getting an error
"LINDGEN: Expression must be a scalar or 1 element array in this
context: <LONG Array[1, 18]".

hope you understand the my problem.

Again thanks for the prompt response.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: International Help Needed
Next Topic: Re: colorbar inside the plot

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

Current Time: Sat Oct 11 21:33:16 PDT 2025

Total time taken to generate the page: 0.72197 seconds