EDIT: I've managed to solve the problem by using "Get Coordinates" on a couple of points and then figuring out the affine mapping by using the values they're supposed to be at, and applying that mapping (both x and y components) to the peaks in order to find the wavelengths and peak intensities.

I've got an image here that I'd like to process:

image 1

Unfortunately, I don't have the corresponding data set with me (mostly my fault), so what I'd like to know is if there's some way to extract the peaks (primarily the top 4) automatically (i.e. no clicking "Get Coordinates" and figuring out how to map them to an actual plot)? I've tried ImageData, but I'm not exactly sure what to do with it since I'm not familiar with image manipulation (Mathematica or otherwise), and most of the documentation deals with manipulating image properties, not extracting points. I'm getting kind of desperate and any help or hints would be greatly appreciated!

Note: I've already seen (3831), but I don't see how I could use it since my picture has lines and not points...

  • $\begingroup$ Atomic hydrogen? $\endgroup$ May 25, 2015 at 15:09
  • $\begingroup$ Yup, I'm supposed to find the largest peaks and compare them with the theoretical values. I know I could just "eyeball it", but I fear the errors would be too large. $\endgroup$
    – blueshift
    May 25, 2015 at 15:24
  • 1
    $\begingroup$ You only have one ratio (between H-alpha and H-beta) to go on anyway, so I wouldn't worry too much about that, if I were you. Everything else is down in the noise and the spectrum is does not have high enough resolution to meaningfully integrate across the lines. Call it 5:1 and be done with it, in my opinion. Allow for maybe a 20% error in your temperature estimate as a result of that. $\endgroup$ May 25, 2015 at 15:32
  • 1
    $\begingroup$ I don't need the intensity ratios, but the wavelengths where the intensity is largest. I see one of them is at around 650 nm, the second largest is at around 480 nm, but is there any way to narrow it down a bit? $\endgroup$
    – blueshift
    May 25, 2015 at 15:39
  • 1
    $\begingroup$ You need seriously higher resolution if you hope to usefully measure (Doppler? Stark?) shifts. The (unshifted) wavelengths have been measured at high resolution by others and they are roughly 656.27 and 486.13 nm (air wavelengths). But these are both multiplets (see e.g. the NIST atomic spectra database), so I would say you need resolution about 1000-10000 times better than you have to get anything useful from it. $\endgroup$ May 25, 2015 at 15:51

1 Answer 1


I accept a long time ago and 3831 does a lot of the trick, simply do

pt1 = {46, 52};
pt2 = {1266, 781};
imgCurve = ImageTrim[Image[MorphologicalComponents[img]], {pt1, pt2}]
ClearAll[data1, points];
data1 = ImageData[Binarize[ColorNegate[imgCurve], {1, 1}]];
points = Reverse /@ Position[data1, 1];
points[[All, 2]] = 781 - points[[All, 2]];

Results will be:

enter image description here

Then remember your offset on the left side. Rescale and the wavelength is there. Assuming pixel is a wavelength step and around 20 pixels, wavelength steps are below 400 micrometers. Your wavelength is

661 mircometer even the line profile can be fitted with this data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.