# this is after all summing (using multiplication by cos instead of addition): (Pdb) p longvec[0] 8.797795339894686 # this is supposed to be the same, and isn't (Pdb) p (inserting_spectrum @ extracting_ift)[0] 0.5488135039273254 0413 (Pdb) complex_shortspace_freqs = fftfreq(complex = True, dc_offset = True, repetition_samples = len(randvec)) (Pdb) p complex_freq2time = create_freq2time(freqs=complex_shortspace_freqs) (Pdb) p complex_freq2time[:,0] array([0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j, 0.0625+0.j]) Since the index is zero, the first sample is the average of all the magnitudes. (Pdb) p extracting_ift[:,0] array([ 0.0625, -0. , 0.125 , -0. , 0.125 , -0. , 0.125 , -0. , 0.125 , -0. , 0.125 , -0. , 0.125 , -0. , 0.125 , -0. , 0.0625, -0. ]) extracting_ift is real-domain-only, so it is supposed to store some values doubled. It looks like they cancel and amplify. I made the wrong frequencies. These are the longspace ones. Oops. I should probably check the shortspace ones before the longspace ones. (Pdb) p randvec[0] 0.5488135039273248 Looks like the first value is right; so in theory something about my cosine code is wrong. Here's how it's generated properly: (Pdb) p (inserting_spectrum * extracting_ift[:,0]).sum() 0.5488135039273254 I'm remembering that I'm ignoring the doubling performed by the real-domain transform. That must be the next mistake.