Power spectrum analysis, modified from codes of Hamner and Okamoto