Image representation of 1D waves

Hello, 

I have a set of 1D intensity (I) waves with the same scaling (E). The waves are labeled as "Sample_X_y". 

The "X" identifier corresponds to an integer so I want to create an image representation of the kind EE(X) with as an intensity colorbar. 

The problem is that the step in the X parameter is not equally spaced (that would be empty columns in the 2D mesh).

The following macro produces an image when X is equally spaced but I would like to extend it to a more general case so I could make use of all my data.

I think the idea is to apply interpolation to the data set to fill the intermediate values but I do not know how to proceed from here.

Any ideas or workaround?

 

Friedrich

Example of macro (976 bytes)

The easiest and 'most honest' solution to your problem may be to fill your 2D wave with NaNs (not a number) for lines where the data is missing. This would produce 'gaps' in your image, but you can still create an image as usual with minimal changes. If you think it is OK to interpolate over the missing entries, this can be done. But before that it would be great to hear what Igor version you are using (and preferably which OS). To be honest, the attached code seems so old and has so many outdated lines that it seems almost covered with dust and spiderwebs. ;) Before recommending a more modern approach it would be best to first hear what you are running on. Could you maybe provide an example experiment file with some data? This would make it much easier to get some workable code.

You can display a images with x and y waves. Here is an example where the y wave is not evenly spaced.

Read the help for AppendImage to understand how x and y waves work with images.

Function MyFunction()
//  Test function

    //  Creates an image wave
    Make/O/N=(100,100) DataWave=sin(p*2*pi/100)*sin(q*2*pi/100)
   
    //  Creates x and y waves for the image
    //  the values in the x and y waves corresponds to the corners of the pixels!! Not the centers!!
    Make/O/N=101 XWave, YWave
    XWave=p
    YWave=log(p/20+2)
       
    //  Creates the graph to display the image
    Display
    AppendImage DataWave vs {XWave, YWave}
end

 

In reply to by chozo

Hi Chozo,

Thanks for your reply. In fact, I am using IP 7.08 on macOS (Big Sur). Since you did tremendous work on the angle2K ipf for ARPES, you are familiar with the type of data I am handling with. My detector can only acquire EDC-type data with a long integration time. I think a 2D recreation of the (unoccupied)  band dispersion from these 1D waves may allow for better visualization. This is what I was trying in my rusty code. Interpolation may come after but first I will try to fill it with NaNs as you suggested. I attached pxp with test data where the only variable in the wavename is the polar angle of the sample. 

 

testData_2D.pxp (31.2 KB)

Another option to consider, which is usually applicable to spectral scans, is to display this as a path object in Gizmo.  See, for example, the GizmoWaterfall demo (IP9).

I have written a quick function which does the approach I have suggested earlier, i.e., leaving gaps for missing data. My current approach requires you to set the current data folder and dial in the prefix and suffix manually, like this:

wave2image("Cu_0_","_rt")

Depending on how your data usually looks, a few steps could be further automated. For example, the function could be written to detect which data you have selected in the Data Browser, so that you don't have to manually set the folder. Also, you may be able to detect the prefix and suffix if your data naming follows a specific rule set.

Since the gaps are quite wide in your example, I don't think you'll get a meaningful result by interpolating over the gaps. Also note that Ole's suggestion of using scaling waves would only 'stretch the pixels' of the available data across the image to fill the gaps. Please let me know if you have any further questions about the code or the approach. Sorry, I didn't mean to make fun of your code or anything, so I hope you did not read that the wrong way. For the sake of writing more efficient program I still would recommend you to move away from macros and write functions instead. 

testData_2D_new.pxp (44.86 KB) wave2image_new.ipf (1.72 KB)

In reply to by chozo

chozo wrote:

Since the gaps are quite wide in your example, I don't think you'll get a meaningful result by interpolating over the gaps. Also note that Ole's suggestion of using scaling waves would only 'stretch the pixels' of the available data across the image to fill the gaps. Please let me know if you have any further questions about the code or the approach. Sorry, I didn't mean to make fun of your code or anything, so I hope you did not read that the wrong way. For the sake of writing more efficient program I still would recommend you to move away from macros and write functions instead. 

I applied a MatrixFilter NanZapMedian specifying the background flag after the wave2image function. The image looks better now but of course, this is only testing data. In principle, the interpolation may be done in datasets with higher statistics. I also realized that my macro does not give the same image as the new function. It may be an obsolete approach because in python I could get the same image as the wave2image function. I did not read your comment in the wrong way, on the contrary, it helps me to improve the coding on IP.

There were are few mistakes in your macro. For example you did not iterate over the different waves and the counter was off by one etc.. I have attached your old macro with a few details altered. Now it should give the same result as the new script for your test data. Have a look what is different.

wave2image_old.ipf (1.04 KB)