-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timescale #900
Timescale #900
Conversation
Some ongoing work to match the |
Beware pitfall with fft vs rfft. They do not return the same number of samples. I often stumble inside 😉 Line 3929 in c3b5885
|
I am aware of the computational difference, but both methods expect the first sample to be the DC component. |
Copied from #860 # Current behaviour
f = rf.Frequency(10, 50, 5)
f.t
array([-5.0e-11, -2.5e-11, 0.0e+00, 2.5e-11, 5.0e-11]) # 25 ps would imply 40 GSps = 20GHz
# PR 900 now
f = rf.Frequency(10, 50, 5)
f.t
array([-4.0e-11, -2.0e-11, 0.0e+00, 2.0e-11, 4.0e-11]) # 20 ps would imply 50 GSps = 25 GHz
# I would like to have when PR900 is finished
f = rf.Frequency(10, 50, 5)
f.t
array([-5.0e-11, -4.0e-11, -3.0e-11, -2.0e-11, -1.0e-11 0.0e+00, 1.0e-11, 2.0e-11, 3.0e-11, 4.0e-11]) # 10 ps would imply 100 GSps = 100 GHz |
According to the Agilent note presented by @Vinc0110 in #757, the bandpass mode without dc still show location and amplitude of discontinuities in impulse response, but not their capacitive or inductive nature. The frequency requirement are less stringent, e.g. no harmonic sweep required. |
Can you calculate this with an ordinary |
I think yes. The frequency point still needs to be equally spaced, and thanks to this there is no need to pass the time or frequency axis to the fft, ifft. It can be seen as a time or frequency that is normalized. In bandpass mode, the ifft time domain results are complex numbers because there is no complex conjugation around a dc center in the input vector; usually, only the magnitude is plotted and it looks terrible, but the discontinuities are supposed to show proper spacing. The frequency sweep is more practical to set around the band of interests if compared to the harmonic sweep that needs to be equally spaced from DC point for lowpass. Here is another interesting source from Anritsu: Time Domain Measurements Using Vector Network Analyzers pp. 8-10 With a comparison of the methods on a Beatty standard: Prior to it, there is a warning: As noted, Low-pass processing should be used whenever possible as it offers the highest performance and most versatile set of displays I think I am out of knowledge here because I stick to this advice and always use low-pass mode with dc extrapolation to hopefully understand what I see. I do not truly understand how the bandpass mode works. In this source, the frequency step for bandpass is (p. 8) |
https://en.wikipedia.org/wiki/Negative_frequency
Lines 299 to 301 in c3b5885
But in the above code to plot the time domain of s-parameters, which should be equivalent to bandpass, it is like half of the frequency vector will be considered as negative frequencies, which left me confused. It probably works, but how? |
I'm also not sure how to interprete the result.
The current implementation does not care if I pass 0-5GHz, 1-6GHz or 50-55GHz, which seems strange to me. |
Ok, in this source I think I found half of the answer: But it does not answer our question on how to interpret the bandpass nature of the frequency vector when it start far away 0. |
Hi guys. This whole uncertainty is exactly what irritated me in issue #860. A benchmark result from another tool - known to be correct - would be perfect to compare our implementation against. |
Maybe a brave VNA measurer could measure a length + short and save .s1p as well as bandpass time serie? In the meantime, I have found that bandpass frequency data seems to be related to downsampling if the fft coefficients are 0 between 0 and a start frequency. The source Oppenheim, Schafer, Discrete-Time Signal Processing is often cited and contains following figure: Unfortunately, I did not found in the book neither how the time vector is reconstructed if the inverse fft is done nor how the time data are supposed to looks like. |
We could also make a separate Issue/PR for the bandpass stuff and finish this one. |
I think I have got it. I asked a colleague that is much more skilled in signal processing than me and he gave me the interpretation that was later confirmed by the appendix B of Agilent AN 1287-8 Simplified Filter Tuning Using Time Domain Radio signal transmission - e.g. AM - modulates a carrier frequency with data, which creates sidebands around it. For demodulation, the time-domain data can be multiplied by the carrier frequency, which centers the side bands around 0 Hz and then low-passed to remove the higher-frequencies content.
|
Indeed. Maybe should we still wait Monday to let @Vinc0110 have a look if he meet the occasion. |
import skrf as rf
import numpy as np
f0 = 10e9
f1 = 50e9
n = 5
f = rf.Frequency(f0, f1, n, unit = 'Hz')
# bandpass frequency and time step
# (according to the app note that the sampling frequency is the band span)
df = (f1 - f0) / (n - 1)
dt = 1 / df
# fft frequency vector
ff1 = np.array([-2, -1, 0, 1, 2]) * df / 5
print(f'{ff1} [Hz]')
ff2 = np.fft.fftshift(np.fft.fftfreq(n, 1/df))
print(f'{ff2} [Hz]')
# fft time vector
tt1 = np.array([-2, -1, 0, 1, 2]) * dt / 5
print(f'{tt1} [s]')
tt2 = np.fft.fftshift(np.fft.fftfreq(n, 1/dt))
print(f'{tt2} [s]')
# output:
[-4.e+09 -2.e+09 0.e+00 2.e+09 4.e+09] [Hz]
[-4.e+09 -2.e+09 0.e+00 2.e+09 4.e+09] [Hz]
[-4.e-11 -2.e-11 0.e+00 2.e-11 4.e-11] [s]
[-4.e-11 -2.e-11 0.e+00 2.e-11 4.e-11] [s] |
Ok, thank you for this nice paper :) But then I think that we serve the values for From numpy's doc:
We calculate the ìfft`like this:
where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best if my understanding would be confirmed by someone else.
Oh! I think you are right! Nice spotted! |
@FranzForstmayr Can you try this? import skrf as rf
from skrf.media import Freespace
from matplotlib import pyplot as plt
rf.stylely()
f = rf.Frequency(10, 50, 5, unit = 'GHz')
m = Freespace(f, z0 = 50)
n = m.delay_short(10, unit = 'ps')
n_dc = n.extrapolate_to_dc()
window = 'boxcar'
plt.figure()
plt.title('The 10ps short network')
n_dc.plot_s_time_impulse(window = window, pad = 0, label = 'plot_s_time_impulse')
n_dc.plot_s_time_step(window = window, pad = 0, label = 'plot_s_time_step')
n.plot_s_time_mag(label = 'plot_s_time_mag') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plot of s-parameter n,m is broken.
Can be observed here: https://scikit-rf--900.org.readthedocs.build/en/900/examples/networktheory/Time%20Domain.html
We already had an issue in the previous version, the first |
|
Great! Nice, the time for the reflexion going back and forth and the resolution divided by two for bandpass are clearly visibles! |
This PR fixes several issues regarding time transformation.
to be continued