def _GSE2_PAZ_read(gsefile):
    """
    Read the instrument response information from a GSE Poles and Zeros file.

    Formatted for files generated by the SEISAN program RESP.

    Format must be CAL2, not coded for any other format at the moment,
    contact the authors to add others in.

    :type gsefile: string
    :param gsefile: Path to GSE file

    :returns: Dictionary of poles, zeros, gain and sensitivity
    :rtype: dict
    """
    with open(gsefile, 'r') as f:
        # First line should start with CAL2
        header = f.readline()
        if not header[0:4] == 'CAL2':
            raise IOError('Unknown format for GSE file, only coded for CAL2')
        station = header.split()[1]
        channel = header.split()[2]
        sensor = header.split()[3]
        date = dt.datetime.strptime(header.split()[7], '%Y/%m/%d')
        header = f.readline()
        if not header[0:4] == 'PAZ2':
            raise IOError('Unknown format for GSE file, only coded for PAZ2')
        gain = float(header.split()[3])  # Measured in nm/counts
        kpoles = int(header.split()[4])
        kzeros = int(header.split()[5])
        poles = []
        for i in range(kpoles):
            pole = f.readline()
            poles.append(complex(float(pole.split()[0]),
                                 float(pole.split()[1])))
        zeros = []
        for i in range(kzeros):
            zero = f.readline()
            zeros.append(complex(float(zero.split()[0]),
                                 float(zero.split()[1])))
        # Have Poles and Zeros, but need Gain and Sensitivity
        # Gain should be in the DIG2 line:
        for line in f:
            if line[0:4] == 'DIG2':
                sensitivity = float(line.split()[2])
                # measured in counts/muVolt
    PAZ = {'poles': poles, 'zeros': zeros, 'gain': gain,
           'sensitivity': sensitivity}
    return PAZ, date, station, channel, sensor
Read the instrument response information from a GSE Poles and Zeros file.

    Formatted for files generated by the SEISAN program RESP.

    Format must be CAL2, not coded for any other format at the moment,
    contact the authors to add others in.

    :type gsefile: string
    :param gsefile: Path to GSE file

    :returns: Dictionary of poles, zeros, gain and sensitivity
    :rtype: dict