Exemplo n.º 1
0
def read_data(filename, merge=True, guess_unit=True,
              property_to_vars=True, **kw):
    """Guess fileformat of *filename* and read data.

    The file format is guessed by looking for distinguishing marks for
    citi, touchstone, and mdif. If non of those are present spdata is assumed.
    """
    if isinstance(filename, (list, tuple)):
        filenames = filename
    else:
        filenames = [filename]
    for f in filenames:
        files = glob.glob(f)
        if len(files) != 0:
            fname = files[0]
            break
    else:
        raise IOError("No files match pattern %r" % filename)
    fil = open(fname)
    for rad in fil:
        for fun, readfun in isfile:
            if fun(fname, rad):
                fil.close()
                return readfun(filename, merge=merge, guess_unit=guess_unit,
                               property_to_vars=property_to_vars, **kw)
    fil.close()
    return read_spdata(filename, merge=merge, guess_unit=guess_unit,
                       property_to_vars=property_to_vars, **kw)
Exemplo n.º 2
0
def read_data(filename,
              merge=True,
              guess_unit=True,
              property_to_vars=True,
              **kw):
    """Guess fileformat of *filename* and read data.

    The file format is guessed by looking for distinguishing marks for
    citi, touchstone, and mdif. If non of those are present spdata is assumed.
    """
    if isinstance(filename, (list, tuple)):
        filenames = filename
    else:
        filenames = [filename]
    for f in filenames:
        files = glob.glob(f)
        if len(files) != 0:
            fname = files[0]
            break
    else:
        raise IOError("No files match pattern %r" % filename)
    fil = open(fname)
    for rad in fil:
        for fun, readfun in isfile:
            if fun(fname, rad):
                fil.close()
                return readfun(filename,
                               merge=merge,
                               guess_unit=guess_unit,
                               property_to_vars=property_to_vars,
                               **kw)
    fil.close()
    return read_spdata(filename,
                       merge=merge,
                       guess_unit=guess_unit,
                       property_to_vars=property_to_vars,
                       **kw)
Exemplo n.º 3
0
    def normal(loc=0, scale=1, dims=None):
        size = [x.data.shape[0] for x in dims]
        return hfarray(rnd.normal(loc, scale, size), dims=dims)

    db = DataBlock()
    db.blockname = "RFmeas.LDMOS69.Spar"
    freq = DimSweep("freq", linspace(50e6, 20.05e9, 201))
    vd = DimSweep("vd", linspace(0, 5, 6))
    vg = DimSweep("vg", linspace(0, 5, 6))
    sweep_dims = (vd, vg, freq)
    matrix_dims = (DimMatrix_i("i", 2), DimMatrix_j("j", 2))

    db.freq = freq
    db.vd = vd
    db.vg = vg

    db.H = complex_normal(dims=sweep_dims + matrix_dims)
    db.Id = normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.S = complex_normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.mason = complex_normal(dims=sweep_dims)
    db.vd = normal(dims=sweep_dims)
    db.vg = normal(dims=sweep_dims)

    print(db.report())
    from hftools.file_formats.spdata import read_spdata
    dc = read_spdata("../io/tests/testdata/sp_oneport_2_1.txt")
Exemplo n.º 4
0
    def normal(loc=0, scale=1, dims=None):
        size = [x.data.shape[0] for x in dims]
        return hfarray(rnd.normal(loc, scale, size), dims=dims)

    db = DataBlock()
    db.blockname = "RFmeas.LDMOS69.Spar"
    freq = DimSweep("freq", linspace(50e6, 20.05e9, 201))
    vd = DimSweep("vd", linspace(0, 5, 6))
    vg = DimSweep("vg", linspace(0, 5, 6))
    sweep_dims = (vd, vg, freq)
    matrix_dims = (DimMatrix_i("i", 2), DimMatrix_j("j", 2))

    db.freq = freq
    db.vd = vd
    db.vg = vg

    db.H = complex_normal(dims=sweep_dims + matrix_dims)
    db.Id = normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.S = complex_normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.Ig = normal(dims=sweep_dims)
    db.mason = complex_normal(dims=sweep_dims)
    db.vd = normal(dims=sweep_dims)
    db.vg = normal(dims=sweep_dims)

    print(db.report())
    from hftools.file_formats.spdata import read_spdata
    dc = read_spdata("../io/tests/testdata/sp_oneport_2_1.txt")