Update RMG-database scripts and notebooks to Python 3#364
Conversation
mliu49
left a comment
There was a problem hiding this comment.
I made a couple quick comments about imports which are not necessary since we aren't aiming for compatibility with both Python 2 and Python 3.
| from __future__ import division | ||
| from __future__ import print_function | ||
|
|
||
| from builtins import zip | ||
| from builtins import range | ||
| from past.utils import old_div |
There was a problem hiding this comment.
Since we're going for Python 3 compatibility only, we don't need these compatibility measures.
__future__imports are not necessary since we are using Python 3 only- For division, we should use the built-in
/operator instead of importing old_div. - We can use zip and range from the default Python 3 libraries instead of the
builtinsmodule, so these imports are not necessary.
| from rmgpy.chemkin import loadChemkinFile, getSpeciesIdentifier | ||
|
|
||
| from builtins import str | ||
| from builtins import range |
There was a problem hiding this comment.
These imports are also not necessary.
| to | ||
| <policy domain="coder" rights="read|write" pattern="EPS" /> | ||
| """ | ||
| from __future__ import print_function |
| "\n", | ||
| " # Find key and value of max rate coefficient\n", | ||
| " key_max_rate = max(mydict.iteritems(), key=operator.itemgetter(1))[0]\n", | ||
| " key_max_rate = max(iter(mydict.items()), key=operator.itemgetter(1))[0]\n", |
There was a problem hiding this comment.
Could you change this to just max(mydict.items(), ...?
| to | ||
| <policy domain="coder" rights="read|write" pattern="EPS" /> | ||
| """ | ||
|
|
There was a problem hiding this comment.
I don't think this change is necessary if there are no other changes to this file.
There was a problem hiding this comment.
This commit is removed.
| "reaction_dict = {}\n", | ||
| "for library_name in libraries:\n", | ||
| " kinetic_library = database.kinetics.libraries[library_name]\n", | ||
| " for index, entry in iter(kinetic_library.entries.items()):\n", |
There was a problem hiding this comment.
This can also be kinetics_library.entries.items() without iter.
| " for index, entry in kineticLibrary.entries.iteritems():\n", | ||
| "for library_name in libraries:\n", | ||
| " kinetic_library = database.kinetics.libraries[library_name]\n", | ||
| " for index, entry in iter(kinetic_library.entries.items()):\n", |
ca156a7 to
7f5fa5c
Compare
|
Thanks for the comments! I squashed and rebased. |
This pull request addresses "Update RMG-database scripts and notebooks" in ReactionMechanismGenerator/RMG-Py#1726.
In addition, RMG-Java related scripts and unnecessary scripts are deleted as discussed in #363.
generateFilterArrheniusFits.ipynb is updated but can only be finalized once from rmgpy/data/kinetics/database.py has 'filter_limit_fits' updated (currently not in master and Python 3).
Errors related to drawing a molecule are fixed in ReactionMechanismGenerator/RMG-Py#1735.
The documentation is updated in ReactionMechanismGenerator/RMG-Py#1767.