@staticmethod
def write_file_undul_phot(undul_phot_dict, file_out='uphot.dat'):
    """
        write uphot.dat file from a dictionary with the output of undul_phot
        :param undul_phot_dict: a dictionary {'radiation':RN0, 'polarization':POL_DEG, 'photon_energy':E, 'theta':TT, 'phi':PP}
        :param file_out: name of the output file (Default: uphot.dat)
        :return:
        """
    Z2 = undul_phot_dict['radiation']
    POL_DEG = undul_phot_dict['polarization']
    e = undul_phot_dict['photon_energy']
    theta = undul_phot_dict['theta']
    phi = undul_phot_dict['phi']
    NG_E = e.size
    NG_T = theta.size
    NG_P = phi.size
    f = open(file_out, 'w')
    f.write('%d  %d  %d \n' % (NG_E, NG_T, NG_P))
    for ie in range(NG_E):
        f.write('%20.10f \n' % e[ie])
    for ie in range(NG_E):
        for t in range(NG_T):
            f.write('%20.10f \n' % theta[t])
    for ie in range(NG_E):
        for t in range(NG_T):
            for p in range(NG_P):
                f.write('%20.10f \n' % phi[p])
    for ie in range(NG_E):
        for t in range(NG_T):
            for p in range(NG_P):
                f.write('%20.10f \n' % Z2[ie, t, p])
    for ie in range(NG_E):
        for t in range(NG_T):
            for p in range(NG_P):
                f.write('%20.10f \n' % POL_DEG[ie, t, p])
    f.close()
    print('File written to disk: %s' % file_out)
