Message Boards Message Boards


Calculate the background of the annexed spectrum with EstimatedBackground?

Posted 1 year ago
4 Replies
2 Total Likes

Hello, I would like to calculate the background of the annexed spectrum (csv format). I have imported the data and I have managed to put these data in a Table or in graphic form. But the EstimatedBackground[Data] doesn't seem to work. Your help would be very appreciated! Thank you! Sandra

4 Replies

Hello Sandra,

data = Import[
   "<your path>\\Plot_W3234-3240.csv"];

EstimatedBackground does not support data in the form {{xi,yi}...}, but can handle TimeSeries

ts = TimeSeries[data];


ListPlot[{ts, EstimatedBackground[ts], ts - EstimatedBackground[ts]}, 
 PlotRange -> All, ImageSize -> Large, Joined -> True]

ListPlot[{ts, EstimatedBackground[ts], ts - EstimatedBackground[ts]}, 
 PlotRange -> {{0, 20}, Automatic} , ImageSize -> Large, 
 Joined -> True, 
 PlotLegends -> {"data", "background", "corrected data"}]

Thank you so much Michael! It worked well :-) I would like to find peaks in this spectra, using the FindPeak command... peak=FindPeak[data], doesn't seem to work. Could you give me a hint about this? Does anyone know where can I find the algorithm for the EstimatedBackground or any other mathematica commands?

ts2 = TimeSeriesResample[ts];
peaks = FindPeaks[ts2, 0.5, 0.1, 120];
peaks["Path"] // TableForm
 Epilog -> {Orange, PointSize[0.03], Point[peaks["Path"]]}, 
 PlotRange -> All]

You have to play with the parameters of FindPeaks

Thank you so much once more, Michael!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract