Here is one way to do it properly:
import numpy as np
#=======================================================================
def main():
t = np.arange( 0, 200 )
N = len( t )
signal1 = 0.1 * np.sin( .1 * t )
signal2 = 0.4 * np.sin( .1 * t + .35 )
rms_time1 = np.sqrt( np.sum( signal1 * signal1 ) / N )
rms_time2 = np.sqrt( np.sum( signal2 * signal2 ) / N )
q_time = rms_time1 / rms_time2
print q_time, rms_time1, rms_time2
dft1 = np.fft.fft( signal1 )
dft2 = np.fft.fft( signal2 )
dft1_real = np.real( dft1 )
dft1_imag = np.imag( dft1 )
dft2_real = np.real( dft2 )
dft2_imag = np.imag( dft2 )
rms_freq_real1 = np.sqrt( np.sum( dft1_real * dft1_real ) / N )
rms_freq_imag1 = np.sqrt( np.sum( dft1_imag * dft1_imag ) / N )
rms_freq_real2 = np.sqrt( np.sum( dft2_real * dft2_real ) / N )
rms_freq_imag2 = np.sqrt( np.sum( dft2_imag * dft2_imag ) / N )
rms_freq1 = np.sqrt( rms_freq_real1 * rms_freq_real1 \
+ rms_freq_imag1 * rms_freq_imag1 )
rms_freq2 = np.sqrt( rms_freq_real2 * rms_freq_real2 \
+ rms_freq_imag2 * rms_freq_imag2 )
q_freq = rms_freq1 / rms_freq2
print q_freq, rms_freq1, rms_freq2
print rms_freq1 / rms_time1
print rms_freq2 / rms_time2
print np.sqrt( 200 )
#=======================================================================
main()
The output is:
0.246138603222 0.0699023232816 0.283995774603
0.246138603222 0.988568136262 4.016306761
14.1421356237
14.1421356237
14.1421356237
Followup:
This is a more straightforward way to calculate the RMS of the DFT bins. I coded the sample above to more closely align with how I thought the OP was doing it.
sumsquares1 = np.real( np.sum( dft1 * dft1.conjugate() ) )
sumsquares2 = np.real( np.sum( dft2 * dft2.conjugate() ) )
rms_freq1 = np.sqrt( sumsquares1 / N )
rms_freq2 = np.sqrt( sumsquares2 / N )
q_freq = rms_freq1 / rms_freq2
print q_freq, rms_freq1, rms_freq2