source: trunk/procs/spectrum.pro @ 169

Last change on this file since 169 was 169, checked in by pinsard, 15 years ago

add compile_opt idl2, strictarrsubs and subsequent modifications

  • Property svn:keywords set to Id
File size: 396 bytes
Line 
1;+
2;
3; From a time serie of length T=tinc*N
4; Return power spectrum and array of periods
5;
6; @version
7; $Id$
8;
9;-
10FUNCTION spectrum, ts, tinc
11;
12  compile_opt idl2, strictarrsubs
13;
14  N=n_elements(ts)
15  N21 = N/2
16  ps=ABS(FFT(ts, -1))
17  ps=ps[0:N21-1]
18
19  period=tinc*N/(findgen(N21)+0.0000000000001)
20  period[0]=99999999999.
21
22  ret=findgen(2,N21)
23  ret[1,*]=ps
24  ret[0,*]=period
25
26  return, ret
27end
Note: See TracBrowser for help on using the repository browser.