docs: def recurrence_table(mag, dmag, year, time_interval=None):
      """
      Table of recurrence statistics for each magnitude
      [Magnitude, Number of Observations, Cumulative Number
      of Observations >= M, Number of Observations
      (normalised to annual value), Cumulative Number of
      Observations (normalised to annual value)]
      Counts number and cumulative number of occurrences of
      each magnitude in catalogue
  
      :param numpy.ndarray mag:
          Catalog matrix magnitude column
      :param numpy.ndarray dmag:
          Magnitude interval
      :param numpy.ndarray year:
          Catalog matrix year column
  
      :returns numpy.ndarray recurrence table:
          Recurrence table
      """
      # Define magnitude vectors
      if time_interval is None:
          num_year = np.max(year) - np.min(year) + 1.
      else:
          num_year = time_interval
      upper_m = np.max(np.ceil(10.0 * mag) / 10.0)
      lower_m = np.min(np.floor(10.0 * mag) / 10.0)
      mag_range = np.arange(lower_m, upper_m + (1.5 * dmag), dmag)
      mval = mag_range[:-1] + (dmag / 2.0)
      # Find number of earthquakes inside range
      number_obs = np.histogram(mag, mag_range)[0]
      number_rows = np.shape(number_obs)[0]
      # Cumulative number of events
      n_c = np.zeros((number_rows, 1))
      i = 0
      while i < number_rows:
          n_c[i] = np.sum(number_obs[i:], axis=0)
          i += 1
      # Normalise to Annual Rate
      number_obs_annual = number_obs / num_year
      n_c_annual = n_c / num_year
      rec_table = np.column_stack([mval, number_obs, n_c, number_obs_annual,
                                   n_c_annual])
      return rec_table