Metadata-Version: 1.2
Name: psf-utils
Version: 0.2.0
Summary: Cadence PSF file utilities
Home-page: https://psf_utils.readthedocs.io
Author: Ken Kundert
Author-email: psf_utils@nurdletech.com
License: GPLv3+
Download-URL: https://github.com/kenkundert/psf_utils/tarball/master
Description: PSF Utilities
        =============
        
        :Author: Ken Kundert
        :Version: 0.2.0
        :Released: 2019-09-25
        
        
        What?
        -----
        
        *psf_utils* is a library allows you to read data from a Spectre PSF ASCII file.
        Spectre is a commercial circuit simulator produced by Cadence Design Systems.
        PSF files contain signals generated by Spectre.  This package also contains two
        programs that are useful in their own right, but also act as demonstrators as to
        how to use the library. They are *list_psf* and *plot_psf*.  The first lists the
        available signals in a file, and the other displays them.
        
        
        Accessing the Results
        ---------------------
        
        You can use the PSF class to read ASCII Parameter Storage Format files. When
        instantiating the class you pass in the path to the file and then the resulting
        PSF object contains a dictionary that containing the signals. For example, the
        following lists is a::
        
            from psf_utils import PSF
            from inform import Error, display
        
            kinds = {
                'float double': 'real',
                'float complex': 'complex',
            }
        
            try:
                psf = PSF('adc.raw/tran.tran')
        
                for signal in psf.all_signals():
                    kind = signal.type.kind
                    kind = kinds.get(kind, kind)
                    display(f'{signal.name:<15}  {signal.units:<12}  {kind}')
            except Error as e:
                e.terminate()
        
        This example plots the output signal::
        
            from psf_utils import PSF
            from inform import Error, display
            import matplotlib.pyplot as plt
        
            try:
                psf = PSF('adc.raw/tran.tran')
                sweep = psf.get_sweep()
                out = psf.get_signal('out')
        
                figure = plt.figure()
                axes = figure.add_subplot(1,1,1)
                axes.plot(sweep.abscissa, out.ordinate, linewidth=2, label=out.name)
                axes.set_title('ADC Output')
                axes.set_xlabel(f'{sweep.name} ({PSF.units_to_unicode(sweep.units)})')
                axes.set_ylabel(f'{out.name} ({PSF.units_to_unicode(out.units)})')
                plt.show()
            except Error as e:
                e.terminate()
        
        *abscissa* and *ordinate* are NumPy arrays.
        
        
        Utility Programs
        ----------------
        
        Two utility programs are installed along with the *psf_utils* library:
        *list_psf* and *plot_psf*. The first lists the signals available from a PSF
        file, and the second displays them. They both employ caching to speed up access
        to the data. They also cache the name of the PSF file so that it need not be
        given every time. *plot_psf* also caches its arguments, so if you run it again
        with no arguments it will simply repeat what it did last time. For example, here
        is a typical session::
        
            > list_psf -l resistor.raw/pnoise.pnoise
            R1:flicker  A²/Hz  real
            R1:thermal  A²/Hz  real
            R1:total    A²/Hz  real
            R2:rn       A²/Hz  real
            R2:fn       A²/Hz  real
            R2:total    A²/Hz  real
            out         A/√Hz  real
            > plot_psf out    # display out from resistor.raw/pnoise.pnoise
            > plot_psf        # display out again
        
        
        Converting to PSF ASCII
        -----------------------
        
        *psf_utils* only supports PSF ASCII files. As an alternative, `libpsf
        <https://pypi.org/project/libpsf>`_ is a Python package that can read both ASCII
        and binary PSF files. Or, you can use the Cadence *psf* program to convert
        various types of simulation results files into PSF ASCII format. To use it,
        simply specify the input and output files::
        
            > psf -i adc.raw/tran.tran -o adc.raw/tran.psfascii
            > list_psf adc.raw/tran.psfascii
        
        In this example there is nothing special about the 'psfascii' suffix, it is
        simply mnemonic.  Rather, the output is in ASCII format because the ``-b``
        (binary) option is not specified.
        
        
        Releases
        --------
        
        **Latest development release**:
            | Version: 0.2.0
            | Released: 2019-09-25
        
            - Initial version
        
Keywords: cadence,spectre,PSF,simulation
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Utilities
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.6
