docs: def sum_mags(mags, weights=None):
      """
      Sum an array of magnitudes in flux space.
  
      Parameters:
      -----------
      mags    : array of magnitudes
      weights : array of weights for each magnitude (i.e. from a pdf)
      
      Returns:
      --------
      sum_mag : the summed magnitude of all the stars
      """
      flux = 10**(-np.asarray(mags) / 2.5)
      if weights is None:
          return -2.5 * np.log10(np.sum(flux))
      else:
          return -2.5 * np.log10(np.sum(weights*flux))