-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
I'm trying to replicate the shared notebooks, where one fits the Raman spectra of glass, but I'm not managing to correctly subtract the baseline. Since I'm not able to use the "gcvspline" method for baseline(), I opted for "als" instead. Here's my attempt:
using JuMP, PyPlot, Ipopt, Spectra, DataFramesMeta, Statistics, CSV
path = raw"C:\Users\User\Desktop\tratar_dados\codigos_julia\doutorado\dems\LS4.txt"
df = CSV.read(path, DataFrame)
x = df[!, 1]
y = df[!, 2]
figure()
plot(x, y, color="black")
xlabel(L"Raman shift, cm", fontsize = 14)
ylabel("Normalized intensity, a. u.", fontsize = 14)
title("Figure 1: the spectrum of interest",fontsize = 14, fontweight = "bold")
display(gcf())# the regions of interest roi
roi = [860.0 870.0; 1300.0 1400.0]
# evaluate baseline
y_corr, y_bas = baseline(x, y, roi, "als", p=0.01, lam=10^6, niter=10)
#Creates a plot showing the baseline
figure()
plot(x, y_corr, color="black",label="Treated")
plot(x, y_bas, color="blue",label="Baseline")
plot(x, y, color="green",label="Raw data")
title("Figure 2: the fit of the background",fontsize = 18, fontweight = "bold")
# we set the values of the labels of the x and y axis.
xlabel(L"Raman shift, cm",fontsize=18) # The L in front of the string indicates that we use Latex for the maths
ylabel("Intensity, a. u.",fontsize=18)
# we display the legend at the best location, without a frame
legend(loc="best",frameon=false)
display(gcf())Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

