<commit_before>"""
Multiple utilities to manipulate computed GRS.
"""

import logging
import argparse

import pandas as pd
import numpy as np
import scipy.stats
import matplotlib
import matplotlib.pyplot as plt


from ..utils import parse_computed_grs_file


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


plt.style.use("ggplot")
matplotlib.rc("font", size="6")


def histogram(args):
    out = args.out if args.out else "grs_histogram.png"
    data = parse_computed_grs_file(args.grs_filename)

    plt.hist(data["grs"], bins=args.bins)
    plt.xlabel("GRS")
    logger.info("WRITING histogram to file '{}'.".format(out))

    if out.endswith(".png"):
        plt.savefig(out, dpi=300)
    else:<commit_msg>Remove uneeded call to logging.basicConfig.<commit_after>"""
Multiple utilities to manipulate computed GRS.
"""

import logging
import argparse

import pandas as pd
import numpy as np
import scipy.stats
import matplotlib
import matplotlib.pyplot as plt


from ..utils import parse_computed_grs_file


logger = logging.getLogger(__name__)


plt.style.use("ggplot")
matplotlib.rc("font", size="6")


def histogram(args):
    out = args.out if args.out else "grs_histogram.png"
    data = parse_computed_grs_file(args.grs_filename)

    plt.hist(data["grs"], bins=args.bins)
    plt.xlabel("GRS")
    logger.info("WRITING histogram to file '{}'.".format(out))

    if out.endswith(".png"):
        plt.savefig(out, dpi=300)
    else:
{'fraction_non_alphanumeric': 0.12312925170068027, 'fraction_numerical': 0.005442176870748299, 'mean_word_length': 4.368613138686132, 'pattern_counts': {'":': 0, '<': 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': '1173832', 'n_tokens_mistral': 528, 'n_tokens_neox': 494, 'n_words': 122}