<commit_before>"""create_min_chi2_table.py.

Create Table of minimum Chi_2 values and save to a table.
"""
import argparse
import sys

from joblib import Parallel, delayed

from simulators.iam_script import main


def _parser():
    """Take care of all the argparse stuff.

    :returns: the args
    """
    parser = argparse.ArgumentParser(description='Do iam simulations on stars.')
    parser.add_argument('-s', '--stars', help='Star names', nargs="+", default=None)
    parser.add_argument('--suffix', help='Suffix to add to the file names.', default="")
    parser.add_argument("-n", "--n_jobs", help="Number of parallel Jobs", default=1)
    return parser.parse_args()


if __name__ == "__main__":
    args = _parser()
    stars = args.stars
    n_jobs = args.pop("n_jobs", 1)
    if stars is None:
        stars = ["HD30501", "HD211847", "HD4747"]
    print("Performing simulations on", stars)
    obs_nums = {"HD30501": ["1", "2a", "2b", "3"], "HD211847": ["1", "2"], "HD4747": ["1"]}

    def parallelized_main(opts, chip):
        """Run main with different chips in parallel."""
        opts["chip"] = chip
        return main(**opts)

    iam_opts = {"parallel": False, "more_id": args.suffix, "small": True, }

    for star in stars:
        iam_opts["star"] = star
        for obs in obs_nums[star]:
            iam_opts["obs_num"] = obs

            res = Parallel(n_jobs=n_jobs)(delayed(parallelized_main)(iam_opts, chip)<commit_msg>make njobs a int<commit_after>"""create_min_chi2_table.py.

Create Table of minimum Chi_2 values and save to a table.
"""
import argparse
import sys

from joblib import Parallel, delayed

from simulators.iam_script import main


def _parser():
    """Take care of all the argparse stuff.

    :returns: the args
    """
    parser = argparse.ArgumentParser(description='Do iam simulations on stars.')
    parser.add_argument('-s', '--stars', help='Star names', nargs="+", default=None)
    parser.add_argument('--suffix', help='Suffix to add to the file names.', default="")
    parser.add_argument("-n", "--n_jobs", help="Number of parallel Jobs", default=1, type=int)
    return parser.parse_args()


if __name__ == "__main__":
    args = _parser()
    stars = args.stars
    n_jobs = args.pop("n_jobs", 1)
    if stars is None:
        stars = ["HD30501", "HD211847", "HD4747"]
    print("Performing simulations on", stars)
    obs_nums = {"HD30501": ["1", "2a", "2b", "3"], "HD211847": ["1", "2"], "HD4747": ["1"]}

    def parallelized_main(opts, chip):
        """Run main with different chips in parallel."""
        opts["chip"] = chip
        return main(**opts)

    iam_opts = {"parallel": False, "more_id": args.suffix, "small": True, }

    for star in stars:
        iam_opts["star"] = star
        for obs in obs_nums[star]:
            iam_opts["obs_num"] = obs

            res = Parallel(n_jobs=n_jobs)(delayed(parallelized_main)(iam_opts, chip)
{'fraction_non_alphanumeric': 0.15447991761071062, 'fraction_numerical': 0.02814967387572949, 'mean_word_length': 3.43531202435312, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6236379', 'n_tokens_mistral': 1011, 'n_tokens_neox': 937, 'n_words': 275}