コード例 #1
0
Created on Sat Jan 14 11:50:23 2017

@author: Falaize
"""

from __future__ import absolute_import, division, print_function

import os
from pyphs import PHSNetlist, PHSGraph, PHSSimulation, signalgenerator
import numpy as np

label = 'mka_dual'
path = os.path.realpath(__file__)[:os.path.realpath(__file__).rfind(os.sep)]
netlist_filename = path + os.sep + label + '.net'
netlist = PHSNetlist(netlist_filename)
graph = PHSGraph(netlist=netlist)
core = graph.buildCore()

if __name__ == '__main__':
    tsig = 0.01
    fs = 48000.

    config = {
        'fs': 48e3,
        'progressbar': True,
    }
    simu = PHSSimulation(core, config)

    sig = signalgenerator(which='sin', f0=500., A=200., tsig=tsig, fs=fs)

    def sequ():
コード例 #2
0
from __future__ import absolute_import, division, print_function

import os
from pyphs import (netlist2core, PHSSimulation, signalgenerator, PHSNetlist,
                   PHSGraph)
from pyphs.misc.signals.analysis import transferFunction
import matplotlib.pyplot as plt
import numpy as np

label = 'fractional_integrator_ec'

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

netlist_filename = path + os.sep + label + '.net'
netlist = PHSNetlist(netlist_filename)
graph = PHSGraph(netlist=netlist)
core = netlist2core(netlist_filename)

if __name__ == '__main__':
    # UNCOMMENT BELOW FOR SIMULATION and PLOT OF TRANSFER FUNCTION
    # !!! Very long simulation with numpy
    #    config = {'fs': 48e3,
    #              'split': True,
    #              'pbar': True,
    #              'timer': True,
    #              'lang': 'python'
    #              }
    #
    #    simu = PHSSimulation(core, config=config)
    #
    #    dur = 10.