[R] NFFT on a Zoo?

Bob Cunningham FlyMyPG at gmail.com
Wed Nov 3 21:12:56 CET 2010

On 11/03/2010 12:27 PM, Gabor Grothendieck wrote:
> On Wed, Nov 3, 2010 at 2:59 PM, Bob Cunningham<FlyMyPG at gmail.com>  wrote:
>> I have an irregular time series in a Zoo object, and I've been unable to
>> find any way to do an FFT on it.  More precisely, I'd like to do an NFFT
>> (non-equispaced / non-uniform time FFT) on the data.
>> The data is timestamped samples from a cheap self-logging accelerometer.
>>   The data is weakly regular, with the following characteristics:
>> - short gaps every ~20ms
>> - large gaps every ~200ms
>> - jitter/noise in the timestamp
>> The gaps cover ~10% of the acquisition time.  And they occur often enough
>> that the uninterrupted portions of the data are too short to yield useful
>> individual FFT results, even without timestamp noise.
>> My searches have revealed no NFFT support in R, but I'm hoping it may be
>> known under some other name (just as non-uniform time series are known as
>> 'zoo' rather than 'nts' or 'nuts').
>> I'm using R through RPy, so any solution that makes use of numpy/scipy would
>> also work.  And I care more about accuracy than speed, so a non-library
>> solution in R or Python would also work.
>> Alternatively, is there a technique by which multiple FFTs over smaller
>> (incomplete) data regions may be combined to yield an improved view of the
>> whole?  My experiments have so far yielded only useless results, but I'm
>> getting ready to try PCA across the set of partial FFTs.
> Check out the entire thread that starts here.
> http://www.mail-archive.com/r-help@r-project.org/msg36349.html

Thanks for the instantaneous reply!

While I couldn't follow the details of that discussion, it seems the 
periodogram is intended to detect weak periodic signals in irregular 
data.  What I have is occasional strong signals of varying amplitude, 
duration and spectrum (events) in irregular data.

Are the two cases equivalent from the periodogram perspective?

Each event looks like an impulse with decaying oscillation (a smack 
followed by a fading ring), where the initial impulse can sometimes 
saturate the device.

I also don't yet know the bandwidth of the device: I do know that 
samples are taken at a nominal rate of 640 Hz, and I have about 4 
million samples.

My initial goal is to determine the accuracy of the timestamps:  Is the 
jitter in the time values real or not?  My initial plan was to do 2 
NFFTs:  One with unmodified data, and one with the time quantized 
(gridded) to periods of 1/640 Hz.  If the gridded FFT is 'sharper', then 
I'll know the time jitter is meaningless.

My secondary goal is to determine the signal bandwidth, with the hope of 
using a slower sampling rate, since rates of 160 Hz and below are free 
of gaps.

After that, I need to compare data from two devices taken under 
nominally identical conditions, to see if they record events 
equivalently (magnitude, duration, and frequency spectrum), with the 
goal being to determine a relative calibration for the pair of devices.

Finally, I'll take more data with the devices in separate (but linked) 
locations, to determine the mechanical characteristics of that 
environment.  After applying the calibration determined above, I'll 
again want to compare the events to quantify their differences.

Should I be pursuing analytical methods other than the NFFT?


More information about the R-help mailing list