def _get_min_mag_and_num_bins(self):
        """
        Estimate the number of bins in the histogram and return it along with
        the first bin center value.

        Rounds ``min_mag`` and ``max_mag`` with respect to ``bin_width`` to
        make the distance between them include integer number of bins.

        :returns:
            A tuple of 2 items: first bin center, and total number of bins.
        """
        min_mag = round(self.min_mag / self.bin_width) * self.bin_width
        max_mag = (round((self.char_mag + DELTA_CHAR / 2) /
                   self.bin_width) * self.bin_width)
        min_mag += self.bin_width / 2.0
        max_mag -= self.bin_width / 2.0
        # here we use math round on the result of division and not just
        # cast it to integer because for some magnitude values that can't
        # be represented as an IEEE 754 double precisely the result can
        # look like 7.999999999999 which would become 7 instead of 8
        # being naively casted to int so we would lose the last bin.
        num_bins = int(round((max_mag - min_mag) / self.bin_width)) + 1
        return min_mag, num_bins
Estimate the number of bins in the histogram and return it along with
        the first bin center value.

        Rounds ``min_mag`` and ``max_mag`` with respect to ``bin_width`` to
        make the distance between them include integer number of bins.

        :returns:
            A tuple of 2 items: first bin center, and total number of bins.