An accelerometer's driver returns each recording as a C-order (row-major) NumPy array…
PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Scientific programming for physicists · Scientific programming for physicists
Scientific Computing for Physicists, Ch Spectra with error bars: the fast transform, convolution and spectral estimation
Problem
An accelerometer's driver returns each recording as a C-order (row-major) NumPy array of float64 samples with shape (N,3), one column per spatial axis, with N=217=131072 samples. Consecutive samples of one axis therefore sit 24 bytes apart rather than next to each other (Chapter 1: arrays in memory). The analysis code gathers one axis into a contiguous block before transforming it, which costs reading and then writing N float64 values (8 bytes each) once each.
((a)) Using the fast-algorithm operation count Nlog2N, state the number of operations needed to transform one axis of N=131072 samples. Express the gathering cost, 2×8N bytes, as an equivalent number of 8-byte memory operations, and compare the two counts. Say which storage of the same data would make every axis contiguous, so that no copy is needed.
((b)) Before transforming, the mean offset of the axis is removed by a least-squares fit of a constant, the simplest unconstrained minimisation of Chapter 4: minimising ∑n(xn−c)2 over c, whose stationarity condition gives c=xˉ. After subtracting xˉ=0.02ms−2, the residual samples have variance 4×10−4m2s−4 and are sampled at fs=2000Hz. State the one-sided white-noise PSD level in m2s−4Hz−1, and verify Parseval's check against the Nyquist frequency.