我正在与 asammdf 一起绘制信号,现在我遇到了一个问题,如何使用信号名称重命名通道组?
这是我的代码:
mdf = MDF()
sigs = []
for equipment in table_list:
print("Table name:", equipment[0])
df = pd.read_sql_query('select * from ' + equipment[0], con)
df = df.replace(np.nan, 0)
if equipment[0] == 'state':
df_time = (df['id']-df.iloc[0]['id'])
else:
df_time = (df['ts']-df.iloc[0]['ts']) * 1e-6
df.pop('ts')
sigs = []
for signal in df.columns.to_list():
df[signal]
test_signal = Signal(samples=df[signal], timestamps=df_time,
name=signal,
unit='')
sigs.append(test_signal)
mdf.append(sigs)
mdf.save('..\\Output\\test_complete.mf4', overwrite=True)