Extracting column scales from 2D wave

Hi all,

I'm working on a data analysis project, and I'm beginning to wonder if Igor can actually do what I need it to do. The problem is this:

I have a 2-D wave that was an output of my lab apparatus. The columns in this wave each describe a 1-D wave- that is, it's not just a 2-D array, but composed of smaller waves, each of which has its own scaling. Herein lies the problem: I need to write a function that will allow me to read (and print) a list of the scales. I know that this information is contained in the 2-D wave, I'm just not sure how to access it.

My most recent success has been with DimOffset, but I can't get that command to read anything but the scale on the first column. I'm assuming that it isn't supported for multidimensional waves, which leaves me in something of a pickle. I've thought about trying to just print the waves and read the values from the resulting array, but I'm not a good enough programmer to resort to that yet.

Does anyone know a way (or a command) that I can pull the array of scales out of a 2D wave? Any and all suggestions are much appreciated.

Thank you!
Igor is capable of storing and using only one scaling per dimension (but see note below). So if you have a 2D wave, you can set the wave's x scaling and y scaling. But you cannot, for example, use different x scaling for each column of the wave.

Note: Igor also supports per-wave data scaling. Igor ignores the minimum and maximum values of the data scaling but will use the units string, if it is set, for data on the Y axis of a graph.

Is the instrument creating a 2D Igor wave or are you importing this data from some other format? You say you know the information you are looking for is contained within the wave, so I wonder if there is a problem here with terminology. I am also not sure about how you think that printing the waves would help you get the scaling values.

Maybe you should provide more information about what you are trying to do and/or an example wave. You can send this all to support@wavemetrics.com if you would rather not post it on a public forum.
Thank you for your reply! Let me try to clarify a few things; as you said, this might just be a problem with terminology. I'm learning Igor strictly by the manuals/online help, and trying to do it under a time limit, so it's not unlikely that I'm completely misunderstanding my own problem.

aclight wrote:

Is the instrument creating a 2D Igor wave or are you importing this data from some other format? You say you know the information you are looking for is contained within the wave, so I wonder if there is a problem here with terminology. I am also not sure about how you think that printing the waves would help you get the scaling values.


Yes, the instrument is creating a 2D wave. The data we are looking at is an image from a spectrometer. I'll attach an example to this comment.

In the attached pxt file, there is a single wave that's representative of my data. If you open the wave in a table, the row I need is the one above the zeroth row (i.e. containing {-1.86344, -1.82598, -1.78852...} ) I thought that this row displayed the scale for each column, but certainly I might be completely off base.

I don't need these values for any sort of calculation; I just need to print them, in a single row, in a plaintext file. Why on earth would I need to do that? Because the program that we use for more in-depth analysis of this data only can import txt files of a very specific format, and for some reason it needs this information. So the bottom line is that I need to access this row of numbers and print them, in a function or macro, because I have about 200 of these files that need to be converted.

As a sidenote, I know that this seems incredibly masochistic- but the reason I'm doing this is that when my labmate took the data in the first place, he didn't check the "also export as a formatted text file", so all we have are the pxt files.

I sincerely appreciate your attempts to help this dire amateur. Thank you!
a0001.pxt (142.47 KB)
The following command will get you a wave of the numbers above the zeroth row:

Make/D/N = 100 YScale  = Dimoffset(wide_001, 1) + x* dimdelta(wide_001, 1)

I named it YScale because your 2d wave is already scaled - this just extracts the scaling of it.

You can get the horizontal scale in a similar manner:

Make/D/N = 100 XScale  = Dimoffset(wide_001, 0) + x* dimdelta(wide_001, 0)
geesevillain wrote:
In the attached pxt file, there is a single wave that's representative of my data. If you open the wave in a table, the row I need is the one above the zeroth row (i.e. containing {-1.86344, -1.82598, -1.78852...} ) I thought that this row displayed the scale for each column, but certainly I might be completely off base.


Those values are the y-scaling (column) values that Igor computes for your data. These are not stored for every column individually, but are computed by Igor. You may want to read up on this concept a bit, try executing DisplayHelpTopic "The Waveform Model of Data" in the Igor command line.

To save the wave as a text file, and include an additional row that contains these values explicitly, go to Data > Save Waves > Save General Text..., and be sure to check the "Write column positions" checkbox in the dialog (and possibly row positions, too).
BMangum wrote:

You can get the horizontal scale in a similar manner:
Make/D/N = 100 XScale  = Dimoffset(wide_001, 0) + x* dimdelta(wide_001, 0)


Not exactly, because his wave has 181 rows, so that should be "/N=181".

Also, the concept of horizontal and vertical is ambiguous. In tables the rows are arranged vertically, but in image plots the rows are arranged horizontally (and even that explanation is ambiguous). I think 'row scaling' and 'column scaling' are more robust.
Wow! This is exactly what I needed. Thank you all so much!

I'm really only beginning to learn how powerful Igor actually is. I'll definitely be reading more about it, and more carefully.

Again, thank you!
BMangum wrote:
The following command will get you a wave of the numbers above the zeroth row:

Make/D/N = 100 YScale  = Dimoffset(wide_001, 1) + x* dimdelta(wide_001, 1)

I named it YScale because your 2d wave is already scaled - this just extracts the scaling of it.

You can get the horizontal scale in a similar manner:

Make/D/N = 100 XScale  = Dimoffset(wide_001, 0) + x* dimdelta(wide_001, 0)


For clarity's sake, the x should be replaced with p (the point number). You get away with this because your YScale and XScale waves themselves don't have assigned x scaling, so x == p in this one case. But it's a bad habit to use x this way.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.