<commit_before>import math

import numpy as np

from config import config


def get_dim(min_mz, max_mz, bin_size):
    """
    Compute the number of bins over the given mass range for the given bin size.

    Args:
        min_mz: The minimum mass in the mass range (inclusive).
        max_mz: The maximum mass in the mass range (inclusive).
        bin_size: The bin size (in Da).

    Returns:
        The number of bins over the given mass range for the given bin size.
    """
    return int(math.ceil((max_mz - min_mz + 1) // bin_size))


class Spectrum:
    """
    Tandem mass spectrum.<commit_msg>Fix bug causing spectrum binning to go out of bounds<commit_after>import math

import numpy as np

from config import config


def get_dim(min_mz, max_mz, bin_size):
    """
    Compute the number of bins over the given mass range for the given bin size.

    Args:
        min_mz: The minimum mass in the mass range (inclusive).
        max_mz: The maximum mass in the mass range (inclusive).
        bin_size: The bin size (in Da).

    Returns:
        The number of bins over the given mass range for the given bin size.
    """
    return math.ceil((max_mz - min_mz + 1) / bin_size)


class Spectrum:
    """
    Tandem mass spectrum.
{'fraction_non_alphanumeric': 0.0714859437751004, 'fraction_numerical': 0.001606425702811245, 'mean_word_length': 2.653958944281525, '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': '298284', 'n_tokens_mistral': 392, 'n_tokens_neox': 373, 'n_words': 166}