Re: Dynamic Spectrum [message #60574] |
Tue, 03 June 2008 06:24 |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
RussellGrew wrote:
> [skip]
>
> To get your y-axis correct you need to know the data sample rate and
> hence evaluate the Nyquist frequency. For instance if your data is
> sampled twice per second, you can only plot up to 1 Hz. The kHz data
> in the link you gave obviously requires large sample rates.
Or, actually, a spectrometer... ;-)
Ciao,
Paolo
|
|
|
Re: Dynamic Spectrum [message #60578 is a reply to message #60574] |
Mon, 02 June 2008 17:20  |
russell.grew
Messages: 74 Registered: February 2005
|
Member |
|
|
You might want to have a read of
Welch, 'The Use of Fast Fourier Transform for the Estimation of Power
Spectra: A Method Based on Time Averaging Over Short, Modified
Periodograms', IEEE Trans. Audio & Electroacoust., Volume AU-15, p.
70-73.
It's probably the simplest implementation of what you are trying to
do. It provides for overlapping FFT's and discusses windowing and
their compensation. Also theres a book by Hayes, 'Statistical Digital
Signal Processing and Modeling' that has a good chapter on power
spectrum estimation.
To get your y-axis correct you need to know the data sample rate and
hence evaluate the Nyquist frequency. For instance if your data is
sampled twice per second, you can only plot up to 1 Hz. The kHz data
in the link you gave obviously requires large sample rates. You need
to choose your FFT length to give an appropriate frequency resolution
to see what you are looking for in the data (if you have a 100 point
FFT over data with a 1 Hz Nyquist and drop the imaginary half of the
FFT, you are left with 1/50 = 0.02 Hz frequency resolution).
Fun times.
Russell.
|
|
|
Re: Dynamic Spectrum [message #60587 is a reply to message #60578] |
Mon, 02 June 2008 09:16  |
R.G. Stockwell
Messages: 363 Registered: July 1999
|
Senior Member |
|
|
<duxiyu@gmail.com> wrote in message
news:b89c97e8-2b45-4507-a70b-0f71cdb91a8e@p25g2000pri.google groups.com...
> Dear all,
>
> I have a set of data and their measued time.
> I want to get the similary Dynamic Spectrum which is shown in
> http://urap.gsfc.nasa.gov/www/reiner/spectra.html.
> Is there any IDL procedure to get the Dynamic Spectrum?
>
> Best regards,
> Du Jian
Hi Du Jian,
here is a link to a page that has IDL code to do a similar thing.
http://www.cora.nwra.com/stransform/
The file you would need is s_trans.pro, here is the direct link:
http://www.cora.nwra.com/~stockwel/rgspages/S-Transform/s_tr ans.pro
Here is a simple example:
ex_len = 512
ex_time = findgen(ex_len)
ex_freq = 5;ex_len/16
ex_ts = cos(2*!Pi*ex_freq*ex_time/ex_len)
ex_ts = cos(2*!Pi*(ex_len/5+2*ex_ts)*ex_time/ex_len)
; crossed chirp example commented out
;ex_ts = cos(2*!Pi*ex_freq*ex_time*(1+2*ex_time/ex_len)/ex_len)
;ex_ts = ex_ts + reverse(ex_ts)
!P.multi=[0,1,2]
plot,ex_ts,xtitle='Time (units)',title='Time Series [h(t) = cos(cos(wt))]'
s = s_trans(ex_ts,/samp, /AMPLITUDE,verbose=verbose) ; returns structure,
amps only returned
nlevels = 14
levels = findgen(nlevels)/(nlevels-1)*1.5
contour,s.st,ex_time,s.freq,levels=levels,/fill,xtitle='Time (units)', $
ytitle='Frequency (1/unit)',title='Amplitude of S-Transform'
end
Cheers,
bob
|
|
|
Re: Dynamic Spectrum [message #60593 is a reply to message #60587] |
Mon, 02 June 2008 06:17  |
jdu
Messages: 7 Registered: February 2008
|
Junior Member |
|
|
On Jun 2, 5:59 pm, Lasse Clausen <la...@lbnc.de> wrote:
> On 2 Jun, 10:23, "dux...@gmail.com" <dux...@gmail.com> wrote:
>
>
>
>> On Jun 2, 11:44 am, David Fanning <n...@dfanning.com> wrote:
>
>>> dux...@gmail.com writes:
>>>> I have a set of data and their measued time.
>>>> I want to get the similary Dynamic Spectrum which is shown in
>>>> http://urap.gsfc.nasa.gov/www/reiner/spectra.html.
>>>> Is there any IDL procedure to get the Dynamic Spectrum?
>
>>> I'm not sure you need a procedure. The picture you
>>> reference would take, at most, three IDL commands.
>
>>> Which have you tried that you are having trouble with?
>
>>> Cheers,
>
>>> David
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>> I think you misunderstood my meanings.
>> The data I have is a time series.
>> I want to know how to get the dynamic spectrum from the time series
>> data.
>
>> Can three IDL commands achive this purpose?
>
>> Du Jian
>
> No, I have the feeling we did not misunderstand what you meant. To me
> it seems that you have not understood what a dynamic spectrum is, if
> you don't mind me patronising you here. It is pretty straight forward
> to calculate a dynamic spectrum:
>
> Say you have the data in an array called boogidiboo.
> You then extract a certain subset of boogidiboo and calculate the FFT.
> Move the subset by a certain number of points and caluclate FFT.
> Move the subset by a certain number of points and caluclate FFT.
> Move the subset by a certain number of points and caluclate FFT.
> ...
>
> Or, as IDL code sniplet
>
> raw_fft = make_array(fft_len, number_of_ffts, /float)
> FOR i=0L, number_of_ffts-1L do begin
> data = boogidiboo[i*fft_len:(i+1L)*fft_len-1L]
> raw_fft[*,i] = FFT(data, -1)
> ENDFOR
>
> Ok, you could do that in three lines, I guess. ;-) However, you might
> want to think about tapering your data. Also, FFT returns complex
> numbers so if you want the FFT power, you need to do a ABS(raw_fft)^2.
> And also, FFT returns negative frequencies as well, which you can
> usually throw away. Read the IDL FFT help for more info.
>
> Cheers
> Lasse Clausen
Thank you very much!
It is very helpful.
Du Jian
|
|
|
Re: Dynamic Spectrum [message #60594 is a reply to message #60593] |
Mon, 02 June 2008 02:59  |
lasse
Messages: 48 Registered: February 2007
|
Member |
|
|
On 2 Jun, 10:23, "dux...@gmail.com" <dux...@gmail.com> wrote:
> On Jun 2, 11:44 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> dux...@gmail.com writes:
>>> I have a set of data and their measued time.
>>> I want to get the similary Dynamic Spectrum which is shown in
>>> http://urap.gsfc.nasa.gov/www/reiner/spectra.html.
>>> Is there any IDL procedure to get the Dynamic Spectrum?
>
>> I'm not sure you need a procedure. The picture you
>> reference would take, at most, three IDL commands.
>
>> Which have you tried that you are having trouble with?
>
>> Cheers,
>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> I think you misunderstood my meanings.
> The data I have is a time series.
> I want to know how to get the dynamic spectrum from the time series
> data.
>
> Can three IDL commands achive this purpose?
>
> Du Jian
No, I have the feeling we did not misunderstand what you meant. To me
it seems that you have not understood what a dynamic spectrum is, if
you don't mind me patronising you here. It is pretty straight forward
to calculate a dynamic spectrum:
Say you have the data in an array called boogidiboo.
You then extract a certain subset of boogidiboo and calculate the FFT.
Move the subset by a certain number of points and caluclate FFT.
Move the subset by a certain number of points and caluclate FFT.
Move the subset by a certain number of points and caluclate FFT.
...
Or, as IDL code sniplet
raw_fft = make_array(fft_len, number_of_ffts, /float)
FOR i=0L, number_of_ffts-1L do begin
data = boogidiboo[i*fft_len:(i+1L)*fft_len-1L]
raw_fft[*,i] = FFT(data, -1)
ENDFOR
Ok, you could do that in three lines, I guess. ;-) However, you might
want to think about tapering your data. Also, FFT returns complex
numbers so if you want the FFT power, you need to do a ABS(raw_fft)^2.
And also, FFT returns negative frequencies as well, which you can
usually throw away. Read the IDL FFT help for more info.
Cheers
Lasse Clausen
|
|
|
Re: Dynamic Spectrum [message #60595 is a reply to message #60594] |
Mon, 02 June 2008 02:23  |
duxiyu@gmail.com
Messages: 88 Registered: March 2007
|
Member |
|
|
On Jun 2, 11:44 am, David Fanning <n...@dfanning.com> wrote:
> dux...@gmail.com writes:
>> I have a set of data and their measued time.
>> I want to get the similary Dynamic Spectrum which is shown in
>> http://urap.gsfc.nasa.gov/www/reiner/spectra.html.
>> Is there any IDL procedure to get the Dynamic Spectrum?
>
> I'm not sure you need a procedure. The picture you
> reference would take, at most, three IDL commands.
>
> Which have you tried that you are having trouble with?
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
I think you misunderstood my meanings.
The data I have is a time series.
I want to know how to get the dynamic spectrum from the time series
data.
Can three IDL commands achive this purpose?
Du Jian
|
|
|
Re: Dynamic Spectrum [message #60596 is a reply to message #60595] |
Mon, 02 June 2008 01:39  |
lasse
Messages: 48 Registered: February 2007
|
Member |
|
|
On 2 Jun, 04:44, David Fanning <n...@dfanning.com> wrote:
> I'm not sure you need a procedure. The picture you
> reference would take, at most, three IDL commands.
I'd be interested to see those three commands, if you don't mind.
Cheers
Lasse Clausen
|
|
|
|