application_vnd.jupyter.stderr_output_1.png image_output_1.png
from glob import glob

import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

paths = glob('../input/g2net-gravitational-wave-detection/train/*/*/*/*')

ids = [path.split('/')[-1].split('.')[0] for path in paths]
path_df = pd.DataFrame({'path': paths, 'id': ids})
path_df
labels = pd.read_csv('../input/g2net-gravitational-wave-detection/training_labels.csv')

train_df = pd.merge(left=labels, right=path_df, on='id')
train_df.shape

target_1 = train_df[train_df.target == 1]
target_0 = train_df[train_df.target == 0]
target_waves = target_1.sample(50).path.values

plt.figure(figsize=(20, 15))
for i in range(1, len(target_waves) + 1):
    pos = np.load(target_waves[i - 1])
    plt.subplot(10, 1, i)
    plt.plot(pos[0], c='firebrick')
    plt.plot(pos[1], c='blue')
    plt.plot(pos[2], c='green')
pos.shape