0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

KaggleでRFFIのIQデータを可視化してみた(研究日記)

0
Posted at

Qiita初心者です。拙い内容で申し訳ありません。本記事に含まれるコードはほぼすべてAI生成によるものです。ご容赦ください。

使わせてもらったデータ

まずはインポート

Kaggleでこんな感じのコードをセルに書いたり貼っつけたりして実行しました。

import pandas as pd
filename = "/kaggle/input/datasets/yinchen1986/rffi-123-m5stack-iq-wifi-802-11g-2-4g/24_d7_eb_38_c7_e8_pre.csv"
df = pd.read_csv(filename)

IQデータを抽出

なんか文字列だったので、どうすればいいかClaudeにきいたところ、正規表現を使ったコード出してくれました。
これで本当に正確に抽出できてるのかよくわかんないんですけど、とりあえず動いたのでよしとします。

import re
import numpy as np

raw = df.preamble[0]

# 複素数パターンのみ抽出(科学記数法対応)
pattern = r'[+-]?[\d.]+(?:e[+-]?\d+)?[+-][\d.]+(?:e[+-]?\d+)?j'
tokens = re.findall(pattern, raw)

iq = np.array([complex(t) for t in tokens])

print(f"サンプル数: {len(iq)}")

IQデータ可視化

IQデータ自体、まだよくわかってないんですけど、なんか複素数のなんかなっていう理解です。とりあえず可視化してみました。

from matplotlib import pyplot as plt

plt.figure(figsize=(12, 4))
plt.plot(iq.real, label="I (Real)")
plt.plot(iq.imag, label="Q (Imag)")
plt.xlabel("Sample index")
plt.ylabel("Amplitude")
plt.title("IQ Time Series")
plt.legend()
plt.grid(True)
plt.show()

image.png

IQ成分

実部と虚部との相関もなんとなく気になったので、可視化してみました。

plt.figure(figsize=(6, 6))
plt.scatter(iq.real, iq.imag, s=5, alpha=0.6)
plt.xlabel("I (Real)")
plt.ylabel("Q (Imag)")
plt.title("IQ Constellation")
plt.axis("equal")
plt.grid(True)
plt.show()

結果、特に相関関係はそんななさそうです。なんか円っぽくなりましたね。
image.png

このあとやりたいこと

  • IQデータについてももっと理解を深めたい
  • ノイズが乗ったらどう変化するのかとか理解したい
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?