!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 | uuid | equi_max_li3 | ohmnic_max_heating | generic_max_energy_time | generic_min_q95_time | endpoint_url | generic_max_geo_major_radius_time | timestamp | shot_postshot_comment | ... | nbi_power_max_ss | nbi_energy_ss_max_power | nbi_max_ss_power_time | nbi_power_ss_max_current | nbi_power_truby_ss | scenario | rad_o2ratio | radii_c2ratio | shot_scenario | shot_flat_top_duration | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 11766 | 7da2590b-6b7c-5a4e-8125-8b0c38a7c8bf | 1.520526 | 1.038769 | 0.037496 | 0.270 | https://s3.echo.stfc.ac.uk | 0.080 | 2005-01-13 12:02:00 | GOOD PLASMA, RAN FINE. SL JOINT ALARMS RATHER ... | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN |
| 1 | 11767 | 594cabe7-8b0a-54a2-9e1e-8b250a858acd | 1.217211 | 1.105280 | 0.019210 | 0.245 | https://s3.echo.stfc.ac.uk | 0.080 | 2005-01-13 12:17:00 | OK BUT LOST VERTICAL CONTROL - FA2 JUST DIED A... | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN |
| 2 | 11768 | 23a8941d-e073-5073-8f5e-e53230f55b43 | 1.262946 | 0.849237 | 0.036312 | 0.150 | https://s3.echo.stfc.ac.uk | 0.080 | 2005-01-13 13:30:00 | OK. GOT FA4 BUT NOT FA3 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN |
| 3 | 11769 | e12564d4-f0af-5c8d-b15c-ab59f11144b3 | 1.519628 | 2.149353 | 0.057099 | 0.290 | https://s3.echo.stfc.ac.uk | 0.290 | 2005-01-13 13:44:00 | SLIDING JOINT ALARMS A BIT LOWER. PLASMA OK. | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN |
| 4 | 11771 | 1562346b-2097-5d27-8649-07eeb48dc5f7 | 1.788729 | 0.824824 | 0.052359 | 0.285 | https://s3.echo.stfc.ac.uk | 0.260 | 2005-01-13 14:33:00 | GOOD PLASMA F/B CONTROL. SLIDING JOINT ALARMS ... | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 11568 | 30467 | db7bc878-869c-59c6-bcc6-cb28cba69cf9 | 6.694992 | NaN | -1.000000 | 0.030 | https://s3.echo.stfc.ac.uk | 0.165 | 2013-09-27 14:03:00 | 'Two times lower DD neutron rate than referenc... | ... | 2.080261 | 70.840835 | 0.12160 | 2.180491 | NaN | 3.0 | NaN | NaN | S6 | NaN |
| 11569 | 30468 | 696b1a86-1986-59a4-8cd8-f968dba4ece4 | 8.221705 | NaN | -1.000000 | 0.030 | https://s3.echo.stfc.ac.uk | 0.155 | 2013-09-27 14:21:00 | 'Good beam.Good repeat.' | ... | 2.083544 | 70.921546 | 0.13065 | 1.985447 | NaN | 2.0 | NaN | NaN | S8 | NaN |
| 11570 | 30469 | dcc5091c-ba43-599e-9c63-f8cb41494a60 | 2.542882 | NaN | -1.000000 | 0.195 | https://s3.echo.stfc.ac.uk | 0.170 | 2013-09-27 14:39:00 | 'Good shot. Modes present.' | ... | 2.163367 | 75.050461 | 0.19560 | 2.288206 | NaN | 3.0 | NaN | NaN | S6 | NaN |
| 11571 | 30470 | 63ccd361-c339-5403-abf3-dec0ad9d4811 | 11.771064 | 10.391692 | 0.008542 | 0.035 | https://s3.echo.stfc.ac.uk | 0.170 | 2013-09-27 15:03:00 | 'No HF gas.' | ... | 2.204641 | 75.045603 | 0.18445 | 2.107413 | NaN | 2.0 | NaN | NaN | S8 | NaN |
| 11572 | 30471 | 0916ffb1-fece-5d3d-81a9-b0504f49929f | 59.918600 | 73.787904 | 0.021805 | 0.035 | https://s3.echo.stfc.ac.uk | 0.125 | 2013-09-27 15:20:00 | 'Good shot.' | ... | 2.062899 | 71.177179 | 0.12170 | NaN | NaN | 2.0 | NaN | NaN | S8 | 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()