(Pdb) p longvec[:16] array([0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.71518937, 0.71518937, 0.71518937, 0.71518937, 0.60276338, 0.60276338, 0.60276338, 0.60276338, 0.54488318, 0.54488318, 0.54488318]) (Pdb) p (inserting_spectrum @ inserting_ift)[:16] array([0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.5488135 , 0.71518937, 0.87543105, 0.82261755]) It looks like the first differing sample is the sixth, which is index 5. (Pdb) p longvec[5] 0.7151893663724195 (Pdb) p (inserting_spectrum @ inserting_ift)[5] 0.5488135039273259 It's also notable that inserting_spectrum @ inserting_ift is making a single sample of 0.71518937 . It should be too low frequency to make a single isolated sample like that. 0435 0437 Given the wave is scaled over time, the function that produces it should have its time parameter scaled by the same amount. The frequencies are passed directly as time parameter scalings, so they too should be scaled. It looks like the current code is doing that, but by a slightly different value: (Pdb) p fftfreq(len(randvec), complex = False, dc_offset = True) / fftfreq(len(randvec), complex = False, dc_offset = True, repetition_samples = short_duration) <string>:1: RuntimeWarning: invalid value encountered in divide array([ nan, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355, 12.31580355]) (Pdb) p short_duration / len(randvec) 23.09213164972691 (Pdb) p short_duration / len(randvec) /2 11.546065824863454