Skip to content

Commit 09bf563

Browse files
committed
Fix exportOldDatabase.py script
- Use argparse for describing output path - Remove hardcoded paths
1 parent d562545 commit 09bf563

1 file changed

Lines changed: 13 additions & 22 deletions

File tree

scripts/exportOldDatabase.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,9 @@
88
"""
99

1010
import os
11-
import sys
12-
import logging
11+
import argparse
1312
from rmgpy.data.rmg import RMGDatabase
14-
from rmgpy.data.base import Entry
15-
from rmgpy.reaction import Reaction
16-
from rmgpy.kinetics import Arrhenius, ArrheniusEP, KineticsData
17-
18-
###############################################################################
19-
20-
21-
def main():
22-
23-
if len(sys.argv) != 3:
24-
raise Exception('You must pass input and output '
25-
'directories as parameters.')
26-
27-
newPath = sys.argv[1]
28-
oldPath = os.path.join(sys.argv[2], 'RMG_database')
29-
30-
export(newPath, oldPath)
13+
from rmgpy import settings
3114

3215

3316
###############################################################################
@@ -38,7 +21,7 @@ def export(input, output, database=None):
3821
print 'Loading the new RMG-Py database...'
3922
if not database:
4023
database = RMGDatabase()
41-
database.load(input)
24+
database.load(input, kineticsFamilies='all', kineticsDepositories='all')
4225

4326
print 'Constructing additional rate rules from kinetics depository...'
4427
for family in database.kinetics.families.values():
@@ -56,5 +39,13 @@ def export(input, output, database=None):
5639

5740

5841
if __name__ == '__main__':
59-
logging.getLogger().setLevel(logging.INFO)
60-
main()
42+
43+
parser = argparse.ArgumentParser()
44+
parser.add_argument('outputPath', metavar='OUTPUT', type=str, nargs=1,
45+
help='the outputPath for the RMG-Java database directory')
46+
47+
args = parser.parse_args()
48+
outputPath = args.outputPath[0]
49+
50+
inputPath = settings['database.directory']
51+
export(inputPath, outputPath)

0 commit comments

Comments
 (0)