I am coding in python and I am correlating a row in pandas (index 2500) with a sinusoidal function that I defined (sine_modulation). When I print the value I obtain by using
row_correlation(saved_data_DAQ.iloc[2500].values, sine_modulation(time_measurement,modulation_frequency_axion))
where row_correlation(f,g) is just defined as np.corrcoef(f, g)[0, 1]
I obtain 0.23. However, if I plot both functions I can visually see an extemely high degree of correlation (see image). This is expected because the blue curve is just random white noise (from a gaussian distribution) plus a constant times the sine modulation itself (blue = noise + C*red where C=0.002)
I would like to know why the correlation computed by this function is so low, but more importantly, do you have any idea or suggestion on how to compute a correlation that better reflects the high degree of correlation between my two functions?
You can also see zoom-in below
2