# combining multiple 2D waves, each with its own scaling

hello,

before I go and write my own script, I wonder if there's a built-in function that can accomplish the following?

I have multiple 2D data sets, with x- and y-scaling that may or may not be the same (generally the x-scaling is the same and the y-scaling varies; but let's allow for the general case). I would like to combine these all into one table. It is easy to combine plots of these using AppendImage, but I also want to produce a single table.

Concatenate does not maintain the scaling (or rather, it appears to adopt the scaling of the first wave it encounters).

It seems ImageInterpolate should work, but it only wants a single wave.

Thanks!

I am not understanding something. Is the SCALING (resolution) different or is the SIZE different. Consider two images:

scaling difference: 640pixel x 480 pixel image sizes at 10 cm/pixel versus 4 cm/pixel
size difference: 640pixel x 480pixel versus 320pixel x 400pixel image both at 10 cm/pixel

How do you want to combine these into one table?  If you have, say, two 10 x 10 arrays, the two arrays can be added to one table with the first 10 columns from array 1 and the second 10 columns from array 2.  Are you looking for something more complex?

Thank you for the replies. @jjweimer, the answer is "both". The waves I have are of arbitrary size, so let's say one is M x N points and the other P x Q points. As for scaling, both the x- and y-scaling may be different, so that even if the range of the scaling overlaps for the two waves, the actual x and y values could be different.

I want to combine these into a single 2D wave. Given the scaling differences, I probably need to interpolate from the original waves into the final wave in order to have uniformly spaced data.

To be concrete about the application: I have spectroscopic data that is intensity (z) vs energy (x) and magnetic field (y). For various reasons not worth discussing, we've ended up with many data tables covering disparate field and energy ranges; it would be convenient to combine them all into a single wave. I can imagine a script that looks at each wave, reads the ranges of the x- and y- axes, creates one new wave whose x- and y- axes limits are given by the extrema found in the original set of tables; and point-by-point populates the new table by placing each z(x,y) point from the original tables. But that sounds tedious, and won't interpolate very well.

Here's a good visual: think of a patchwork quilt. I have many patches, made by sewing machines that produce a variable number of stitches per length. I want to generate the overall quilt.

The term that might best fit is "blending". Have you looked at the ImageComposite and ImageRegistration operations? Perhaps they offer a method that would work to do what you want.

Alternatively, while tedious, you could develop a manual method.

- For each row RB in Matrix B

-- Find the rows in Matrix A between which RB is to be placed
-- Add a row in Matrix A at that location

-- For each column CB in Matrix B

--- Find the columns in Matrix A between which RC is to be placed
--- Add a column in Matrix A at that location

There are probably MatrixOP or image processing operations that are well suited, but

`DisplayHelpTopic ImageFromXYZ`

may be useful. Turn your data sets into X, Y, Z, create the desired 2D output wave, then ImageFromXYZ will handle interpolation and allow you to average overlapping data.

Forum

Support

Gallery