BaselineRemoval软件包,用于背景荧光/噪声去除 [英] BaselineRemoval package for background fluorescence/noise removal

查看:136
本文介绍了BaselineRemoval软件包,用于背景荧光/噪声去除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 BaselineRemoval 包从某些拉曼光谱中去除背景荧光。在代码文档中,它将输入的首选格式表示为 input_array:输入中提供的pandas dataframe列为dataframe ['input_df_column']。它也可以是Python列表对象

I'm trying to use the BaselineRemoval package to remove background fluorescence from some Raman spectra. In the code documentation, it states the preferred format for the input as input_array: A pandas dataframe column provided in input as dataframe['input_df_column']. It can also be a Python list object

我的示例-

df = pd.DataFrame(
    {'Patient': [1, 2, 3, 4, 5, 6],
     'Group': [1, 1, 1, 2, 2, 2],
     'Samples': [list(np.random.randn(3).round(2)) for i in range(6)]
    }
)

input_array = df['Samples']
polynomial_degree = 2

baseObj = BaselineRemoval(input_array)
Modpoly_output = baseObj.ModPoly(polynomial_degree)

但是,这会产生错误 ValueError:设置具有序列的数组元素。

不确定如何继续。

推荐答案

简单的

A simple for loop should do it.

df = pd.DataFrame(
    {'Patient': [1, 2, 3, 4, 5, 6],
     'Group': [1, 1, 1, 2, 2, 2],
     'Samples': [list(np.random.randn(3).round(2)) for i in range(6)]
    }
)

input_array = df['Samples']
polynomial_degree = 2

for row in input_array:
    print(BaselineRemoval(row).ModPoly(polynomial_degree))

这篇关于BaselineRemoval软件包,用于背景荧光/噪声去除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆