<commit_before>#!/usr/bin/env python3
# coding: utf-8
###################################################################
# Copyright (c) 2016-2020 European Synchrotron Radiation Facility #
#                                                                 #
# This work is licensed under the terms of the MIT license.       #
# For further information, see https://github.com/mretegan/crispy #
###################################################################
"""This module provides a comand line interface for generating the parameters of atomic configurations."""

__authors__ = ["<NAME>"]
__license__ = "MIT"
__date__ = "11/05/2019"

import argparse
import logging
import os

import h5py

from crispy.modules.quanty.utils import Calculations, Cowan, Element


def generate_parameters(elements):
    """Generate the atomic parameters of the elments and store them in an HDF5 container."""

    config = h5py.get_config()
    config.track_order = True

    root = os.path.dirname(os.path.abspath(__file__))

    calculations = Calculations(os.path.join(root, "calculations.json"))

    if elements == "all":
        elements = calculations.get_all_elements()

    for element in elements:
        element = Element(element)
        confs = calculations.unique_configurations(element)

        filename = "{:s}.h5".format(element.symbol)
        path = os.path.join(root, "atomic_parameters", filename)

        with h5py.File(path, "w") as h5:
            for conf in confs:
                cowan = Cowan(element, conf)
                conf.energy, conf.atomic_parameters = cowan.get_parameters()
                cowan.remove_calculation_files()<commit_msg>Spell check should be on by default<commit_after>#!/usr/bin/env python3
# coding: utf-8
###################################################################
# Copyright (c) 2016-2020 European Synchrotron Radiation Facility #
#                                                                 #
# This work is licensed under the terms of the MIT license.       #
# For further information, see https://github.com/mretegan/crispy #
###################################################################
"""This module provides a command line interface for generating the parameters of atomic configurations."""

__authors__ = ["<NAME>"]
__license__ = "MIT"
__date__ = "11/05/2019"

import argparse
import logging
import os

import h5py

from crispy.modules.quanty.utils import Calculations, Cowan, Element


def generate_parameters(elements):
    """Generate the atomic parameters of the elements and store them in an HDF5 container."""

    config = h5py.get_config()
    config.track_order = True

    root = os.path.dirname(os.path.abspath(__file__))

    calculations = Calculations(os.path.join(root, "calculations.json"))

    if elements == "all":
        elements = calculations.get_all_elements()

    for element in elements:
        element = Element(element)
        confs = calculations.unique_configurations(element)

        filename = "{:s}.h5".format(element.symbol)
        path = os.path.join(root, "atomic_parameters", filename)

        with h5py.File(path, "w") as h5:
            for conf in confs:
                cowan = Cowan(element, conf)
                conf.energy, conf.atomic_parameters = cowan.get_parameters()
                cowan.remove_calculation_files()
{'fraction_non_alphanumeric': 0.17095038852361027, 'fraction_numerical': 0.01434548714883443, 'mean_word_length': 3.1067484662576685, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6519053', 'n_tokens_mistral': 923, 'n_tokens_neox': 863, 'n_words': 247}