I have the data that has equivalent intervals and corresponding measurements at relevant points. As an example, here is the excerpt of the data I have:
y =[2.118, 2.1289, 2.1374, 2.1458, 2.1542, 2.1615, 2.1627, 2.165 2.1687...]
interval between the points is 0.1
So, what I need to get out of the data is the Amplitude spectrum (amplitude vs frequency) and also phase spectrum (phase angle vs frequency). In addition I should shift the phase of the data by negative 90 degrees (-pi/2).
Upon shifting the phase and leaving the amplitude untouched, I need to do the inverse fft and get the new signal. I want to do this in Python.
Could you please give me an example of performing this.
The code that I have used, was taken from another SO question, but I have done some modifications
## Perform FFT WITH SCIPY
signalFFT = np.fft.fft(y)
## Get Power Spectral Density
signalPSD = np.abs(signalFFT) ** 2
signalPhase = np.angle(signalFFT)
## Shift the phase py +90 degrees
new_signalPhase =(180/np.pi)*np.angle(signalFFT)+90
## Get frequencies corresponding to signal
fftFreq = np.fft.fftfreq(len(signalPSD), 0.1)
## Get positive half of frequencies
i = fftFreq>0
##
plt.figurefigsize=(8,4)
#plt.plot(fftFreq[i], 10*np.log10(signalPSD[i]));
plt.plot(fftFreq[i], new_signalPhase[i]);
plt.ylim(-200, 200);
plt.xlabel('Frequency Hz');
plt.ylabel('Phase Angle')
plt.grid()
plt.show()
The problem is that I want to regenerate the signal, with the same amplitudes but shifted phase. I know that the answer is smth related to ifft, but how should I prepare data for it? Could you please advice me the further steps.