Read pridb

import os

import matplotlib.pyplot as plt

import vallenae as vae

HERE = os.path.dirname(__file__) if "__file__" in locals() else os.getcwd()
PRIDB = os.path.join(HERE, "steel_plate/sample.pridb")

Open pridb

pridb = vae.io.PriDatabase(PRIDB)

print("Tables in database: ", pridb.tables())
print("Number of rows in data table (ae_data): ", pridb.rows())
print("Set of all channels: ", pridb.channel())

Out:

Tables in database:  {'ae_markers', 'ae_globalinfo', 'ae_data', 'data_integrity', 'ae_params', 'acq_setup', 'ae_fieldinfo'}
Number of rows in data table (ae_data):  18
Set of all channels:  {1, 2, 3, 4}

Read hits to Pandas DataFrame

df_hits = pridb.read_hits()
# Print a few columns
df_hits[["time", "channel", "amplitude", "counts", "energy"]]

Out:

Hits:   0%|          | 0/4 [00:00<?, ?it/s]
Hits: 100%|##########| 4/4 [00:00<00:00, 7307.15it/s]

Query Pandas DataFrame

DataFrames offer powerful features to query and aggregate data, e.g. plot summed energy per channel

ax = df_hits.groupby("channel").sum()["energy"].plot.bar(figsize=(8, 3))
ax.set_xlabel("Channel")
ax.set_ylabel("Summed Energy [eu = 1e-14 V²s]")
plt.tight_layout()
../_images/sphx_glr_ex1_read_pridb_001.png

Read markers

df_markers = pridb.read_markers()
df_markers

Out:

Marker:   0%|          | 0/5 [00:00<?, ?it/s]
Marker: 100%|##########| 5/5 [00:00<00:00, 19134.60it/s]

Read parametric data

df_parametric = pridb.read_parametric()
df_parametric

Out:

Parametric:   0%|          | 0/9 [00:00<?, ?it/s]
Parametric: 100%|##########| 9/9 [00:00<00:00, 19558.93it/s]

Total running time of the script: ( 0 minutes 0.235 seconds)

Gallery generated by Sphinx-Gallery