(*The calculated RIXS is saved in the imaginary columns of the spec file. I import from the file all the rows from column 3 till the end, every 2 column, i.e. all the imaginary columns. *)
theoryRIXS=-Drop[Import[NotebookDirectory[]<>"Fe3p_KM23_RIXS.spec","Table"],11][[All,3;;-1;;2]];

(*Interpolate linearly all the imported columns specifying the ranges of the incoming and loss energies where I performed the calculations *)
theoryRIXSfun=ListInterpolation[theoryRIXS,{{7102,7122},{42.7,82.7}}];

(*Plot the RIXS map as contour plot *)
ContourPlot[theoryRIXSfun[x,y],{x,7102,7122},{y,42.7,82.7},Contours->20,PlotRange->All]

(*Plot the RIXS map as 3D surface plot *)
Plot3D[theoryRIXSfun[x,y],{x,7102,7122},{y,42.7,82.7},PlotRange->All, PlotPoints->{100,100}]

(*Perform a diagonal cut of the RIXS map, i.e. at fixed emission energy E_em = E_in - E_loss. By changing the offset the diagonal cut is shifted across the map. The cut is performed for different offsets from 0 to 5 with steps of 1 eV.*)
padding={{60,0},{30,0}};
plotsetscan=GraphicsColumn[Table[Plot[{theoryRIXSfun[x+7102,x+42.7+offset]},{x,0,20},PlotStyle->{Red},Frame->True,PlotRange->All,ImagePadding->padding, Axes->None],{offset,0,5,1}],ImageSize->600,Spacings->0]

Export[NotebookDirectory[]<>"RIXS_cut.dat",plotsetscan,"Table"]