Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename submodules in rmgpy.tools #1794

Merged
merged 2 commits into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ipython/mechanism_analyzer.ipynb
Expand Up @@ -92,7 +92,7 @@
"source": [
"import networkx as nx\n",
"import matplotlib.pyplot as plt\n",
"from rmgpy.tools.extractInfoFromckcsv import get_concentration_dict_from_ckcsv, get_rop_from_ckcsv, get_flux_graph_edges_dict\n",
"from rmgpy.tools.ckcsvparser import get_concentration_dict_from_ckcsv, get_rop_from_ckcsv, get_flux_graph_edges_dict\n",
"from rmgpy.chemkin import get_species_identifier\n",
"from IPython.display import display\n",
"import numpy as np\n",
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/rmg/main.py
Expand Up @@ -1036,7 +1036,7 @@ def run_uncertainty_analysis(self):
else:
import re
import random
from rmgpy.tools.canteraModel import Cantera
from rmgpy.tools.canteramodel import Cantera
from rmgpy.tools.muq import ReactorPCEFactory

if self.uncertainty is not None and self.uncertainty['local']:
Expand Down
File renamed without changes.
Expand Up @@ -34,7 +34,7 @@

import rmgpy
from rmgpy.quantity import Quantity
from rmgpy.tools.canteraModel import find_ignition_delay, CanteraCondition, Cantera
from rmgpy.tools.canteramodel import find_ignition_delay, CanteraCondition, Cantera


class CanteraTest(unittest.TestCase):
Expand Down Expand Up @@ -115,14 +115,14 @@ def test_species_conversion(self):
"""
Test that species objects convert properly
"""
from rmgpy.tools.canteraModel import check_equivalent_cantera_species
from rmgpy.tools.canteramodel import check_equivalent_cantera_species
for i in range(len(self.ctSpecies)):
self.assertTrue(check_equivalent_cantera_species(self.ctSpecies[i], self.rmg_ctSpecies[i]))

def test_reaction_conversion(self):
"""
Test that species objects convert properly
"""
from rmgpy.tools.canteraModel import check_equivalent_cantera_reaction
from rmgpy.tools.canteramodel import check_equivalent_cantera_reaction
for i in range(len(self.ctReactions)):
self.assertTrue(check_equivalent_cantera_reaction(self.ctReactions[i], self.rmg_ctReactions[i]))
File renamed without changes.
File renamed without changes.
Expand Up @@ -31,7 +31,7 @@
import shutil
import unittest

from rmgpy.tools.diff_models import execute
from rmgpy.tools.diffmodels import execute


class DiffModelsTest(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -35,7 +35,7 @@

import rmgpy
from rmgpy.rmg.main import RMG
from rmgpy.tools.generate_reactions import execute
from rmgpy.tools.generatereactions import execute


@attr('functional')
Expand Down
File renamed without changes.
Expand Up @@ -31,7 +31,7 @@
import os.path
import unittest

from rmgpy.tools.merge_models import get_models_to_merge, combine_models
from rmgpy.tools.mergemodels import get_models_to_merge, combine_models


class MergeModelsTest(unittest.TestCase):
Expand Down
Expand Up @@ -32,7 +32,7 @@
import numpy as np

from rmgpy.chemkin import load_chemkin_file
from rmgpy.tools.canteraModel import Cantera, generate_cantera_conditions, get_rmg_species_from_user_species
from rmgpy.tools.canteramodel import Cantera, generate_cantera_conditions, get_rmg_species_from_user_species
from rmgpy.tools.plot import GenericPlot, SimulationPlot, find_nearest


Expand Down
4 changes: 2 additions & 2 deletions rmgpy/tools/regression.py
Expand Up @@ -39,8 +39,8 @@
from rmgpy.molecule import Molecule
from rmgpy.quantity import Quantity
from rmgpy.species import Species
from rmgpy.tools.observablesRegression import ObservablesTestCase
from rmgpy.tools.canteraModel import CanteraCondition
from rmgpy.tools.observablesregression import ObservablesTestCase
from rmgpy.tools.canteramodel import CanteraCondition

observables = []
setups = None
Expand Down
2 changes: 1 addition & 1 deletion scripts/checkModels.py
Expand Up @@ -31,7 +31,7 @@
import logging
import math

from rmgpy.tools.diff_models import execute
from rmgpy.tools.diffmodels import execute

logger = logging.getLogger('checkModels')

Expand Down
2 changes: 1 addition & 1 deletion scripts/diffModels.py
Expand Up @@ -51,7 +51,7 @@
--commonDiffOnly Only show species and reactions present in BOTH models which have different values
======================= ====================================================================================
"""
import rmgpy.tools.diff_models as diff_models
import rmgpy.tools.diffmodels as diff_models


################################################################################
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateReactions.py
Expand Up @@ -34,14 +34,14 @@

The input file is a subset of that used with regular RMG jobs.
"""
import rmgpy.tools.generate_reactions as generate_reactions
import rmgpy.tools.generatereactions


################################################################################


def main():
generate_reactions.main()
rmgpy.tools.generatereactions.main()


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion scripts/mergeModels.py
Expand Up @@ -39,7 +39,7 @@
``species_dictionary.txt`` in the execution directory.
"""

import rmgpy.tools.merge_models as merge_models
import rmgpy.tools.mergemodels as merge_models


################################################################################
Expand Down
17 changes: 17 additions & 0 deletions scripts/rmg2to3.py
Expand Up @@ -82,6 +82,21 @@
from tqdm import tqdm


# Module names
MODULES = {
'canteraModel': 'canteramodel',
'canteraTest': 'canteramodelTest',
'extractInfoFromckcsv': 'ckcsvparser',
'diff_models': 'diffmodels',
'diff_modelsTest': 'diffmodelsTest',
'fluxtest': 'fluxdiagramTest',
'generate_reactions': 'generatereactions',
'testGenerateReactions': 'generatereactionsTest',
'merge_models': 'mergemodels',
'merge_modelsTest': 'mergemodelsTest',
'observablesRegression': 'observablesregression',
}

# Global variables and functions
GLOBALS1 = {
# Arkane
Expand Down Expand Up @@ -1818,6 +1833,7 @@
'terminationTime': 'termination_time',
}

# Names which are risky to replace using regex
DANGEROUS = ['SMILES', 'InChI', 'R', 'Run', 'atomTypes', 'format', 'F']


Expand Down Expand Up @@ -1947,6 +1963,7 @@ def find_name_in_line(pattern, line, replacement=None):

replacements = []
if arguments.both_stages or arguments.stage1:
replacements.extend(compile_regex(MODULES, args=False, attr=False, words=words, avoid_danger=avoid_danger))
replacements.extend(compile_regex(GLOBALS1, args=False, attr=False, words=words, avoid_danger=avoid_danger))
replacements.extend(compile_regex(METHODS1, args=False, attr=attr, words=words, avoid_danger=avoid_danger))
replacements.extend(compile_regex(ATTRIBUTES1, args=False, attr=attr, words=words, avoid_danger=avoid_danger))
Expand Down