def write25Dinputformat(Rvals, Ivals, frequency, x, z, offset, fname=
    'profile2D.inp'):
    """
        Writing input inversion file for EM2.5D code
    """
    nst = x.size
    nfreq = frequency.size
    fid = open(fname, 'w')
    fid.write('>> # of frequency, source and receiver max\n')
    fid.write('%5i %5i %5i\n' % (nfreq, nst, 1))
    for ifreq in range(nfreq):
        fid.write('>> Frequency (Hz)\n')
        fid.write('%10.4f\n' % frequency[ifreq])
        for ist in range(nst):
            fid.write('>> Source position \n')
            fid.write('%10.4f %10.4f\n' % (x[ist], z[ist]))
            fid.write('%5i\n' % 1)
            fid.write('%5i\n' % (ist + 1))
            fid.write('%10.4f %10.4f %10.5e %10.5e \n' % (x[ist] + offset,
                z[ist], Rvals[ifreq, ist], Ivals[ifreq, ist]))
