How to get 2D and 3D image manipulation command in IGOR Pro main panel

Dear All,

I want to convert my 2D image scale axis using IGOR Pro software. Actually, I want to convert my ARPES data from "eV vs theta" to "eV versus k" value using 2D/3D option but I don't know how to get this 2D option active. If there is any procedure file or script available please help me.
Would it be possible to post an example? It is a bit difficult to understand what you are trying to do. So you have ARPES maps (i.e. 2D waves with energy and angle scale)? Do you want to convert the angle scale to k vector? This would require to recalculate the map using the impulse conservation formula. This could be done by using the intep2D function. Or is it something else you want to achieve? It would help if you could post some test experiment or data.
Dear Chozo,

Yes, I am trying to convert the angle (degree) scale to k vector using igor. How to use this Interp2D function? Please send the procedure file if possible. I am sending the ARPES energy spectra file.

Best Regards,
manojphy
s0391-0.ibw (6.5 MB)
Here's the code to do what you want (I hope it runs in Igor 5):
Function AngleToK(inwave)
    Wave inwave
   
    String newname = NameofWave(inwave)+"_k"
    Duplicate/O inwave, $newname
    Wave outwave = $newname

    Variable rows,columns,xdelta,xoffset,ydelta,yoffset // inwave parameters
    rows    = DimSize(inwave,0)
    columns = DimSize(inwave,1)
    xdelta  = DimDelta(inwave,0)
    xoffset = DimOffset(inwave,0)
    ydelta  = DimDelta(inwave,1)
    yoffset = DimOffset(inwave,1)
   
    Variable kmin,kmax,kdelta,Emax
    Emax    = xoffset + xdelta*(rows-1)
    kmin    = 0.512*sqrt(Emax)*sin(pi/180*(yoffset))    // calculate the k boundaries (i.e., k at highest Ekin)
    kmax    = 0.512*sqrt(Emax)*sin(pi/180*(yoffset+(columns-1)*ydelta))
    SetScale/I  y kmin,kmax,"Ang^-1", outwave       // scale the y axis
   
    outwave = interp2D(inwave, x, 180/pi*asin(y/ (0.512*sqrt(x)))) // recalculate to k
    outwave = (NumType(outwave)==2) ? 0 : outwave   // replace NaNs (optional)
End


I also attache it as a file. Just run by typing angletok(your_wave_name) in the command line.
AngleToK.ipf (961 bytes)
Dear Chozo,

Thank you very much for your reply and sending the procedure file. I also want to know if the binding energy(eV) versus k plot can be converted into binding energy (intensity) versus k curve plots using igor. I am attaching a sample file for your reference. Please send the procedure file for this also.

Best Regards,
manojphy
momentum distribution plots.pdf (936.13 KB)
Yes, that's right. Of course properly prepared data is required, and the recalculation is quasi the final step.
Right, thanks for you addition. It is indeed easy to forget something when analyzing ARPES data, which result in some horribly wrong spectra I see sometimes. But I also find myself sometimes wondering how far the measurement software has processed the data automatically and which steps I have to do myself.
Dear chozo and thomas_braun,

Thank you very much for your comments.
I could not understand thomas comment "normal emission at zero angle" in regard of my question.
Also, what is the meaning of 'properly prepared data'? Is this comment 'recalculation is quasi' means conversion will be an approximation only?
I didn't understand your last comment fully!!!!
Please elaborate in simpler language so that I also can understand and if you have the procedure file then please post it. Your previous program is running well. Thank you very much again for that.

Best regards,
manojphy

The comment was about your angle axis. You have zero degree at the center of your data. But if you have, for example, measured a tilted or sloped sample (i.e., not at normal emission) this would be wrong. Other cases include raw data which are slightly of, e.g. when the analyzer lens table is not properly set up (if you had a nice Gamma-point energy band in your spectra you could check whether the inflection point is at zero).
Anyway, you have to make sure that the angle values in your data correspond to the real emission angles from the sample surface before recalculating to k, i.e., if your sample was tilted by for instance 30° you need to add this to your angle axis.

Regarding your question about the BE case: Of course that is possible if you have the used photon energy available. Since there a several ways to handle binding energy (some people use positive values some use negative values for BE etc.) it would be better if you had again an example file of BE scaled data you are usually using. I could include the recalculation in the procedure. You can also handle the recalculation to KE yourself before using the above procedure.
chozo wrote:
Here's the code to do what you want (I hope it runs in Igor 5):
Function AngleToK(inwave)
    Wave inwave
   
    String newname = NameofWave(inwave)+"_k"
    Duplicate/O inwave, $newname
    Wave outwave = $newname

    Variable rows,columns,xdelta,xoffset,ydelta,yoffset // inwave parameters
    rows    = DimSize(inwave,0)
    columns = DimSize(inwave,1)
    xdelta  = DimDelta(inwave,0)
    xoffset = DimOffset(inwave,0)
    ydelta  = DimDelta(inwave,1)
    yoffset = DimOffset(inwave,1)
   
    Variable kmin,kmax,kdelta,Emax
    Emax    = xoffset + xdelta*(rows-1)
    kmin    = 0.512*sqrt(Emax)*sin(pi/180*(yoffset))    // calculate the k boundaries (i.e., k at highest Ekin)
    kmax    = 0.512*sqrt(Emax)*sin(pi/180*(yoffset+(columns-1)*ydelta))
    SetScale/I  y kmin,kmax,"Ang^-1", outwave       // scale the y axis
   
    outwave = interp2D(inwave, x, 180/pi*asin(y/ (0.512*sqrt(x)))) // recalculate to k
    outwave = (NumType(outwave)==2) ? 0 : outwave   // replace NaNs (optional)
End


I also attache it as a file. Just run by typing angletok(your_wave_name) in the command line.


I try to use this code to convert angle resolved photoemission (ARPES) data.
My motivation is same as that of the topic of discussion here: changing the raw ARPES data which is Energy vs. angle [E(theta)] to Energy vs. k_parallel [E(k||)]. In this code I can see that it convert the x-scale to k_parallel but if I understood correctly, the last two lines are basically rescaling with uniform spacing, am I right?

But, when one try to go from E(theta) to E(k||), the new x-axis is function of two variable (Energy and angle) and thus it is not just linearly varying. So, how the final data display is done?

As far as I understand, this is suppose to be done by taking two wave of angle and energy and then use the relation 0.51*sin(angle)*sqrt(energy), which is third wave. Then plot third wave with old energy and intensity. So, if possible pls explain how does it work.
I hope you can understand my question!
mslv86 wrote:

But, when one try to go from E(theta) to E(k||), the new x-axis is function of two variable (Energy and angle) and thus it is not just linearly varying. So, how the final data display is done?

The angle alpha can be transformed to k_parallel using trigonometry and some physical unit conversion as in chozo's code. In the attached image I've included the governing formulas. The energy value of a pixel/data point is not changed with this kind of conversion.
latex.png (6.7 KB)
mslv86 wrote:

As far as I understand, this is suppose to be done by taking two wave of angle and energy and then use the relation 0.51*sin(angle)*sqrt(energy), which is third wave. Then plot third wave with old energy and intensity. So, if possible pls explain how does it work.


In short, that's sort of what the second to last line does:
    outwave = interp2D(inwave, x, 180/pi*asin(y/ (0.512*sqrt(x)))) // recalculate to k

Look how the second argument is your equation solved for the angle, taking both the energy (x) as well as k (y). That is necessary because the old data (inwave) is in angle scaling and the new data is already in the final k vector scaling. So in order to calculate a value for the rescaled data I need to translate from the final scaling (k vector) back to the angle to look up the position in inwave, because, of course, the argument takes the the scaling from the right side,i.e., outwave. interp2D looks for the right point in the old data using the conversion formula, so everything's all right.
I hope that made a bit sense. Try a simple example with two differently scaled waves if you are still not sure what is going on.
I thank you people for your interest.
My question is more related to only final data display.
For example, I have a 2D ARPES data and I used your code to get k||. When I just see the "outwave" in image plot and in table, I cannot see the image rather it is with zeros.
So, I have confused how it worked. If possible you can just try this example data and attach back so that I can find the procedure for final data display.
[I could not attach full image due to memory limitation, so only short range is attached]
Table1_0.pxp (827.63 KB) Table1_0.pxp (827.63 KB) Table1_0.pxp (827.63 KB)
There are two 'problems' with your data if you want to use my code. The first point is that the x axis seems to be angle values and the y axis the energy direction. My formula expects this to be exactly the other way around. I can easily rewrite this or you could try to flip your data. Either way, there is another problem. The energy axis seems to be scaled to binding energy normalized to the Fermi edge. As you may know, the momentum conservation formula is written in terms of kinetic energy. Thus it is needed to have the real kinetic energy values for the transformation. Either this can be integrated in the formula by temporarily rescaling the energy values or this step is done before using the procedure. But for this the photon energy and work function are needed (or you could just take the original KE values measured in the first place, before the data was converted), which I don't find in your file.

If the transformation is done correctly, the image can be displayed in a normal way (i.e., linear in k), as interp2D has interpolated any non-linearity already. The data fidelity of course decreases a bit around the low-KE edges (think of it like doing a lens distortion to an image where the edges get stretched or compressed).
Hope that clears things up a bit.
As you told, when I have taken care of both the points, everything is all right.
Thanks a lot.
I have another point to ask to you: When sample is biased, the emitted electron angle changes, and thus one needs correction. The equation for the correction is
theta_f=theta_i+atan((e*U*(1-sin(theta_i)/theta_i))/(Ekin-(e*U*(1-sin(theta_i)/theta_i))))^0.5
Again this is function of two variable. But this theta_f is replaced in the k|| calculation equation in the place of theta. So I would like to use your code (because it is much faster compared to converting to XYZ data and do the same and plotting back using XYZ plot). But in single macro so that only once data will be interpolated. So, I have modified as follows. Conceptually appears to be correct. but I have problem.
Since Ekin is in the denominator, i have taken minimum energy.

Here is the code:
Function AngleToK_withbias(inwave) /// needs angle (y-axis) vs energy (x-axis)
Wave inwave

String newname = NameofWave(inwave)+"_kwb"
Duplicate/O inwave, $newname
Wave outwave = $newname

Variable rows,columns,xdelta,xoffset,ydelta,yoffset // inwave parameters
rows = DimSize(inwave,0)
columns = DimSize(inwave,1)
xdelta = DimDelta(inwave,0)
xoffset = DimOffset(inwave,0)
ydelta = DimDelta(inwave,1)
yoffset = DimOffset(inwave,1)

Variable kmin,kmax,kdelta,Emax,Emin
Emax = xoffset + xdelta*(rows-1)
Variable theta_f,theta_i
Variable U=5
Variable e= 1.602176565*10^-19
theta_i=pi/180*(yoffset)
Emin=xoffset
theta_f=theta_i+atan((e*U*(1-sin(theta_i)/theta_i))/(Emin-(e*U*(1-sin(theta_i)/theta_i))))^0.5
kmin = 0.512*sqrt(Emax)*sin(theta_f) // calculate the k boundaries (i.e., k at highest Ekin)
theta_i=pi/180*(yoffset+(columns-1)*ydelta)
theta_f=theta_i+atan((e*U*(1-sin(theta_i)/theta_i))/(Emin-(e*U*(1-sin(theta_i)/theta_i))))^0.5
kmax = 0.512*sqrt(Emax)*sin(theta_f)
SetScale/I y kmin,kmax,"Ang^-1", outwave // scale the y axis

outwave = interp2D(inwave, x, (180/pi)*asin(y/ (0.512*sqrt(x)))) // recalculate to k
outwave = (NumType(outwave)==2) ? 0 : outwave // replace NaNs (optional)
End

If you have any idea pls let me know.
I am not familiar with a sample bias correction. Does the Ekin in the denominator imply that the angle changes depending on the electron energy? If that's the case, then the data would need to be recalculated (redistributed) to the real angle first, since the angle has effectively become nonlinear. In a second step one could then recalculate to k values. Maybe it would be also doable in one step. Do you have a source with more information on this? The formula in your post is difficult to read, and it would be helpful to know more about the dependencies. Anyway, your posted code cannot work since you have only adjusted the scaling of the output wave. But the input data is unchanged and thus the look-up of interp2D fails, as the wrong angles are used (adjusted and old angle information does not match).
Also, trigonometric functions work in radiants. You will get unexpected results if you just feed in degrees.
I understood that this code mainly needs boundary value so I have tried to modify with only those lines. But, regarding angle to rad I hope i have done it correct.
The mentioned paper gives details: Phys. Rev. B 77, 085425 (2008).
mslv86 wrote:
I understood that this code mainly needs boundary value so I have tried to modify with only those lines. But, regarding angle to rad I hope i have done it correct.
The mentioned paper gives details: Phys. Rev. B 77, 085425 (2008).


Yes, I see that you treated the angles correctly in radiants. Sorry, for the confusion.

I looked at the paper, but I think you are misinterpreting the formula in your previously posted code. As I understand it, the appendix of the paper describes how the angle of the electron trajectory has to be corrected if the sample surface is tilted. This has two implications: For one, you don't need to apply a correction if you measure in normal emission (i.e., if theta_m = 0 then theta_x = theta_e). Secondly, if you use the formula, the input angle (theta_m) is not the measured electron angle but the tilt angle of the sample surface, i.e., a constant just like U. It is possible to incorporate a correction for a tilted surface under bias in the calculation but I think it would be better to do it in a separate step, since a) it's a rather special case and b) the data has to be redistributed anyway separately as theta_x depends on Ekin. I can try to write something, but it would be better if we first agreed on the procedure (and probably do this in a separate thread, since this one has been derailed already considerably).