
FFT in Igor pro with two sampling rates

Hi,
I want to get Fourier transformation (FFT) of the intensity data set that varies with time. I usually do this by going through the following path:
Analysis - Transforms - Fourier Transforms - Magnitude squared output type
I picked the starting data point and end data point to do the FFT transformation.
My question is, in the intensity data we collected, there are two different sampling rates for the time. (In other words, the time gap of intensity data is not same for all the data). So in that case, if I choose start and end point to do the FFT, will it give me a wrong FFT plot?
Or, Igor pro still do the FFT considering two sample rates together?
I appreciate any support! Thank you so much.
I recommend combining the two data sets by interpolating one or both sets to a common sampling rate. Once you have data for a single sampling rate you can transform it using the FFT.
Check out the documentation for the Interpolate2 operation.
HTH,
AG
June 10, 2025 at 12:45 pm - Permalink
Thanks for the message, AG. I got FFTs for the entire dataset which includes both sampling rates. D you think the obtained FFTs are not correct in this case?
June 10, 2025 at 12:49 pm - Permalink
It would help if you showed an example of your code. In the event that you have two waves: waveA and waveB and the two have different sampling rates, creating a concatenated wave, e.g.,
concatenate/NP=0 {waveA,waveB}, combinedWave
creates combined wave with the x-scaling of waveA (not waveB). This will clearly give you a wrong FFT.
If you created the combined wave using a different method you should check the wave scaling to see the sampling assigned. In many situations it is sufficient to use linear interpolation (unless the two sampling rates are radically different).
Note that it is usually a good idea to make sure that the combined wave is smooth at the connection point. A sharp discontinuity there will give you headaches unrelated to sampling rates.
June 10, 2025 at 01:00 pm - Permalink
What happens if you split the one wave into component waves, each having the two different sampling rates, and FFT each wave separately?
waveA = waveT[0,N]; waveB = waveT[N+1,inf]
Do you get the same results as when you choose the start and end times on the one wave?
June 10, 2025 at 03:08 pm - Permalink
Hi jjweimer, I did it as exactly you mentioned. Two FFT results (for the sampling rate 1 and 2) are slightly different when compared to the single FFT spectrum (which considered the entire data set irrespective of sampling rate). No big difference in frequencies, a small change. Two sampling rates are 2ps and 0.67 ps. Since the sampling rates have no big difference, can I consider the single spectrum (which covers the entire data set) frequencies are correct?
June 11, 2025 at 07:44 am - Permalink
The two sampling rates differ by a non-integer step. As AG says, you cannot sample over the one spectrum without interpolating to have the entire spectrum at the same sampling rate.
I would be curious what differences arise in the FFT when you first interpolate the entire spectrum with a sampling rate at 2ps versus with a sampling rate at 0.67ps. Apply these considerations.
* If your spectrum starts with a 2ps sampling rate, interpolate forward with this rate. Then, reverse the spectrum and interpolate forward with the 0.67ps sampling rate. This will assure that the interpolations in each case are taking the first part of the spectrum at is raw sampling rate before stepping into a region where interpolation is needed.
* If the discontinuity time step between the 2ps and 0.67ps rate regions is greater than 2ps in the first case, consider inserting a dummy point at a position that is half-way between the discontinuity. The same could be said of the inverse case. Set the value in a way to align not only the values between the jump but also to sustain a smooth slope between the two jumps.
June 11, 2025 at 08:29 am - Permalink
Remember that the FFT is linear so:
FFT[f(t)+g(t)]=FFT[f(t)]+FFT[g(t)].
Note that this relation holds when using FFT/OUT=1. If you are trying to calculate the spectrum you should consider using the DSPPeriodogram which allows you to reduce the bias in the calculation by dividing your input into sub intervals and averaging. The DSPPeriodogram is NOT linear (it is equivalent to FFT/OUT=4).
Also, I note that you used the term "intensity" in the original post. If you are measuring optical intensity data, it is proportional to the square of the field while Fourier Transforms used in calculating the propagation of optical fields apply to the field and not the intensities.
Another point that should be clarified: your original post does not state if the two sets of data correspond to the same signal sampled by two devices at different sampling rates or, if you have two disjoint time series (no overlap in time).
June 11, 2025 at 10:12 am - Permalink
Hi,
I have attached a data file here for your consideration. The intensities are corresponding to a Bragg peak collected during a diffraction experiment. We collected a series of diffraction pattern intensities by varying the time. Two sampling rates are in the same data set. I have highlighted them in yellow and green colors. But we collected intensity data for all the time values at once. This is not a two separate experiments.
June 11, 2025 at 10:20 am - Permalink
This is still a bit confusing. Consider that you have two separate experiments in one of three ways.
* Case 1: One experiment is collected at 2ps. Another experiment is collected at 0.67s. The collections are done *simultaneously over the same time period on the same Bragg peak* (perhaps with two different instruments). The only difference is in the sampling rate. This case is two separate experiments.
* Case 2: One experiment is collected at 2ps. Another experiment is collected at 0.67s. The collections are done *at two different time periods but on the same Bragg peak*. The differences are in the sampling rate and the time period, **nothing else**. This case is also two separate experiments.
* Case 3: One experiment is collected at 2ps and at some parametric condition A. Another experiment is collected at 0.67s and at some parametric condition B. The collections are done *at two different time periods but on the same Bragg peak*. The differences are in the sampling rate, the time period, and a parametric setting. This case is certainly two separate experiments.
In the first two cases, one proper approach is to do the FFT of each experiment separately. Another is to overlay/interleave the two data sets. In the third case, the only proper approach is to do the FFT of each experiment separately.
Please explain otherwise what defines your experimental conditions to certify that you can concatenate the two different sampling time segments together for analysis as one experiment.
June 11, 2025 at 12:41 pm - Permalink
Well, the case 1 is the most appropriate condition for our experiments though we used the same experimental setup. In our experiments, the time is actually a time delay between pump and probe signals. We can control the time delay while collecting the data. This is why we have two sampling rates for the time while collecting the data for the same experimental setup.
June 11, 2025 at 12:48 pm - Permalink
The best I can say without meaning to be bluntly dismissive is that you have two experiments. Analyze your data as such. You should not concatenate the two files, one sequentially after the other. My understanding of your experimental process is otherwise still too vague to offer other options.
June 11, 2025 at 01:29 pm - Permalink
I can only guess by looking at your data which contains two slopes in the first column. The smallest time interval is 0.666667 and the last data point is at 113.34 so I am guessing at 113.34/0.666667 is the number of points that are needed for a combined wave. I therefore execute:
You can now use the FFT operation on the combined wave. Note that since you have a small number of points, it is probably unwise to use DSPPeriodogram with any averaging.
June 11, 2025 at 01:45 pm - Permalink
AG ... The time values start at -44.66ps and end at 113.34ps, for a total of (exactly) 158ps. Interpolating with 2ps requires 80 points. Interpolating with 2/3ps requires 238 points.
I attach an experiment to show the outcomes. I purposely offset the two interpolation traces from the raw data set.
Short answer: Interpolate the raw data using a 2/3ps step to fill a 238 point wave to capture the high frequency near t=0. Interpolate the raw data using a 2ps step to capture the lower frequency "noise".
@jnranhil -- You seem to have two detectors running simultaneously. One steps in 2ps and one at 2/3ps. The 2ps detector starts sooner and goes longer in time. The 2/3ps detector starts later and ends sooner. It seems the 2/3ps detector is designed to capture the signal with greater time resolution around the t=0 period. I suspect that you will find distinct differences if you study the FFT on the 2ps interpolation versus the FFT on the 2/3ps interpolation. The latter may give you an additional peak at higher frequency that does not appear in the former.
I hope this gets you started down the right path for the translation of your data set(s).
June 12, 2025 at 03:20 pm - Permalink
Thank you so much @jjweimer. I'll closely look your answer and will get back to you. 😍😍
June 12, 2025 at 10:18 pm - Permalink