Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cantera version and commit to HDF output #860

Merged
merged 1 commit into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions interfaces/cython/cantera/onedim.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# This file is part of Cantera. See License.txt in the top-level directory or
# at https://cantera.org/license.txt for license and copyright information.

import numpy as np
from ._cantera import *
from .composite import Solution, SolutionArray
from math import erf
from os import path
from email.utils import formatdate
import numpy as np

from ._cantera import *
from .composite import Solution, SolutionArray
from . import __version__, __git_commit__


class FlameBase(Sim1D):
Expand Down Expand Up @@ -564,6 +566,8 @@ def write_hdf(self, filename, *args, group=None, species='X', mode='a',
cols = ('extra', 'T', 'D', species)
meta = self.settings
meta['date'] = formatdate(localtime=True)
meta['cantera_version'] = __version__
meta['git_commit'] = __git_commit__
if description is not None:
meta['description'] = description
for i in range(3):
Expand Down
2 changes: 2 additions & 0 deletions interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ def test_write_hdf(self):
k = self.gas.species_index('H2')
self.assertArrayNear(f.X[k, :], self.sim.X[k, :])
self.assertArrayNear(f.inlet.X, self.sim.inlet.X)
self.assertEqual(meta['cantera_version'], ct.__version__)
self.assertEqual(meta['git_commit'], ct.__git_commit__)

settings = self.sim.settings
for k, v in f.settings.items():
Expand Down