Closed phoebe-sch closed 9 months ago
Thank you for reaching out!
The background
argument of the rp.preprocessing.misc.BackgroundSubtractor.init method is not positional, but a keyword argument. Hence, the BackgroundSubtractor
must be initialized as follows:
rp.preprocessing.misc.BackgroundSubtractor(background=background_test)
Note that background_test
must be a rp.Spectrum
object.
If you find RamanSPy
useful, please consider starring the project on GitHub
! Your support means a lot!
Hi! I seem to be having an issue with background substraction. When I add it to the preprocessing protocols pipeline I get the following error:
TypeError: init() takes 1 positional argument but 2 were given
My code is as follows:
import ramanspy as rp import pandas as pd import matplotlib.pyplot as plt import numpy as np
project_directory = "/Users/ps/Documents/GOM GRADients raman/" test_s1d = rp.load.labspec("/Users/ps/Documents/GOM GRADients raman/REAL station 1 drum/s1_d_p1.txt") rp.plot.spectra(test_s1d)
background_test = "/Users/ps/Documents/GOM GRADients raman/si substrate/si_3_102728.txt"
pipe = rp.preprocessing.protocols.Pipeline([rp.preprocessing.misc.BackgroundSubtractor(background_test), rp.preprocessing.denoise.Gaussian()]) preprocessed_test = pipe.apply(test_s1d)
Thanks so much!