MATLAB Answers

Raman spectra background removal

85 views (last 30 days)
Eirini Bernikola
Eirini Bernikola on 27 Sep 2019
Commented: Csaba on 2 Jan 2020
I have a problem with the removal of background of my SERS spectra. The raw spectrum looks like thisNormally I use the Asymetric least square baseline removal after I create a spectrum with a flat line instead of the first big peak and then I subtract it from the original spectrum. In spectra like this when I follow this procedure I get negative values in the beggining after the removal of the background. I am not an expert but negative values should not exist right? Any ideas how to solve this? Thank you all in advance

  1 Comment

Csaba
Csaba on 2 Oct 2019
You probably have an edge filter to remove the backscattered light (Raleigh scattering) from the very low wavenumber region. So the "first big peak" is probably because of the transparency of the filter. You should not replace it with a flat line, just simple omit it and have a spectrum from ~ 50-200 cm-1 up to the desied value. If you try the Asymetric least square baseline removal for this part of the spectrum only, it will probably work fine. ALS does not like sudden, big jumps.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 27 Sep 2019
The ‘baseline’ of your data appears to be something resembling a logistic curve, although perhaps reversed. You will likely have to fit the section where the x- values are greater than 1000, then evaluate it over the entire x-range. See if the approach in Shifting Baselines of Raman Spectra suggests a solution to your problem.

  6 Comments

Show 3 older comments
Star Strider
Star Strider on 6 Oct 2019
This took a bit longer than I had anticipated, because it is difficult to determine what the true baseline is (and I am still not certain of it), and then devise a way to isolate it.
This seems to work:
D = load('test spectra.mat');
A = D.AMAZON2H1;
A2 = A;
A2 = A2(40:1440,:);
figure
plot(A2(:,1), A2(:,2:end))
grid
[L,P] = islocalmin(A2(:,2), 'MinSeparation',200);
locs = A2(L,1);
Bi = interp1(A2(L,1), A2(L,2:end), A2(:,1), 'pchip');
figure
plot(A2(:,1), A2(:,2:end))
hold on
plot(A2(:,1), Bi, '-k')
hold off
grid
title('Data & Estimated Baselines')
figure
plot(A2(:,1), A2(:,2:end)-Bi) % Success!
grid
title('Baseline-Corrected Data')
It is likely not perfect, however it provides a basis for your further experiments to tweak it to give the result you want. On the basis of exploring your data graphically, I chose the index range of 40:1440. There is nothing absolute about this, I chose it because it appeared to correct the spectrum of your data that likely has the most information.
#Raman spectra background removal - 2019 09 27 (2019 10 06).png
If you want to explore this technique in a bit more detail, include this plot that illustrates the approach I used:
figure
plot(A2(:,1), A2(:,2))
hold on
plot(A2(:,1), Bi(:,1), '-k')
plot(locs, A2(L,2), 'vr')
hold off
grid
See the documentation on the islocalmin and interp1 functions to understand how they work here.
Eirini Bernikola
Eirini Bernikola on 8 Oct 2019
Thank you so so so much! I will test it asap!
Star Strider
Star Strider on 8 Oct 2019
As always, my pleasure!
I am not certain what it should look like, so my code may need to be tweaked. (For some reason, the plot image I posted appeared only as the file name, and not the image. If I had known that, I would have attached it separately.)

Sign in to comment.

More Answers (2)

Eirini Bernikola
Eirini Bernikola on 29 Sep 2019
Edited: Eirini Bernikola on 29 Sep 2019
Thanks you so much for your help. I shall try it right now!

  1 Comment

Star Strider
Star Strider on 29 Sep 2019
As always, my pleasure!
You will likely have to adapt it to your data.

Sign in to comment.


Eirini Bernikola
Eirini Bernikola on 6 Oct 2019
I apologise for my late reply. Actually the first column is the wavenumbers and the rest are several spectra. I just included more than one so I can provide an idea of how they look in general. Do you need me to concert those in another way? Thank you so much for your help!

  3 Comments

Csaba
Csaba on 9 Oct 2019
To whom this answer belongs to?
Star Strider
Star Strider on 9 Oct 2019
@Csaba — The one you are commenting on belongs to Erini Bernikola (and should have been posted as a Comment to my Answer rather than an Answer). Mine is the first Answer in the thread.
Csaba
Csaba on 2 Jan 2020
@Star Strider: Actually yours is the ONLY answer to the question.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!