# Clustering of 2D map, based on similarity in spectra

I have experimental 2D-spectroscopy data, in a format similar to this:

|    |    | f1 | f2 | f3 | . . .
| x1 | y1 | I  | I  | I  | . . .
| x1 | y2 | I  | I  | I  | . . .
| .  | .  | .  | .  | .  | . . .
| .  | .  | .  | .  | .  | . . .


where {x1,y1} are the map coordinates, f1-fn represent the frequency axis values and the rest is the Intensity (counts/second) obtained for each frequency.

What I'd like to be able to do is to let Mathematica model the clusters of similar spectra inside this map, to find its main components. So I've been looking into clustering methods, but so far it's been a bit over my head. Ideally I'd like a solution where

1. I can define the number of clusters to look for (e.g. if I know of mainly two type of spectra to be present in the map, it should look for 2 clusters + background)
2. allow me to define some kind of threshold value that defines how close the individual spectra are allowed to be to each other
3. obtain the errors from this cluster-fit
4. If possible predefine the components representative spectra, if I already have a good model function for them.
5. Let me then export the spectra based on similarity (e.g. points more than 90% likely to stem from one component) so that I can fit them afterwards and create histograms
6. let me visualise the resulting clusters on the xy-grid

So, to cut a long story short: how do I get arrays of xy-Points containing similar spectra?

Edit: added an image depicting the situation

m = Table[Normalize@{i, j, i + j}, {i, 20}, {j, 20}];

• @Asmus the triplet {i, j , i+j} up there corresponds to the intensities of three frequencies. You could use more. I used three just because it fits well for using them as the RGB components of the image so I was able to show a "visual" result Feb 27, 2014 at 16:22