Beispiel #1
0
def test_pz_spice4():
    """PZ Test: Simple Amplifier"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice4.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [-2.248151e+05 +0j, -2.253434e+07 +0j]
    _check_singularities(poles, poles_ref, atol=1e2, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [6.366198e+08+0j]
    _check_singularities(zeros, zeros_ref, atol=1e2, rtol=1e-3)
Beispiel #2
0
def test_pz_spice4():
    """PZ Test: Simple Amplifier"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice4.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [-2.248151e+05 + 0j, -2.253434e+07 + 0j]
    _check_singularities(poles, poles_ref, atol=1e2, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [6.366198e+08 + 0j]
    _check_singularities(zeros, zeros_ref, atol=1e2, rtol=1e-3)
Beispiel #3
0
def test_pz_spice2():
    """PZ Test: KERWIN'S CIRCUIT - JW-AXIS TRANSMISSION ZEROS"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice2.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [-7.964016e-03 + 1.589515e-01j,
                 -7.964016e-03 -1.589515e-01j,
                 -2.250812e-01 + 0.000000e+00j]
    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [-2.250812e-01j, +2.250812e-01j, -2.250812e-01]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #4
0
def test_pz_spice2():
    """PZ Test: KERWIN'S CIRCUIT - JW-AXIS TRANSMISSION ZEROS"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice2.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [
        -7.964016e-03 + 1.589515e-01j, -7.964016e-03 - 1.589515e-01j,
        -2.250812e-01 + 0.000000e+00j
    ]
    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [-2.250812e-01j, +2.250812e-01j, -2.250812e-01]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #5
0
def test_pz_spice1():
    """PZ Test: 5TH-ORDER LOW_PASS FILTER"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice1.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [
        -1.105884e-02 - 7.435365e-02j, -1.105884e-02 + 7.435365e-02j,
        -1.882392e-02 - 1.418852e-01j, -1.882392e-02 + 1.418852e-01j,
        -8.675361e-02 + 0.000000e+00j
    ]
    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [-2.047019e-01j, -8.164476e-02j, 8.164476e-02j, 2.047019e-01j]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #6
0
def test_pz_spice3():
    """PZ Test: High-Pass Butterworth Filter"""
    if 'TRAVIS' in os.environ:
        raise SkipTest
    netlist_path = os.path.join(get_reference_path(), 'pz_spice3.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [
        -6.090889e-02 + 1.470617e-01j, -6.090889e-02 - 1.470617e-01j,
        -1.470254e-01 + 6.093849e-02j, -1.470254e-01 - 6.093849e-02j
    ]

    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [0 + 0j, 0 + 0j, 0 + 0j, 0 + 0j]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #7
0
def test_pz_spice3():
    """PZ Test: High-Pass Butterworth Filter"""
    if 'TRAVIS' in os.environ:
        raise SkipTest
    netlist_path = os.path.join(get_reference_path(), 'pz_spice3.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [-6.090889e-02 + 1.470617e-01j,
                 -6.090889e-02 - 1.470617e-01j,
                 -1.470254e-01 + 6.093849e-02j,
                 -1.470254e-01 - 6.093849e-02j]

    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [0+0j, 0+0j, 0+0j, 0+0j]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #8
0
def test_pz_spice1():
    """PZ Test: 5TH-ORDER LOW_PASS FILTER"""
    netlist_path = os.path.join(get_reference_path(), 'pz_spice1.ckt')
    r = main(netlist_path, verbose=0, outfile='tmp')
    res = r['pz']
    poles = [res[s] for s in res.keys() if s[0] == 'p']
    poles_ref = [-1.105884e-02 -7.435365e-02j, 
                 -1.105884e-02 +7.435365e-02j,
                 -1.882392e-02 -1.418852e-01j,
                 -1.882392e-02 +1.418852e-01j,
                 -8.675361e-02+0.000000e+00j]
    _check_singularities(poles, poles_ref, atol=1e-4, rtol=1e-3)

    zeros = [res[s] for s in res.keys() if s[0] == 'z']
    zeros_ref = [-2.047019e-01j,
                 -8.164476e-02j,
                 8.164476e-02j,
                 2.047019e-01j]
    _check_singularities(zeros, zeros_ref, atol=1e-4, rtol=1e-3)
Beispiel #9
0
import sys
from ahkab import main, options
options.cli = True
main(sys.argv[1], verbose=3, outfile='tmp')
Beispiel #10
0
        options.transient_max_time_iter = int(
            float(cli_options.transient_max_time_iter))
    if cli_options.shooting_max_nr_iter is not None:
        options.shooting_max_nr_iter = int(
            float(cli_options.shooting_max_nr_iter))
    if cli_options.gmin is not None:
        options.gmin = float(cli_options.gmin)
    if cli_options.cmin is not None:
        options.cmin = float(cli_options.cmin)
    if cli_options.eps:
        utilities.EPS = utilities.calc_eps()
        print "Detected machine precision: " + str(utilities.EPS)

    if not len(remaning_args) == 1:
        print "Usage: ./ahkab.py [options] <filename>\n./ahkab.py -h for help"
        sys.exit(1)
    if remaning_args[0] == '-':
        read_netlist_from_stdin = True
    else:
        read_netlist_from_stdin = False
    if not read_netlist_from_stdin and not utilities.check_file(
            remaning_args[0]):
        sys.exit(23)

    # Program execution
    ahkab.main(filename=remaning_args[0], outfile=cli_options.outfile, tran_method=cli_options.method, \
     no_step_control=cli_options.no_step_control, dc_guess=cli_options.dc_guess, \
     print_circuit=cli_options.print_circuit, remote=False, verbose=verbose)

    sys.exit(0)
Beispiel #11
0
	if cli_options.transient_max_nr_iter is not None:
		options.transient_max_nr_iter = int(float(cli_options.transient_max_nr_iter))
	if cli_options.transient_max_time_iter is not None:
		options.transient_max_time_iter = int(float(cli_options.transient_max_time_iter))
	if cli_options.shooting_max_nr_iter is not None:
		options.shooting_max_nr_iter = int(float(cli_options.shooting_max_nr_iter))
	if cli_options.gmin is not None:
		options.gmin = float(cli_options.gmin)
	if cli_options.cmin is not None:
		options.cmin = float(cli_options.cmin)
	if cli_options.eps:
		utilities.EPS = utilities.calc_eps()
		print "Detected machine precision: " + str(utilities.EPS)

	if not len(remaning_args) == 1:
		print "Usage: ./ahkab.py [options] <filename>\n./ahkab.py -h for help"
		sys.exit(1)
	if remaning_args[0] == '-':
		read_netlist_from_stdin = True
	else:
		read_netlist_from_stdin = False
	if not read_netlist_from_stdin and not utilities.check_file(remaning_args[0]):
		sys.exit(23)
	
	# Program execution
	ahkab.main(filename=remaning_args[0], outfile=cli_options.outfile, tran_method=cli_options.method, \
		no_step_control=cli_options.no_step_control, dc_guess=cli_options.dc_guess, \
		print_circuit=cli_options.print_circuit, remote=False, verbose=verbose)

	sys.exit(0)
Beispiel #12
0
import sys
from ahkab import main
main(sys.argv[1])
Beispiel #13
0
    if cli_options.gmin is not None:
        options.gmin = float(cli_options.gmin)
    if cli_options.cmin is not None:
        options.cmin = float(cli_options.cmin)
    if cli_options.eps:
        utilities.EPS = utilities.calc_eps()
        print "Detected machine precision: " + str(utilities.EPS)

    if not len(remaning_args) == 1:
        print "Usage: ./ahkab.py [options] <filename>\n./ahkab.py -h for help"
        sys.exit(1)
    if remaning_args[0] == '-':
        read_netlist_from_stdin = True
    else:
        read_netlist_from_stdin = False
    if not read_netlist_from_stdin and not utilities.check_file(
            remaning_args[0]):
        sys.exit(23)

    options.transient_no_step_control = cli_options.no_step_control
    options.dc_use_guess = cli_options.dc_guess
    options.cli = True
    ahkab._print = cli_options.print_circuit

    # Program execution
    ahkab.main(filename=remaning_args[0],
               outfile=cli_options.outfile,
               verbose=verbose)

    sys.exit(0)
Beispiel #14
0
        options.shooting_max_nr_iter = int(
            float(cli_options.shooting_max_nr_iter))
    if cli_options.gmin is not None:
        options.gmin = float(cli_options.gmin)
    if cli_options.cmin is not None:
        options.cmin = float(cli_options.cmin)
    if cli_options.eps:
        utilities.EPS = utilities.calc_eps()
        print "Detected machine precision: " + str(utilities.EPS)

    if not len(remaning_args) == 1:
        print "Usage: ./ahkab.py [options] <filename>\n./ahkab.py -h for help"
        sys.exit(1)
    if remaning_args[0] == '-':
        read_netlist_from_stdin = True
    else:
        read_netlist_from_stdin = False
    if not read_netlist_from_stdin and not utilities.check_file(remaning_args[0]):
        sys.exit(23)

    options.transient_no_step_control = cli_options.no_step_control
    options.dc_use_guess = cli_options.dc_guess
    options.cli = True
    ahkab._print = cli_options.print_circuit

    # Program execution
    ahkab.main(filename=remaning_args[
               0], outfile=cli_options.outfile, verbose=verbose)

    sys.exit(0)