I'm using the BaselineRemoval function with IModPoly, but getting different results despite using the same code and datasets. I had a friend run the code and they get the same results that I do with visual studio. Any idea why the results are different in spyder? My code is below:
Edited to simplify the code
from BaselineRemoval import BaselineRemoval
polynomial_degree = 3 #only needed for IModPoly algorithm
input_array_train = data.copy()
print(input_array_train.shape)
print(input_array_train)
baseline_correction_train=BaselineRemoval(input_array_train).IModPoly(polynomial_degree)
train_raman_proc = baseline_correction_train
print(train_raman_proc.shape)
train_raman_proc
I ran this same code on Spyder and Visual Studio, output is below:
Spyder:
(2042,)
[336167.00616779 335865.93248741 335585.7852715 ... 133592.04534896
133576.80460859 133517.41650705]
(2042,)
array([40893.84981077, 40650.58294278, 40428.28300527, ...,
39654.3524087 , 39840.20855015, 39982.01744302])
Visual Studio:
(2042,)
[336167.00616779 335865.93248741 335585.7852715 ... 133592.04534896
133576.80460859 133517.41650705]
(2042,)
array([32338.54977607, 32129.43948405, 31941.23853284, ...,
39768.88844912, 39896.21948952, 39979.46997397])
Notice how the input data arrays are the same, but the output baseline corrected arrays are different.
It seems to have something to do with the size of the array. If I take a subsection of the array [0:1200], I get the same results from both. And if I take the back half of the subsection [1201:2042] I also get the same results from both. But if I run the whole array (or just a larger subsection, like [0:1300]), then they give different results.
Here's the plots of the baseline corrected output from spyder (top) and visual studio (bottom), note around 1300 it seems like the imodpoly restarts for spyder.