From 4cb374fbd3805cd66e83630b46a02f0d6c2301e7 Mon Sep 17 00:00:00 2001 From: Richard West Date: Wed, 8 Jun 2011 11:54:12 +0100 Subject: [PATCH 1/5] HTML ouptput of RMG run contains reaction kinetics and comments. The HTML page also has the ability to toggle display of these details. The separation between formatting and function has been slightly blurred by this approach (putting a toHTML() method in the actual class definition) but I think it offers the most flexibility, at least until we can think of a "better" way. --- rmgpy/kinetics.py | 19 +++++++++++++++++++ rmgpy/rmg/output.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/rmgpy/kinetics.py b/rmgpy/kinetics.py index 5b704eab80..42dfb0cf11 100644 --- a/rmgpy/kinetics.py +++ b/rmgpy/kinetics.py @@ -162,6 +162,12 @@ def getRateCoefficients(self, Tlist): `Tlist` in K. """ return numpy.array([self.getRateCoefficient(T) for T in Tlist], numpy.float64) + + def toHTML(self): + """ + Return an HTML rendering. + """ + return "{0!r}".format(self) ################################################################################ @@ -201,6 +207,19 @@ def __reduce__(self): A helper function used when pickling a KineticsData object. """ return (KineticsData, (self.Tdata, self.kdata, self.Tmin, self.Tmax, self.comment)) + + def toHTML(self): + """ + Return an HTML rendering. + """ + string = '\n '.format(self.Tdata.units) + for T in self.Tdata.values: + string += ''.format(T) + string += '\n
T/[{0!s}]{0:.0f}
log10(k/[{0!s}])\n '.format(self.kdata.units) + for k in self.kdata.values: + string += '{0:+.1f}'.format(math.log10(k)) + string += '\n
' + return string def isPressureDependent(self): """ diff --git a/rmgpy/rmg/output.py b/rmgpy/rmg/output.py index 49ed6fed94..14e57fb5b3 100644 --- a/rmgpy/rmg/output.py +++ b/rmgpy/rmg/output.py @@ -139,6 +139,19 @@ def saveOutputHTML(path, reactionModel): td.species img, td.reactants img, td.products img { vertical-align: middle; } + tr.comment { + font-size: small; + } + tr.kinetics { + font-size: small; + } + .KineticsData { + border: 1px solid grey; + } + .KineticsData th { width: 11em;} + .KineticsData td { + width: 3em; + } +