def process_file(cls, file: str) -> Dict[str, Any]: """ parses individual files if they are compatible with libpsf libarary :param file: path to the individual file :return: dictionary representing all the simulation data particular to this file """ fpath = os.path.abspath(file) try: psfobj = libpsf.PSFDataSet(fpath) except: raise FileNotCompatible( 'file {} was not compatible with libpsf'.format(file)) is_swept = psfobj.is_swept() datum = dict() for signal in psfobj.get_signal_names(): datum[signal] = psfobj.get_signal(signal) if is_swept: datum['sweep_vars'] = psfobj.get_sweep_param_names() datum['sweep_values'] = psfobj.get_sweep_values() return datum
def open(self): """Open a PSF file and read its headers. Example: Trying to open a valid psf file >>> psf=PSFReader('./test/psf/srcSweep') >>> psf.open() """ self.ds = libpsf.PSFDataSet(self.filename) self.hprops = self.ds.get_header_properties()
import libpsf import libpsf d = libpsf.PSFDataSet("../data/opBegin") print d.get_header_properties() print d.get_signal_properties('XIRXRFMIXTRIM0.XM1PDAC1.XMN.MAIN')
import libpsf d1 = libpsf.PSFDataSet("../data/opBegin") d2 = libpsf.PSFDataSet("../data/dcOpInfo.info") #print list(d.get_signal_names()) print d1.get_signal('XIRXRFMIXTRIM0.XM1PDAC6.XMN.MAIN') print d2.get_signal('DACTOP_0.DIV2_1.MN27.mm4ynj')
import libpsf d = libpsf.PSFDataSet("../data/timeSweep") print d.get_header_properties() print list(d.get_signal_names()) t = d.get_sweep_values() v = d.get_signal('INP') print len(v), len(t) import pylab pylab.plot(t, v) pylab.show()
import libpsf d = libpsf.PSFDataSet("../data/frequencySweep") print(d.get_sweep_values()) print(d.get_signal('ANT_CM'))
import libpsf d = libpsf.PSFDataSet("../data/pss0.fd.pss") print list(d.get_signal_names()) print d.get_sweep_values(), d.get_signal('1')
import libpsf d = libpsf.PSFDataSet("../data/srcSweep") print list(d.get_signal_names()) print d.get_signal('VIN')
def setUp(self): dataset_file = os.path.join(os.path.dirname(__file__), "data/timeSweep") self.psf = libpsf.PSFDataSet(dataset_file)
def setUp(self): self.psf = libpsf.PSFDataSet( os.path.dirname(__file__) + "/data/timeSweep")