Exemplo n.º 1
0
def main(chemkin, dictionary, output, foreign):
    model = CoreEdgeReactionModel()
    model.core.species, model.core.reactions = load_chemkin_file(chemkin, dictionary, read_comments=not foreign,
                                                                 check_duplicates=foreign)
    output_path = os.path.join(output, 'output.html')
    species_path = os.path.join(output, 'species')
    if not os.path.isdir(species_path):
        os.makedirs(species_path)
    save_output_html(output_path, model)
Exemplo n.º 2
0
    def test_save_output_html(self):
        """
        This example is to test if an HTML file can be generated
        for the provided chemkin model.
        """
        folder = os.path.join(os.path.dirname(__file__), 'test_data/saveOutputHTML/')

        chemkin_path = os.path.join(folder, 'eg6', 'chem_annotated.inp')
        dictionary_path = os.path.join(folder, 'eg6', 'species_dictionary.txt')

        # load_chemkin_file
        species, reactions = load_chemkin_file(chemkin_path, dictionary_path)

        # convert it into a reaction model:
        core = ReactionModel(species, reactions)
        cerm = CoreEdgeReactionModel(core)

        out = os.path.join(folder, 'output.html')
        save_output_html(out, cerm)

        self.assertTrue(os.path.isfile(out))
        os.remove(out)
        shutil.rmtree(os.path.join(folder, 'species'))