skrf.time.time_gate¶
- skrf.time.time_gate(ntwk, start=None, stop=None, center=None, span=None, mode='bandpass', window=('kaiser', 6), method='fft', fft_window='cosine', conv_mode='wrap', t_unit='')[source]¶
Time-domain gating of one-port s-parameters with a window function from scipy.signal.windows.
The gate can be defined with start/stop times, or by center/span. All times are in units of nanoseconds but can be changed using the t_unit parameter. The default unit will change to s in scikit-rf version 1.0. Common windows are:
(‘kaiser’, 6)
6 # integers are interpreted as kaiser beta-values
‘hamming’
‘boxcar’ # a straight up rect
If no parameters are passed this will try to auto-gate the largest peak.
- Parameters:
ntwk (
Network
) – network to operate onstart (number, or None) – start of time gate in t_unit.
stop (number, or None) – stop of time gate in t_unit.
center (number, or None) – center of time gate, in t_unit. If None, and span is given, the gate will be centered on the peak.
span (number, or None) – span of time gate, in t_unit. If None span will be half of the distance to the second tallest peak
mode (['bandpass', 'bandstop']) – mode of gate
window (string, float, or tuple) – passed to window arg of scipy.signal.get_window()
method (str) –
Gating method. There are 3 option: ‘convolution’, ‘fft’, ‘rfft’.
With ‘convolution’, the time-domain gate gets transformed into frequency-domain using inverse FFT and the gating is then achieved by convolution with the frequency-domain data.
With ‘fft’ (default), the data gets transformed into time-domain using inverse FFT and the gating is achieved by multiplication with the time-domain gate. The gated time-domain signal is then transformed back into frequency-domain using inverse FFT. As only positive signal frequencies are considered for the inverse FFT (with or without a dc component), the resulting time-domain signal has the same number of samples as in the frequency-domain, but is complex-valued. This method is also know as time-domain band-pass mode.
With ‘rfft’, the procedure is the same as with ‘fft’, but the inverse FFT uses a complex-conjugate copy of the positive signal frequencies for the negative frequencies (Hermitian frequency response). A dc sample is also required. The resulting time-domain signal is real-valued and has twice the number of samples, which gives an improved time resolution. This method is also known as time-domain low-pass mode.
fft_window (str or tuple or None) – Frequency-domain window applied before the inverse FFT in case of the (R)FFT method. This parameter takes the same values as the window parameter. Example: window=’hann (default), or window=(‘kaiser’, 5), or window=None. The window helps to remove artefacts such as time-domain sidelobes of the pulses, but it is a trade-off with the achievable pulse width. The window is removed when the gated time-domain signals is transformed back into frequency-domain.
conv_mode (str) – Extension mode for the convolution (if selected) determining how the frequency-domain gate is extended beyond the boundaries. This has a large effect on the generation of gating artefacts due to boundary effects. The optimal mode depends on the data. See the parameter description of scipy.ndimage.convolve1d for the available options.
t_unit (str) –
Time unit for start, stop, center and span arguments, defaults to nanoseconds (ns).
- Possible values:
’s’: seconds
’ms’: milliseconds
’µs’ or ‘us’: microseconds
’ns’: nanoseconds (default)
’ps’: picoseconds
- Return type:
Note
You cant gate things that are ‘behind’ strong reflections. This is due to the multiple reflections that occur.
If you need to time-gate an N-port network, then you should gate each s-parameter independently.
- Returns:
ntwk (Network) – copy of ntwk with time-gated s-parameters
.. warning:: – Depending on sharpness of the gate, the band edges may be inaccurate, due to properties of FFT. We do not re-normalize anything.
- Parameters:
ntwk (Network) –
start (float) –
stop (float) –
center (float) –
span (float) –
mode (str) –
method (str) –
fft_window (str) –
conv_mode (str) –
t_unit (str) –
- Return type: