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)(N,3), one column per spatial axis, with N=217=131 072N=2^{17}=131\,072 samples. Consecutive samples of one axis therefore sit 2424 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 NN float64 values (8 bytes each) once each. ((a)) Using the fast-algorithm operation count Nlog⁡2NN\log_2N, state the number of operations needed to transform one axis of N=131 072N=131\,072 samples. Express the gathering cost, 2×8N2\times8N 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\sum_n(x_n-c)^2 over cc, whose stationarity condition gives c=xˉc=\bar x. After subtracting xˉ=0.02 m s−2\bar x = 0.02\,\mathrm{m\,s^{-2}}, the residual samples have variance 4×10−4 m2 s−44\times10^{-4}\,\mathrm{m^2\,s^{-4}} and are sampled at fs=2000 Hzf_s=2000\,\mathrm{Hz}. State the one-sided white-noise PSD level in m2 s−4 Hz−1\mathrm{m^2\,s^{-4}\,Hz^{-1}}, and verify Parseval's check against the Nyquist frequency.

Browse the problem library