How to plot graph the intensity versus wavelength for the spectrum?

0 Votes

Need to plot graph the intensity versus wavelength for the spectrum. Also, me need to determine the wavelengths from the graph (the image below):

введите сюда описание изображения

With which program I can do this? I searched in Google program, but they all work with video (example theremino spectrometer)?. I need to work the image.



  1. + -

    That’s not a graph but a picture. Anyhow you can get started as follows.

    You can load the image with scipy. Then, in the simplest case, do a horizontal cut which will give you intensity vs pixel position.

    import scipy.misc as misc
    import matplotlib.pyplot as plt
    img = misc.imread('spectrum.png', mode='L')
    mid_line = img[len(img)//2]

    There is quite some background luminosity there. Doing a vertical averaging would give a smoother spectra (img_mean = img.mean(axis=0)).

    Then you have to find a way to “calibrate” the pixel positions to wavelength. For that you need an external source of “truth”, which I don’t know what you have available. For example you can say that the maximum at the green line is 510 nm (pixel 405) and the bright blue one 460 nm (pixel 302). Then, depending on your experimental setup you might be able to say that the distance in pixels is linear with wavelength and then you have you conversion.

    Hope this guides you a bit.

    Ignacio Vergara Kausel
Please signup or login to answer this question.