[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unwrap modulo 2pi



Dear Graham,
The function is written in PV-WAVE and NINT is a standard function giving
the integer value as a long.  I am sure that something similar does exist
in IDL.
In PV-WAVE you have also FIX, which returns the integer value as an
integer.

graham_wilson@my-deja.com wrote:

> Thank you! This is very close to what I want.  Would you mind
> posting the function 'nint' as well?
>
> GW
>
> In article <3A826338.62364176@iri.tudelft.nl>,
>   "Wim G. Bouwman" <w.g.bouwman@iri.tudelft.nl> wrote:
> > In the following bit of code the measured phase P is unwrapped onto
> > CALCPhi.
> > This is done by doing a 2nd order extrapolation of the three previous
> > points.  It works when the jumps are not too extreme.
> >
> > ;Correct Phi and PhiOne for 2Pi jumps. The calculated Phi is compared
> to
> > ;the experimentally obtained Phi. Extrapolation with least squares
> fit.
> > NPhi=N_ELEMENTS(P)
> > CALCphi=DBLARR(NPhi)
> > FOR i=3,(NPhi-1) DO BEGIN
> >  CALCphi(i)=(-2*P(i-3)+P(i-2)+4*P(i-1))/3
> >  Njumps=NINT((CALCphi(i)-P(i))/(2*!DPi), /Long)
> >  P(i)=P(i)+Njumps*2*!DPi
> > ENDFOR
> >
>
> Sent via Deja.com
> http://www.deja.com/

--

Dr. Wim G. Bouwman             phone (++31) (0)15 2786775
Interfacultair Reactor Instituut  fax (++31) (0)15 2788303
Technische universiteit Delft    w.g.bouwman@iri.tudelft.nl
Mekelweg 15                          http://www.iri.tudelft.nl/~bouwman
2629 JB Delft                         The Netherlands