!pip install matplotlib pandas pyarrow seaborn
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "sans"
plt.rcParams["font.size"] = 8
sns.set_palette('muted')
Shot Metadata#
This notebook contains a demonstration of plotting several of the summary statistics that accompany the shot metadata.
Firstly, we’re going to load all the shot data into a pandas dataframe:
summary = pd.read_parquet('https://mastapp.site/parquet/level2/shots')
summary
| shot_id | campaign | ohmnic_energy_total | radii_s_area_max_current | equi_max_li3_time | generic_dt_energy_max_current | generic_s_area_max | divertor_config | generic_dt_total_energy | generic_plasma_elongation_max_current | ... | nbi_energy_ss_max_current | nbi_total_injected_energy_ss | nbi_injected_energy_ss_ruby_time | nbi_power_ss_max_current | nbi_power_truby_ss | shot_scenario | scenario | rad_o2ratio | radii_c2ratio | shot_flat_top_duration | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 11766 | M5 | 0.114530 | 22.644779 | 0.270 | -192676.851518 | 23.362010 | Conventional | 430281.62 | 1.601573 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 1 | 11767 | M5 | 0.134566 | 22.002382 | 0.150 | -82970.042801 | 23.469263 | Conventional | 254662.14 | 1.594044 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 2 | 11768 | M5 | 0.129432 | 23.027416 | 0.270 | -113603.034418 | 23.507900 | Conventional | 401462.44 | 1.612653 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 3 | 11769 | M5 | 0.156508 | 22.759919 | 0.290 | -127591.593586 | 23.938997 | Conventional | 283884.00 | 1.673236 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 4 | 11771 | M5 | 0.131940 | 22.525058 | 0.290 | -164363.251971 | 23.959898 | Conventional | 309404.78 | 1.655904 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 11568 | 30467 | M9 | 0.094553 | 25.402852 | 0.030 | 31972.688440 | 25.416924 | Conventional | 2307703.20 | 1.930563 | ... | 0.137379 | 0.340425 | 0.000195 | 2.180491 | NaN | S6 | 3.0 | NaN | NaN | NaN |
| 11569 | 30468 | M9 | 0.095056 | 25.509430 | 0.030 | -146041.829662 | 25.541964 | Conventional | 2943505.20 | 1.938207 | ... | 0.155259 | 0.288250 | 0.000208 | 1.985447 | NaN | S8 | 2.0 | NaN | NaN | NaN |
| 11570 | 30469 | M9 | 0.074943 | 25.318623 | 0.035 | 133309.409983 | 25.418210 | Conventional | 840205.30 | 1.933172 | ... | 0.293718 | 0.328446 | 0.000189 | 2.288206 | NaN | S6 | 3.0 | NaN | NaN | NaN |
| 11571 | 30470 | M9 | 0.236737 | 27.009387 | 0.035 | -501857.330985 | 28.405008 | Conventional | 4641571.50 | 1.924374 | ... | 0.274879 | 0.294526 | 0.000207 | 2.107413 | NaN | S8 | 2.0 | NaN | NaN | NaN |
| 11572 | 30471 | M9 | 0.372848 | 24.728233 | 0.035 | -506018.886237 | 25.858627 | Conventional | 25309066.00 | 1.882437 | ... | 0.136419 | 0.171676 | 0.000202 | NaN | NaN | S8 | 2.0 | NaN | NaN | NaN |
11573 rows × 189 columns
Summary Statistics About Shots#
Let’s look at a summary of simple counts of different shot metadata.
fig, axes = plt.subplots(2, 2, figsize=(10, 5))
ax1, ax2, ax3, ax4 = axes.flatten()
sns.histplot(summary, y='heating', hue='campaign', multiple="stack", ax=ax1)
sns.histplot(summary, y='plasma_shape', hue='campaign', multiple="stack", ax=ax2)
sns.histplot(summary, y='current_range', hue='campaign', multiple="stack", ax=ax3)
sns.histplot(summary, y=summary.pellets.astype(str), hue='campaign', multiple="stack", ax=ax4)
for ax in axes.flatten():
ax.set_xlabel('No. Shots')
plt.tight_layout()
Plasma Beta (\(\beta\)) v.s Confinement Time (\(\tau_E\))#
This plot can show how the efficiency of energy confinement varies with plasma pressure.
plt.figure()
sns.scatterplot(summary, y='generic_max_energy_time', x='generic_max_beta_max_current', hue='heating')
plt.xlim(0, 18)
plt.ylim(0, 1)
plt.ylabel('Confinement time $\\tau_E$ (s)')
plt.xlabel('Plasma Beta $\\beta$ (%)')
plt.show()
Plasma Temperature (\(T_e\)) vs. Plasma Density (\(n_e\))#
This can reveal the relationship between temperature and density, which is critical for achieving the conditions necessary for fusion.
plt.figure()
sns.scatterplot(summary, y='thomson_temp_max_current', x='thomson_density_max_current', hue='current_range', alpha=0.8)
plt.xlim(0, .8e20)
plt.ylim(0, 1750)
plt.ylabel('Temperature $T_e$ (eV)')
plt.xlabel('Density $n_e$ ($m^{-3}$)')
plt.show()
Plasma Current (\(I_p\)) vs. Confinement Time (\(\tau_E\))#
This can indicate how the plasma current affects the confinement time, providing insights into stability and performance.
plt.figure()
sns.scatterplot(summary, y='plasma_time_avg_current', x='generic_max_energy_time', hue='current_range', alpha=0.8)
plt.xlim(0, 1)
plt.xlabel('Confinement Time $\\tau_E$ (s)')
plt.ylabel('Average Plasma Current $I_p$ (kA)')
plt.show()