def generateEntry(reaction, kinetics, index, ci): """ Return a string containing the reaction and its recommended kinetics in a format suitable for putting in the training set. """ import StringIO longDesc = "" entry = Entry( index=index, item=forwardReaction, data=kinetics, reference=None, referenceType="review", shortDesc= "Recommended value based on evaluation of {0:d} kinetics entries. log(CI) = {1:.3f}" .format(len(forwardKinetics), ci), longDesc=longDesc, ) f = StringIO.StringIO() saveEntry(f, entry) string = f.getvalue() f.close() return string
def generateEntry(reaction, kinetics, index, ci): """ Return a string containing the reaction and its recommended kinetics in a format suitable for putting in the training set. """ import StringIO longDesc = "" entry = Entry( index = index, item = forwardReaction, data = kinetics, reference = None, referenceType = "review", shortDesc = "Recommended value based on evaluation of {0:d} kinetics entries. log(CI) = {1:.3f}".format(len(forwardKinetics), ci), longDesc = longDesc, ) f = StringIO.StringIO() saveEntry(f, entry) string = f.getvalue() f.close() return string
def rewrite(entries, name): file = os.path.join(settings['database.directory'], 'kinetics/families', '{0}.py'.format(name)) open(file, 'w').write('#!/usr/bin/env python\n' '# encoding: utf-8\n\n' 'name = "{0}"\n'.format(name) + 'shortDesc = u""\n' 'longDesc = u"""\n\n"""\n' 'recommended = False\n\n') index = 0 for entry in entries: index += 1 entry.index = index saveEntry(open(file, 'a'), entry)