Python Phase shifting a measured signal directly in time domain

AI Thread Summary
The discussion centers on the performance of a phase-shifting algorithm for a time domain signal consisting of approximately 1000 points. The original algorithm, which directly shifts the signal in the time domain, was found to be unexpectedly slow. Participants noted that phase shifting is typically performed using a frequency domain approach, such as the Fast Fourier Transform (FFT), which may offer better performance. The conversation also highlighted the importance of knowing whether the shifting involves fixed time steps or interpolation for non-integer shifts, as the latter can significantly slow down execution. Ultimately, the author identified a critical mistake in their algorithm that increased the number of operations required, which has since been resolved, improving performance.
vco
Messages
48
Reaction score
15
I need to perform a phase shift for a measured time domain signal. The signal consists of around 1000 points. I wrote an algorithm for this in Python a while ago and it seems to work as intended, but now I noticed that the algorithm is actually unexpectedly slow.

Is it so that phase shifting is usually performed by first transforming the signal into frequency domain and then back to time domain once the shifting has been done? My algorithm does the phase shifting directly in time domain; is this the probable reason for the poor performance?

Edit: In other words (and maybe more specifically) I mean time-delaying a periodic signal. My data consists of a single period of the signal.
 
Last edited:
Technology news on Phys.org
How can we answer without knowing your algorithm. Is it a bucket brigade?
 
  • Like
Likes pbuk
Are you conditioning the signal or messaging the data?
 
vco said:
Edit: In other words (and maybe more specifically) I mean time-delaying a periodic signal. My data consists of a single period of the signal.
This is still not very specific. Are you just shifting the data a fixed number of time steps in the array? If so, it should be very fast. Are you interpolating in some way to time-shift a non-integer amount of time steps? In that case, it might take a long execution time, depending on your interpolation method.
 
anorlunda said:
How can we answer without knowing your algorithm.
Quite right. :smile: I was just wondering whether the "direct" approach was known to be significantly worse in terms of performance compared to the apparently more common FFT approach.

hutchphd said:
Are you conditioning the signal or messaging the data?
The original signal will be used as input/reference for certain engineering calculations where the signal is time-delayed by various amounts according to other inputs.

FactChecker said:
This is still not very specific. Are you just shifting the data a fixed number of time steps in the array? If so, it should be very fast. Are you interpolating in some way to time-shift a non-integer amount of time steps? In that case, it might take a long execution time, depending on your interpolation method.
Non-integer amount of time steps.

Anyway, there was a silly mistake in my algorithm which increased the required number of operations by a factor of order n, where n is the number of points in the signal. All is good now. :smile:
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Back
Top