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

Home » Public Forums » archive » IDL FFT (spec -> interferogram)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL FFT (spec -> interferogram) [message #30034] Thu, 04 April 2002 07:27 Go to next message
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
Hi all,

Having read through all of the FFT posts that google groups keeps, I am no
closer to understanding why I am unable to transform a spectrum into an
interferogram using IDL. All of the data files, procedures, and pictures
of this are at http://tulip.atm.ox.ac.uk/~rhskelto/fft-help/

Given two files:

1) 'spec.dat' contains 512 points of complex spectral data

2) 'igm.dat' contains 512 points of complex interferogram data that was
derived from 'spec.dat' using a prime factor FFT written in C. This is
the correct interferogram as far as I am concerned. The plot

Read in the data:

IDL> spec = dcomplexarr(512)
IDL> read_cmplx, 'spec.dat', spec
IDL> igm = dcomplexarr(512)
IDL> read_cmplx, 'igm.dat', igm

Plot the expected result:

IDL> plot, igm
IDL> write_jpeg,'igm.jpg',tvrd()

Do the Fourier Transform in IDL (based on Paul van Delst's examples):

IDL> spec2 = temporary( [ spec, reverse( spec[ 1: n_elements(spec) - 2 ] ) ] )
IDL> idl_igm = fft(temporary(spec2), /double, /inverse)
IDL> idl_igm = shift(idl_igm, -1 * (n_elements(spec)-1))

Plot the IDL result:

IDL> plot, idl_igm
IDL> write_jpeg, 'idl_igm.jpg', tvrd()


The result 'idl_igm' contains twice the number of points (minus 2)
because of the required reflection about the Nyquist frequency.
Moreover, the result appears to be modulated (almost like a frequency
chirp)? I recall having a similar problem with a 2pi phase-wrapping in
MathCad a number of years ago that gave similar results but I cannot
remember how to fix it. I also cannot seem to reproduce the AIRS
interferograms shown on Paul's site...

My question is, how do I get the desired result (i.e. 'igm.jpg') in IDL?

Cheers,
Randall

IDL Version 5.3, Linux RH 7.1
Re: IDL FFT (spec -> interferogram) [message #30083 is a reply to message #30034] Tue, 09 April 2002 07:04 Go to previous message
Robert Stockwell is currently offline  Robert Stockwell
Messages: 74
Registered: October 2001
Member
Paul van Delst wrote:

> Robert Stockwell wrote:
>


> However -- and I'm sure you know all this -- in practice, when you compute the flux density
> spectrum from the interferogram, you are not guaranteed to get a spectrum where the imaginary
> part is zero. If the interferogram is perfectly symmetric, sure. In practice, however, IFGs are
> typically asymmetric and this causes the imaginary part to be non-zero.


Ah yes, of course you are correct. For the benefit of any other readers (since Paul already
knows this), this non asymmetric interferogram is the typical case for real measurements.
That is to say, instead of sampling (ideally) at -2,-1,0,1,2 etc, you get an offset
such as samples at -1.8,-0.8,0.2,1.2 etc.
So you in fact sample a symmetric function asymmetrically.

One way of handling this is to record the interferogram on both sides of the ZPD (for a short
region) and calculate the spectrum from this "short interferogram", calculate the phase
function of the complex valued spectrum, and then calculate the necessary time domain kernel
to perform this "phase correction". Often, this kernel is combined with filter functions to
get the desired spectrum.


I forget what the original question was, but is that what the point was, how to
recover the original symmetric interferrogram from the "unphase corrected" spectrum?

Anyways, this thread reminded me of the good old days of running the Michelson
Interferometer measuring the night sky in the infra red, and desperately trying to
phase correct an un-phase-correctable instrument (and accepting that we'll have to keep
running double sided interferograms), while drinking copious amounts of beer.
Ah to be a grad student again. sigh...

-bob

> Assuming the IFG
> measurement is relatively quick (what you're observing hasn't changed) the IFG asymmetry is due
> to not knowing where the zero path difference (ZPD) occurs (or the lag of the autocorrelation
> is zero). By calculating the phase "error" it's possible to determine the correct ZPD and
> obtain a spectrum with zero (or close to numerical precision).
>
> That's also a reason why, in my examples that Randall mentioned, I'm doing all the spectrum
> folding and what not - I simulate double-sided interferograms rather than single-sided ones.
> Then any gross asymmetry is relatively easy to correct for.
>
> So, with apologies for the ramble, you're absolutely correct - I was just thinking of
> situations with interferometers which I've had to deal with, phase correcting the spectra and
> all.
>
> paulv
>
>
Re: IDL FFT (spec -> interferogram) [message #30102 is a reply to message #30034] Mon, 08 April 2002 15:00 Go to previous message
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
On Sat, 6 Apr 2002, Robert Stockwell wrote:

> complex-valued interferrogram?

Indeed you are correct. The interferogram is a mathematically real
quantity-- it is the observable in any interferometer I've ever worked on
which makes it real by definition (I think...).

> to shed a little light on it [1], in interferometry, the
> interferrogram is the autocorrelation function of the electric field
> vector. The power spectrum is the fft of the autocorrelation function.
> (this is a well known theorem, and if I only had a brain, I'd remember
> the name of it) Note the real value-ed-ness of "autocorrelation" and
> "power". The interferrogram is an even function, the power spectrum is
> real-valued.

Do you mean the Wiener-Khinchine-Einstein theorems? These basically state
that the autocorrelation function of the source (aka interferogram) must
be Fourier-transformed to retrieve the desired spectrum.

In most cases, interferometers do not truly measure an even (symmetric)
interferogram. At the level I am trying to deal with, experimental,
instrumental and computational limitations all introduce asymmetries.
Thus, complete reconstruction of the spectrum requires a complex FFT.
So, the spectrum is mathematically complex while the interferogram is
mathematically real.

Thanks to both Paul and you for your replies to my original post... To
put it mildly, last week wasn't one of my better weeks and, as it turns
out, I was doing something completely illogical. For perspective, I am
constructing an instrument model for an optical interferometer that
accounts for the known instrumental effects. I am therefore generally
already working in the Fourier (interferogram) domain. For one reason or
another, when it came to Fourier transforming my modulation function into
a spectral instrument lineshape function, I proceeded to use Paul's
"fft_to_interferogram" routine instead of "fft_to_spectrum." From that
point onwards, everything went down hill and I started thinking about
'interferograms' when I should have been thinking 'spectra.' In a
monumental moment of horror (Friday evening at 6:30 PM) I realized my
rather silly error... sigh. I then proceeded to take the entire weekend
off and enjoy the unseasonably nice British weather with my wife ;)

With luck, this will be a better week.

Thanks again for your comments!

Cheers,
Randall
Re: IDL FFT (spec -> interferogram) [message #30108 is a reply to message #30034] Mon, 08 April 2002 11:36 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Robert Stockwell wrote:
>
> Paul van Delst wrote:
>
>> But one doesn't always want the power spectrum. Usually (in my field at least) one wants the
>> complex valued spectrum where the imaginary component is known and happily zero. (Don't know if
>> Randall wants that tho')
>
>> paulv
>
> isn't that the same thing? ( real eq complex with imag=0)
> If the interferrogram is indeed the autocorrelation function,
> then the power spectrum is all you have, you cannot deduce
> any phase info.

First off, I think I slipped up on the terminology. When I saw "power spectrum" I thought
|spectrum|^2, but you are correct in that the autocorrelation function of the electric field is
the interferogram. What would be the flux density (power spectrum in your terminology) is what
I usually call "the spectrum". So I thought you meant the square of what I call the spectrum
and....well you see where I screwed up. Ehem.

> Having said that, it is conceivable that one can create a
> complex interferrogram (for instance, combining two different
> channels etc), but in the "usual" (i.e. that I am familiar with),
> an interferrogram is an scalar autocorrelation function.

However -- and I'm sure you know all this -- in practice, when you compute the flux density
spectrum from the interferogram, you are not guaranteed to get a spectrum where the imaginary
part is zero. If the interferogram is perfectly symmetric, sure. In practice, however, IFGs are
typically asymmetric and this causes the imaginary part to be non-zero. Assuming the IFG
measurement is relatively quick (what you're observing hasn't changed) the IFG asymmetry is due
to not knowing where the zero path difference (ZPD) occurs (or the lag of the autocorrelation
is zero). By calculating the phase "error" it's possible to determine the correct ZPD and
obtain a spectrum with zero (or close to numerical precision).

That's also a reason why, in my examples that Randall mentioned, I'm doing all the spectrum
folding and what not - I simulate double-sided interferograms rather than single-sided ones.
Then any gross asymmetry is relatively easy to correct for.

So, with apologies for the ramble, you're absolutely correct - I was just thinking of
situations with interferometers which I've had to deal with, phase correcting the spectra and
all.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
Re: IDL FFT (spec -> interferogram) [message #30111 is a reply to message #30034] Mon, 08 April 2002 10:34 Go to previous message
Robert Stockwell is currently offline  Robert Stockwell
Messages: 74
Registered: October 2001
Member
Paul van Delst wrote:


> But one doesn't always want the power spectrum. Usually (in my field at least) one wants the
> complex valued spectrum where the imaginary component is known and happily zero. (Don't know if
> Randall wants that tho')


> paulv



isn't that the same thing? ( real eq complex with imag=0)
If the interferrogram is indeed the autocorrelation function,
then the power spectrum is all you have, you cannot deduce
any phase info.

Having said that, it is conceivable that one can create a
complex interferrogram (for instance, combining two different
channels etc), but in the "usual" (i.e. that I am familiar with),
an interferrogram is an scalar autocorrelation function.

Cheers,
bob
Re: IDL FFT (spec -> interferogram) [message #30122 is a reply to message #30034] Mon, 08 April 2002 07:14 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Robert Stockwell wrote:
>
> Randall Skelton wrote:
>
>> Hi all,
>>
>> Having read through all of the FFT posts that google groups keeps, I am no
>> closer to understanding why I am unable to transform a spectrum into an
>> interferogram using IDL. All of the data files, procedures, and pictures
>> of this are at http://tulip.atm.ox.ac.uk/~rhskelto/fft-help/
>>
>> Given two files:
>>
>> 1) 'spec.dat' contains 512 points of complex spectral data
>>
>> 2) 'igm.dat' contains 512 points of complex interferogram data that was
>> derived from 'spec.dat' using a prime factor FFT written in C. This is
>> the correct interferogram as far as I am concerned. The plot
>
> complex-valued interferrogram?
>
> hmmmmm
>
> to shed a little light on it [1], in interferometry, the interferrogram is
> the autocorrelation function of the electric field vector.
> The power spectrum is the fft of the autocorrelation function.
> (this is a well known theorem, and if I only had a brain, I'd remember
> the name of it)
> Note the real value-ed-ness of "autocorrelation" and "power".
> The interferrogram is an even function, the power spectrum is real-valued.

But one doesn't always want the power spectrum. Usually (in my field at least) one wants the
complex valued spectrum where the imaginary component is known and happily zero. (Don't know if
Randall wants that tho')

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
Re: IDL FFT (spec -> interferogram) [message #30132 is a reply to message #30034] Sat, 06 April 2002 11:54 Go to previous message
Robert Stockwell is currently offline  Robert Stockwell
Messages: 74
Registered: October 2001
Member
Randall Skelton wrote:

> Hi all,
>
> Having read through all of the FFT posts that google groups keeps, I am no
> closer to understanding why I am unable to transform a spectrum into an
> interferogram using IDL. All of the data files, procedures, and pictures
> of this are at http://tulip.atm.ox.ac.uk/~rhskelto/fft-help/
>
> Given two files:
>
> 1) 'spec.dat' contains 512 points of complex spectral data
>
> 2) 'igm.dat' contains 512 points of complex interferogram data that was
> derived from 'spec.dat' using a prime factor FFT written in C. This is
> the correct interferogram as far as I am concerned. The plot



complex-valued interferrogram?

hmmmmm

to shed a little light on it [1], in interferometry, the interferrogram is
the autocorrelation function of the electric field vector.
The power spectrum is the fft of the autocorrelation function.
(this is a well known theorem, and if I only had a brain, I'd remember
the name of it)
Note the real value-ed-ness of "autocorrelation" and "power".
The interferrogram is an even function, the power spectrum is real-valued.

Of course, you can certainly have a spectrum that corresponds to a time series,
But that is just a fourier transform pair, nothing tricky there.


Cheers,
bob


[1] chortle chortle, i slay myself



There was a good book that I used to use. I don't think this is it:
Author Steel, W. H. (William Howard), 1920-
Title Interferometry
W.H. Steel Publisher Cambridge [Cambridgeshire] ; New York :
Cambridge University Press, 1983. Edition 2nd ed

and of course I insist you read Brigham's fft books if
you haven't already.
Re: IDL FFT (spec -> interferogram) [message #30156 is a reply to message #30034] Fri, 05 April 2002 07:36 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Randall Skelton wrote:
>
> To be perfectly honest, I'm not exactly sure why this works (yet). If
> anyone has any insight, I'd love to hear it! Otherwise, I'm off to the
> engineering library...

Bracewell's book is an oldie but a goodie. So is Bell's Introductory Fourier Transform
Spectroscopy.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Code code code
Next Topic: Alpha Blending

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

Current Time: Wed Oct 08 15:22:05 PDT 2025

Total time taken to generate the page: 0.00435 seconds