!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://s3.echo.stfc.ac.uk/mast/fairmast-meta/l2_shots.parquet')
summary
| shot_id | facility | equi_li2_max_current | shot_summary | type_ | equi_max_li2 | generic_min_radius_max_plasma | title | shot_experiment_number | generic_max_poloidal_area | ... | nbi_total_injected_energy_ss | nbi_injected_energy_ss_ruby_time | nbi_power_max_ss | nbi_power_truby_ss | nbi_power_ss_max_current | shot_scenario | scenario | rad_o2ratio | radii_c2ratio | shot_flat_top_duration | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 11766 | MAST | 0.902606 | COMMISSIONED ENGINEERING PLASMA WITH MOST PLAN... | dcat:Dataset | 1.890299 | 0.080 | Shot Dataset | 11766 | 1.824400 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 1 | 11767 | MAST | 0.897837 | COMMISSIONED ENGINEERING PLASMA WITH MOST PLAN... | dcat:Dataset | 1.444762 | 0.080 | Shot Dataset | 11767 | 1.846246 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 2 | 11768 | MAST | 0.901121 | COMMISSIONED ENGINEERING PLASMA WITH MOST PLAN... | dcat:Dataset | 1.603340 | 0.080 | Shot Dataset | 11768 | 1.842971 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 3 | 11769 | MAST | 0.798088 | COMMISSIONED ENGINEERING PLASMA WITH MOST PLAN... | dcat:Dataset | 1.902339 | 0.070 | Shot Dataset | 11769 | 1.899469 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 4 | 11771 | MAST | 0.809877 | COMMISSIONED ENGINEERING PLASMA WITH MOST PLAN... | dcat:Dataset | 2.214325 | 0.070 | Shot Dataset | 11771 | 1.903582 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 11568 | 30467 | MAST | 0.807955 | 'Data from neutron camera and magnetics obtain... | dcat:Dataset | 6.996288 | 0.110 | Shot Dataset | 30467 | 1.972266 | ... | 0.340425 | 0.000195 | 2.080261 | NaN | 2.180491 | S6 | 3.0 | NaN | NaN | NaN |
| 11569 | 30468 | MAST | 0.799021 | 'Data from neutron camera and magnetics obtain... | dcat:Dataset | 8.578611 | 0.155 | Shot Dataset | 30468 | 1.973768 | ... | 0.288250 | 0.000208 | 2.083544 | NaN | 1.985447 | S8 | 2.0 | NaN | NaN | NaN |
| 11570 | 30469 | MAST | 0.814006 | 'Data from neutron camera and magnetics obtain... | dcat:Dataset | 2.681262 | 0.140 | Shot Dataset | 30469 | 1.943575 | ... | 0.328446 | 0.000189 | 2.163367 | NaN | 2.288206 | S6 | 3.0 | NaN | NaN | NaN |
| 11571 | 30470 | MAST | 0.802867 | 'Data from neutron camera and magnetics obtain... | dcat:Dataset | 12.264058 | 0.135 | Shot Dataset | 30470 | 1.972500 | ... | 0.294526 | 0.000207 | 2.204641 | NaN | 2.107413 | S8 | 2.0 | NaN | NaN | NaN |
| 11572 | 30471 | MAST | 0.963086 | 'Data from neutron camera and magnetics obtain... | dcat:Dataset | 62.251090 | 0.135 | Shot Dataset | 30471 | 1.965805 | ... | 0.171676 | 0.000202 | 2.062899 | 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()