Skip to content

Commit

Permalink
allow list inputs to saveTrainingReactions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson541 authored and mliu49 committed May 26, 2018
1 parent 47c6e01 commit ffe80af
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,17 @@ def saveTrainingReactions(self, reactions, reference=None, referenceType='', sho
"""
from rmgpy import settings

if not isinstance(reference, list):
reference = [reference]*len(reactions)
if not isinstance(referenceType, list):
referenceType = [referenceType]*len(reactions)
if not isinstance(shortDesc, list):
shortDesc = [shortDesc]*len(reactions)
if not isinstance(longDesc, list):
longDesc = [longDesc]*len(reactions)
if not isinstance(rank, list):
rank = [rank]*len(reactions)

training_path = os.path.join(settings['database.directory'], 'kinetics', 'families',
self.label, 'training')

Expand Down Expand Up @@ -817,11 +828,11 @@ def saveTrainingReactions(self, reactions, reference=None, referenceType='', sho
label = str(reaction),
item = reaction,
data = reaction.kinetics,
reference = reference,
referenceType = referenceType,
shortDesc = unicode(shortDesc),
longDesc = unicode(longDesc),
rank = rank,
reference = reference[i],
referenceType = referenceType[i],
shortDesc = unicode(shortDesc[i]),
longDesc = unicode(longDesc[i]),
rank = rank[i],
)

# Add this entry to the loaded depository so it is immediately usable
Expand Down

0 comments on commit ffe80af

Please sign in to comment.