power spectrum code