code: def read_phase(ph_file):
      
      ph_catalog = Catalog()
      f = open(ph_file, 'r')
      # Topline of each event is marked by # in position 0
      for line in f:
          if line[0] == '#':
              if 'event_text' not in locals():
                  event_text = {'header': line.rstrip(),
                                'picks': []}
              else:
                  ph_catalog.append(_phase_to_event(event_text))
                  event_text = {'header': line.rstrip(),
                                'picks': []}
          else:
              event_text['picks'].append(line.rstrip())
      ph_catalog.append(_phase_to_event(event_text))
      return ph_catalog
docs: Read hypoDD phase files into Obspy catalog class.
  
      :type ph_file: str
      :param ph_file: Phase file to read event info from.
  
      :returns: Catalog of events from file.
      :rtype: :class:`obspy.core.event.Catalog`
  
      >>> from obspy.core.event.catalog import Catalog
      >>> # Get the path to the test data
      >>> import eqcorrscan
      >>> import os
      >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data'
      >>> catalog = read_phase(TEST_PATH + '/tunnel.phase')
      >>> isinstance(catalog, Catalog)
      True