wholecell.tests.utils.test_library_performance

Test library performance (NumPy and libraries above and below it) to discover configuration problems such as performance bugs in some versions of pip packages or problems linking to native libraries. Precise timings aren’t needed.

Running it this way prints all timing measurements:

python -m wholecell.tests.utils.test_library_performance

Running it these ways prints timing measurements (and other printout) only for failed tests:

pytest wholecell/tests/utils/test_library_performance.py

Running it this way runs the iterative test that isn’t automatically discovered as a test method:

python -m unittest -v wholecell.tests.utils.test_library_performance.Test_library_performance.multitest_dot

class wholecell.tests.utils.test_library_performance.Test_library_performance(methodName='runTest')[source]

Bases: TestCase

Test some library operations to see that they’re performing OK.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
multitest_dot()[source]

Time NumPy matrix dot() many times.

time_this(code_to_measure, limit=0.5)[source]

Time the execution of code_to_measure(), enforcing a limit.

wholecell.tests.utils.test_library_performance._format_time(timespan, precision=3)[source]

Formats the timespan in a human-readable form.

Cf. IPython %time magic github.com/ipython/ipython - IPython/core/magics/execution.py

wholecell.tests.utils.test_library_performance.derivatives(y, t)[source]
wholecell.tests.utils.test_library_performance.derivatives_jacobian(y, t)[source]
wholecell.tests.utils.test_library_performance.time_it(code_to_measure, title='Measured')[source]

Time code_to_measure(). Print timings. Return the elapsed wall time. Cf. IPython %time magic github.com/ipython/ipython - IPython/core/magics/execution.py time()