本文整理汇总了Python中hftools.dataset.DataBlock.Z0方法的典型用法代码示例。如果您正苦于以下问题:Python DataBlock.Z0方法的具体用法?Python DataBlock.Z0怎么用?Python DataBlock.Z0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hftools.dataset.DataBlock
的用法示例。
在下文中一共展示了DataBlock.Z0方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: proc_info
# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import Z0 [as 别名]
def proc_info(info, f, data, fn, noisedata):
info_list = info.upper().split()
if len(info_list) == 5:
info = freq_mult, twoporttype, datatype, rtype, z0 = info_list
elif len(info_list) == 3:
info = freq_mult, twoporttype, datatype = info_list
z0 = 1.
else:
msg = ("# format should only have 5 values this one has %d" %
len(info_list))
raise TouchstoneError(msg)
z0 = float(z0)
f = f * freqmultdict[freq_mult]
if fn is not None:
fn = fn * freqmultdict[freq_mult]
convfunc = dict(RI=re_im_to_complex,
DB=dB_angle_to_complex,
MA=mag_angle_to_complex)
if datatype not in convfunc:
pars = datatype
msg = "Unknown dataformat: %s, valid formats: RI, DB, MAG" % pars
raise TouchstoneError(msg)
out = np.empty((data.shape[0], data.shape[1] // 2), dtype=np.complex128)
out[...] = convfunc[datatype](data[:, ::2], data[:, 1::2])
if out.shape[1] == 1:
out.shape = (out.shape[0], 1, 1)
elif out.shape[1] == 4:
out.shape = (out.shape[0], 2, 2)
out = out.transpose(0, 2, 1)
else:
N = int(sqrt(out.shape[1]))
out.shape = (out.shape[0], N, N)
dims = (DimSweep("freq", f, unit="Hz"), )
if fn is not None and len(f) == len(fn) and np.allclose(f, fn):
noisedims = dims
elif fn is None:
noisedims = None
else:
noisedims = (DimSweep("freqn", fn, unit="Hz"), )
out = make_matrix(out, dims)
f = hfarray(f, dims)
db = DataBlock()
db[info[1]] = out
if noisedata is not None:
db.Rn = hfarray(noisedata[..., -1], dims=noisedims) * z0
db.Fmin = 10 ** (hfarray(noisedata[..., 0], dims=noisedims) / 10)
db.Gopt = hfarray(convfunc[datatype](noisedata[:, 1], noisedata[:, 2]),
dims=noisedims)
db.Z0 = hfarray(z0, unit="Ohm")
return db