Ejemplo n.º 1
0
def stitch_s2p_list(s2p_list):
    # A temporary list to hold stitched files.
    stitched_s2p_list = []

    # Recursive end condition.
    # Once list is one element long, stitching is complete.
    if len(s2p_list) == 1:
        return s2p_list

    # For every element in s2p_list...
    for i in range(0, len(s2p_list)):

        # For every other element in s2p_list...
        if i % 2 == 1:
            # Take the prior element.
            s2p_1 = s2p_list[i - 1]

            # Take the current element.
            s2p_2 = s2p_list[i]

            # Stitch the two elements together.
            stitched_s2p = rf.stitch(s2p_1, s2p_2)

            # Append the stitched .s2p file to temporary list.
            stitched_s2p_list.append(stitched_s2p)

        # If the length of s2p_list is odd and the current element is the last in the list....
        if len(s2p_list) % 2 != 0 and i == len(s2p_list) - 1:
            # Append the element to the temporary list.
            stitched_s2p_list.append(s2p_list[i])

    # Recursively stitch temporary list until all elements are stitched together.
    return stitch_s2p_list(stitched_s2p_list)
Ejemplo n.º 2
0
 def test_stitch(self):
     tmp = self.ntwk1.copy()
     tmp.f = tmp.f + tmp.f[0]
     c = rf.stitch(self.ntwk1, tmp)
Ejemplo n.º 3
0
 def test_stitch(self):
     tmp = self.ntwk1.copy()
     tmp.f = tmp.f+ tmp.f[0]
     c = rf.stitch(self.ntwk1, tmp)
Ejemplo n.º 4
0
    os.mkdir(out_dir)

#Creates a dictionary to load all of the s2p data into in network format from python package scikit-rf, and then stitch them all together into one s2p. Can omit these steps if you didn't take your data in multiple frequency sweeps.
C = {}

for f in fnames:
    C[int(f.split('.')[0].split('_')[-1])] = rf.Network(main_dir + '/' + f)

i = 0
for key in C.keys():
    if i == 0:
        net = C[key]
        i = i + 1
        continue
    else:
        net = rf.stitch(net, C[key])

#Extracts just the information from the s2p data that you need for fitting and puts them into np arrays
mag = net.s21.s_mag[:, 0, 0]
freq = net.frequency.f
real = net.s21.s_re[:, 0, 0]
imag = net.s21.s_im[:, 0, 0]

#Finds the peaks for chunking up individual peaks out of the full frequency sweep
freqs, pks = pk.get_peaks(freq, mag, f_delta=100e3, res_num=62)

#Loops through found peaks, fits only +/- 400kHz around the peak with the fitting code then plots and saves it.
results = {}
for fr in freqs:
    f_start = fr - 200e3
    f_stop = fr + 200e3
Ejemplo n.º 5
0
import skrf as rf
from pylab import *
import os

data_folder='results'
touchstone_file_lf = os.path.join(data_folder,'t520_10u_lfF.s1p')
touchstone_file = os.path.join(data_folder,'t520_10uF.s1p')
baseline= os.path.join(data_folder,'T520B476M010ATE035.s2p')

# Network 1
zmeas_lf = rf.Network(touchstone_file_lf)
zmeas=rf.Network(touchstone_file)

full_ntwk=rf.stitch(zmeas_lf[2:], zmeas)
full_ntwk.name='T520B_47uF10V_meas'

# Network 2
model_ntwk=rf.Network(baseline)
model_ntwk.name="T520B_47uF10V_model"

# Saving Network 1
full_ntwk.write_touchstone('T520B_47uF10V_meas.s1p','./results/',False,True)

# Plotting
rf.stylely() # matplotlib custom style from skrf.mplstyle
figure(figsize=(8,6))
loglog()

model_ntwk.plot_z_mag(m=0,n=0,marker='x', markevery=1, label='model')
full_ntwk.plot_z_mag(marker='+', markevery=1,label='measured')
title('Kemet T520B 47uF 10V' )