Exemple #1
0
def split_sp():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    print(graph.edges(data=True))
    graph.split_sp()
    os.remove(path)
    return True
Exemple #2
0
def plot_GraphAnalysis():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    graph.buildCore()
    graph.analysis.plot(show=False)
    os.remove(path)
    return True
Exemple #3
0
def TestCore2Tex():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    core = graph.to_core()
    content = netlist2tex(netlist)
    content += graphplot2tex(graph)
    content += core2tex(core)
    texdocument(content, path, title='test core2tex')
    os.remove(path)
    return True
Exemple #4
0
def TestCore2Tex():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    core = graph.to_core()
    folder = os.path.join(here, 'temp')
    if not os.path.exists(folder):
        os.mkdir(folder)
    path = os.path.join(folder, 'test_core2tex.tex')
    content = netlist2tex(netlist)
    content += graphplot2tex(graph, folder=folder)
    content += core2tex(core)
    texdocument(content, path, title='test core2tex')
    shutil.rmtree(folder)
    return True
Exemple #5
0
"""

from __future__ import absolute_import, division, print_function

import os
from pyphs import Netlist, Graph

label = 'triodeamp'

path = os.path.realpath(__file__)[:os.path.realpath(__file__).rfind(os.sep)]

netlist_filename = path + os.sep + label + '.net'

netlist = Netlist(netlist_filename)

graph = Graph(netlist=netlist)

core = graph.to_core(verbose=False)
core.linear_nonlinear()
core.subsinverse()

#core.reduce_z()

#if __name__ == '__main__':
#
#    from pyphs import signalgenerator
#
#    config = {'fs': 96e3,
#              'split': True,
#              'pbar': True,
#              'maxit': 100,
Exemple #6
0
"""

from __future__ import absolute_import, division, print_function

import os
from pyphs import Netlist, Graph

# ---------------------------  NETLIST  ------------------------------------- #
label = 'pickup'
this_script = os.path.realpath(__file__)
here = this_script[:this_script.rfind(os.sep)]
netlist_filename = here + os.sep + label + '.net'
netlist = Netlist(netlist_filename)

# ---------------------------  GRAPH  --------------------------------------- #
graph = Graph(netlist=netlist, label=label)

# ---------------------------  CORE  ---------------------------------------- #
core = graph.buildCore()

## ---------------------------  SIMULATION  ---------------------------------- #
#if __name__ == '__main__':
#
#    import numpy
#    import matplotlib.pyplot as plt
#    from pyphs import Netlist, Graph
#    from pyphs.misc.tools import interleave
#
#    core.reduce_z()
#
#    # Define the simulation parameters
Exemple #7
0
def split_sp():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    graph.split_sp()
    os.remove(path)
    return True
Exemple #8
0
def plot_Graph():
    netlist = NetlistThieleSmallNL()
    graph = Graph(netlist=netlist)
    graph.plot(show=False)
    os.remove(path)
    return True
Exemple #9
0
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 23:48:24 2017

@author: Falaize

Use data_generator.py to generate a valid data.txt;
Uncomment below to regenerate the netlist.

"""

from pyphs import Graph
import os
from pyphs.examples.pwl.data_generator import (netlist_name, generate_data,
                                               generate_netlist)

generate_data()
generate_netlist()
path = os.path.realpath(__file__)[:os.path.realpath(__file__).rfind(os.sep)]
netlist_path = os.path.join(path, netlist_name + '.net')
graph = Graph(netlist=netlist_path, label=netlist_name)
core = graph.to_core()

#if __name__ == '__main__':
#    import sympy as sp
#    sp.plot(graph.core.H, (graph.core.x[0], -10, 10))
#    sp.plot(graph.core.z[0], (graph.core.w[0], -10, 10))
Exemple #10
0
    def initUI(self):

        self.graph = Graph(label=self.label)

        self.dimsLayout = QHBoxLayout()
        self.dimsLayout.setContentsMargins(0, 0, 0, 0)

        self.nodesWidget = DescriptionWidget('Nodes', '0', 'Number of nodes')
        self.edgesWidget = DescriptionWidget('Edges', '0', 'Number of edges')

        self.dimsLayout.addWidget(self.nodesWidget)
        self.dimsLayout.addWidget(self.edgesWidget)
        self.dimsLayout.addStretch()

        self.dimsWidget = QWidget(self)
        self.dimsWidget.setLayout(self.dimsLayout)

        # ---------------------------------------------------------------------
        # Define Graph Actions

        self.buttonsLayout = QHBoxLayout()
        self.buttonsLayout.setContentsMargins(0, 0, 0, 0)

        build_icon = QIcon(os.path.join(iconspath, 'work.png'))
        self.buildAction = QAction(build_icon, "&Build the graph", self)
        self.buildAction.setShortcut('Ctrl+G')
        self.buildAction.setStatusTip(
            "Build the graph from the netlist and perform realizability analysis"
        )
        self.buildAction.triggered.connect(self._plot_graph)
        self.buildButton = QPushButton(build_icon, '')
        self.buildButton.setToolTip("Build the system's graph")
        self.buildButton.clicked.connect(self._build)
        self.buttonsLayout.addWidget(self.buildButton)

        # PlotGraph Action
        graph_icon = QIcon(os.path.join(iconspath, 'graph.png'))
        self.plotgraphAction = QAction(graph_icon, "&Plot system's graph",
                                       self)
        self.plotgraphAction.setShortcut('Ctrl+G')
        self.plotgraphAction.setStatusTip("Plot the system's graph")
        self.plotgraphAction.triggered.connect(self._plot_graph)
        self.plotgraphButton = QPushButton(graph_icon, '')
        self.plotgraphButton.setToolTip("Plot the system's graph")
        self.plotgraphButton.clicked.connect(self._plot_graph)
        self.buttonsLayout.addWidget(self.plotgraphButton)

        # PlotGraph MSA
        self.plotSTAction = QAction(graph_icon,
                                    '&Plot realizability spanning tree', self)
        self.plotSTAction.setShortcut('Ctrl+T')
        self.plotSTAction.setStatusTip('Plot the realizability spanning tree')
        self.plotSTAction.triggered.connect(self._plot_spantree)
        self.plotSTButton = QPushButton(graph_icon, '')
        self.plotSTButton.clicked.connect(self._plot_spantree)
        self.plotSTButton.setToolTip('Plot the realizability spanning tree')
        self.buttonsLayout.addWidget(self.plotSTButton)

        # ---------------------------------------------------------------------
        # title widget

        title = 'GRAPH'
        self.labelWidget = QLabel()
        status_labels = {True: 'OK', False: 'Not OK'}
        self.titleWidget = TitleWidget(title=title,
                                       labelWidget=self.labelWidget,
                                       status_labels=status_labels,
                                       buttonsLayout=self.buttonsLayout)

        # ---------------------------------------------------------------------
        # signals
        self.netlistWidget.statusSig.sig.connect(self._status_changed)
        self.netlistWidget.initSig.sig.connect(self._netlist_init)