Пример #1
0
def run(xmloutput=False):
    """Run all gpkit unit tests.

    Arguments
    ---------
    xmloutput: bool
        If true, generate xml output files for continuous integration
    """
    if xmloutput:
        run_tests(TESTS, xmloutput='test_reports')
    else:
        run_tests(TESTS)
    print("\n##################################"
          "####################################")
    print("Running with units disabled:")
    gpkit.disable_units()
    if xmloutput:
        run_tests(TESTS, xmloutput='test_reports_nounits')
    else:
        run_tests(TESTS, verbosity=1)
Пример #2
0
def run(xmloutput=False):
    """Run all gpkit unit tests.

    Arguments
    ---------
    xmloutput: bool
        If true, generate xml output files for continuous integration
    """
    tests = import_tests()
    if xmloutput:
        run_tests(tests, xmloutput='test_reports')
    else:
        run_tests(tests)
    print("\n##################################"
          "####################################")
    print("Running with units disabled:")
    gpkit.disable_units()
    if xmloutput:
        run_tests(tests, xmloutput='test_reports_nounits')
    else:
        run_tests(tests, verbosity=1)
Пример #3
0
# Below is a Weights breakdown for the Blended wing body.  This method is GP Compatible!

from gpkit import VectorVariable, Variable, Model, units
import numpy as np
from gpkit.tools import te_exp_minus1
import gpkit
gpkit.disable_units()
import matplotlib.pyplot as plt


def secant(x, nterm):
    """Taylor expansion of secant(x).

    Arguments
    ---------
    x : gpkit.monomial
      Variable or expression argument
    nterm : int
        Number of terms in resulting Taylor expansion

    Returns
    -------
    gpkit.Posynomial
        Taylor expansion of secant(x), carried to nterm terms
    """
    if nterm < 1:
        raise ValueError("Unexpected number of terms, nterm=%s" % nterm)

    # The first 12 Euler Numbers
    E2n = np.asarray([
        1, 5, 61, 1385, 50521, 2702765, 199360981, 19391512145, 2404879675441,
Пример #4
0
# Below is a Weights breakdown for the Blended wing body.  This method is GP Compatible!

from gpkit import VectorVariable, Variable, Model, units
import numpy as np
from gpkit.tools import te_exp_minus1
import gpkit
gpkit.disable_units()
import matplotlib.pyplot as plt

def secant(x, nterm):
    """Taylor expansion of secant(x).

    Arguments
    ---------
    x : gpkit.monomial
      Variable or expression argument
    nterm : int
        Number of terms in resulting Taylor expansion

    Returns
    -------
    gpkit.Posynomial
        Taylor expansion of secant(x), carried to nterm terms
    """
    if nterm < 1:
        raise ValueError("Unexpected number of terms, nterm=%s" % nterm)

    # The first 12 Euler Numbers
    E2n = np.asarray([ 1, 
                       5,
                       61,