From 34a1304297d99d7d23245e0b577e29f86850d613 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 1 Feb 2013 23:39:44 +0000 Subject: [PATCH] [Cython] Added the "import_phases" convenience function --- interfaces/cython/cantera/__init__.py | 1 + interfaces/cython/cantera/utils.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 interfaces/cython/cantera/utils.py diff --git a/interfaces/cython/cantera/__init__.py b/interfaces/cython/cantera/__init__.py index 29a0a7426..2703eb17e 100644 --- a/interfaces/cython/cantera/__init__.py +++ b/interfaces/cython/cantera/__init__.py @@ -1,6 +1,7 @@ from ._cantera import * from ._cantera import __version__, _have_sundials from .liquidvapor import * +from .utils import * import os as _os add_directory(_os.path.join(_os.path.dirname(__file__), 'data')) diff --git a/interfaces/cython/cantera/utils.py b/interfaces/cython/cantera/utils.py new file mode 100644 index 000000000..fd82e75eb --- /dev/null +++ b/interfaces/cython/cantera/utils.py @@ -0,0 +1,9 @@ +from . import Solution + + +def import_phases(filename, phase_names): + """ + Import multiple phases from one file. The phase names should be + entered as a list of strings. + """ + return [Solution(filename, p) for p in phase_names]