Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0937b11
[#2026_RSI] Created
dvezinet Jun 12, 2026
298cd74
[#2026_RSI] restructured
dvezinet Jun 12, 2026
b5a09b7
[#001] Renamed for variablename validity
dvezinet Jun 12, 2026
41dc151
[#001] Added all figures
dvezinet Jun 12, 2026
8fc01a6
[#001] Minor debug
dvezinet Jun 12, 2026
e7c1441
[#001] All but inputs
dvezinet Jun 22, 2026
03a5df8
[#001] Add inputs
dvezinet Jun 22, 2026
4fa8e68
[#001] Renamed fig*.py
dvezinet Jun 22, 2026
1be70e5
[#001] Almost done fig03_tokamak
dvezinet Jun 22, 2026
338ba7b
[#001] removed tfs
Didou09 Jun 23, 2026
b7d9031
[#001] fig03 done
dvezinet Jun 23, 2026
8b784b8
[#001] cleanup figures
dvezinet Jun 23, 2026
20c0612
[#001] fig03() done
dvezinet Jun 23, 2026
82632d0
[#001] Better fig04_Bremsstrahlung
dvezinet Jun 24, 2026
b0f2d48
[#001] git LFS track SCRAM data
dvezinet Jun 24, 2026
a5e3b43
[#001] Better fig04
dvezinet Jun 24, 2026
950aded
[#001] Added Conor's plot routine
dvezinet Jun 24, 2026
81ed816
[#001] Advanced fig04
dvezinet Jun 25, 2026
9831fb5
[#001] Adding H and He data
dvezinet Jun 25, 2026
d2ec31c
[#001] new fig03 and fig04
Didou09 Jun 25, 2026
5e239f1
[#001] fig04 has 2 different Ekin_max_eV
Didou09 Jun 25, 2026
a5e8246
[#001] Fig02_dist now has 2 different Ekin_max_eV
Didou09 Jun 25, 2026
35b26ec
[#001] Renamed figures according to paper
Didou09 Jun 25, 2026
62b5abc
[001] Finished renaming
Didou09 Jun 25, 2026
35ac823
[#001] Created fig03_validate_ff
Didou09 Jun 25, 2026
083379c
[#001] fig03_validate_ff ongoing
Didou09 Jun 26, 2026
b57ea51
[#001] Clean up
Didou09 Jun 26, 2026
578d999
[#fixed]
Didou09 Jun 26, 2026
553a193
[#001] Better fig03_validate_ff
Didou09 Jun 26, 2026
5b3ec06
[#001] Almost final fig03_validate_ff => doublcheck d2cross_phi compu…
Didou09 Jun 26, 2026
ad25041
[#001] Centralized figure saving
Didou09 Jun 26, 2026
6b3267b
[#001] Fixed savefig
Didou09 Jun 26, 2026
f63cfb8
[#001] Fixed savefig 2
Didou09 Jun 26, 2026
b41f632
[#001] Removed all figures
Didou09 Jun 26, 2026
3514160
[#001] new figures
Didou09 Jun 26, 2026
89a6c9f
[#001] Added fig05_emiss
Didou09 Jun 26, 2026
6ef1af6
[#001] Fixed naming
Didou09 Jun 26, 2026
679fd21
[#001] Restructured to centralize spectra loading
Didou09 Jun 26, 2026
51e1238
[#001] Better doc for _load_spect.py
Didou09 Jun 26, 2026
73c76c4
[#001] Better fig03
Didou09 Jun 26, 2026
2ccd41e
[#001] Structure of fig05
Didou09 Jun 26, 2026
32ce55e
[#001] Created _load_spect_anis.py
Didou09 Jun 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/d2cross_Ee0100eV-10MeV-80log_Eph100eV-10MeV-81log_ntheta61_EH.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/d2cross_Ee01eV-100MeV-80log_Eph1eV-100MeV-81log_ntheta61_EH.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/d2cross_phi_Ee01eV-100MeV-80log_Eph1eV-100MeV-81log_nthetaph61_nthetae060_EH.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/responsivities.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/d2cross_phi_Ee01eV-100MeV-240log_Eph1eV-100MeV-241log_nthetaph61_nthetae060_EH.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260616_SCRAM86_Ar_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260616_SCRAM86_Fe_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260616_SCRAM86_Kr_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260616_SCRAM86_O_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260616_SCRAM86_W_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260625_FLYCHK_H_data.npz filter=lfs diff=lfs merge=lfs -text
articles/RSI_2026_RunawayBremsstrahlungDetection/inputs/260625_FLYCHK_He_data.npz filter=lfs diff=lfs merge=lfs -text
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
figures/fig01_cross.png filter=lfs diff=lfs merge=lfs -text
figures/fig02_dist.png filter=lfs diff=lfs merge=lfs -text
figures/fig04_bremsstrahlung.png filter=lfs diff=lfs merge=lfs -text
figures/fig05_tokamak.png filter=lfs diff=lfs merge=lfs -text
figures/fig06_responsivities.png filter=lfs diff=lfs merge=lfs -text
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .code import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ._main import main
from ._load_spect import main as load_spect
from ._fig01_cross import main as fig01_cross
from ._fig02_dist import main as fig02_dist
from ._fig03_validate_ff import main as fig03_validate_ff
from ._fig04_bremsstrahlung import main as fig04_bremsstrahlung
from ._fig05_emiss import main as fig05_emiss
from ._fig06_tokamak import main as fig06_tokamak
from ._fig07_responsivities import main as fig07_responsivities
295 changes: 295 additions & 0 deletions articles/RSI_2026_RunawayBremsstrahlungDetection/code/_fig01_cross.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@


import os


import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import tofu as tf


from ._savefig import main as savefig


tfphysemis = tf.physics_tools.electrons.emission


# #####################################################
# #####################################################
# DEFAULTS
# #####################################################


_PATH_HERE = os.path.dirname(__file__)
_PATH_PAPER = os.path.dirname(_PATH_HERE)


_DPFE_DCROSS = {
'EH0': os.path.join(
_PATH_PAPER,
'inputs',
'd2cross_Ee01eV-100MeV-80log_Eph1eV-100MeV-81log_ntheta61_EH.npz',
),
'EH1': os.path.join(
_PATH_PAPER,
'inputs',
'd2cross_Ee0100eV-10MeV-80log_Eph100eV-10MeV-81log_ntheta61_EH.npz',
),
'BHE': os.path.join(
_PATH_PAPER,
'inputs',
'd2cross_Ee01eV-100MeV-400log_Eph1eV-100MeV-401log_ntheta181_BHE.npz',
),
}


# #####################################################
# #####################################################
# Fig 1 - cross-section
# #####################################################


def main(
figsize=(15, 7),
pfe_cross='EH0',
version='EH',
Eph_eV=np.r_[1e3, 10e3, 500e3],
Ee0_eV=np.r_[20e3, 1e6],
fontsize=14,
# save
path_save=None,
pfe_save=None,
# unused
**kwdargs,
):
""" Plot EH cross-section over a wide range of Eph and Ee0

Add 4 hand-picked cases vs angle of emission theta_ph

"""

# --------------
# load
# --------------

pfe = _DPFE_DCROSS[pfe_cross]

dout = {
kk: vv.tolist()
for kk, vv in dict(np.load(pfe, allow_pickle=True)).items()
}
units = dout['cross'][version]['units']
Z = dout.get('Z', {'data': 1})['data']

# --------------
# prepare axes
# --------------

dmargin = {
'left': 0.06, 'right': 0.99,
'bottom': 0.08, 'top': 0.93,
'wspace': 0.25, 'hspace': 0.10,
}

fig = plt.figure(figsize=figsize)

gs = gridspec.GridSpec(ncols=4, nrows=2, **dmargin)
dax = {}

# --------------
# prepare axes
# --------------

# --------------
# ax - isolines

ax = fig.add_subplot(
gs[:, -2:],
xscale='log',
yscale='log',
aspect='equal',
)
ax.set_xlabel(
r"$E_{e,0}$ (keV)",
size=fontsize,
fontweight='bold',
)
ax.set_ylabel(
r"$E_{ph}$ (keV)",
size=fontsize,
fontweight='bold',
)
ax.set_title(
r"$d^2\sigma(E_{e0}, E_{ph}, \theta_{ph}, Z)$"
+ f"\n Z = {Z} - version = {version}",
size=fontsize,
fontweight='bold',
)

# store
dax['map'] = {'handle': ax, 'type': 'isolines'}

# --------------
# ax - theta_norm

# theta_norm0
ax = fig.add_subplot(
gs[0, 0],
xscale='linear',
)
ax.set_ylabel(
"normalized cross-section (adim.)",
size=fontsize,
fontweight='bold',
)
ax.set_title(
r"$E_{e0}$" + f" = {Ee0_eV[0]*1e-3:2.0f} keV",
size=fontsize,
fontweight='bold',
)

# store
dax['theta_norm0'] = {'handle': ax, 'type': 'isolines'}

# theta_norm1
ax = fig.add_subplot(
gs[0, 1],
sharex=dax['theta_norm0']['handle'],
sharey=dax['theta_norm0']['handle'],
)
ax.set_title(
r"$E_{e0}$" + f" = {Ee0_eV[1]*1e-6:2.0f} MeV",
size=fontsize,
fontweight='bold',
)

# store
dax['theta_norm1'] = {'handle': ax, 'type': 'isolines'}

# --------------
# ax - theta_abs

# theta_abs0
ax = fig.add_subplot(
gs[1, 0],
sharex=dax['theta_norm0']['handle'],
)
ax.set_xlabel(
r"$\theta_{ph}$ (deg)",
size=fontsize,
fontweight='bold',
)
ax.set_ylabel(
r"$d\sigma$" + f"({units})",
size=fontsize,
fontweight='bold',
)

# store
dax['theta_abs0'] = {'handle': ax, 'type': 'isolines'}

# theta_abs1
ax = fig.add_subplot(
gs[1, 1],
sharex=dax['theta_norm0']['handle'],
sharey=dax['theta_abs0']['handle'],
)
ax.set_xlabel(
r"$\theta_{ph}$ (deg)",
size=fontsize,
fontweight='bold',
)

# store
dax['theta_abs1'] = {'handle': ax, 'type': 'isolines'}

# ------------------
# call built-in
# ------------------

# cases 100 keV
lc = ['r', 'g', 'b']
for i0, e0 in enumerate(Ee0_eV):
iphok = Eph_eV < e0
dcases = {
i1: {
'E_e0_eV': e0,
'E_ph_eV': eph,
'color': lc[i1],
'label': f"Eph = {eph*1e-3:3.0f} keV",
}
for i1, eph in enumerate(Eph_eV[iphok])
}
_dax, _d2cross = tfphysemis.plot_xray_thin_d2cross_ei_anisotropy(
d2cross=pfe,
dcases=dcases,
dax={
'map': dax['map']['handle'],
'theta_norm': dax[f'theta_norm{i0}']['handle'],
'theta_abs': dax[f'theta_abs{i0}']['handle'],
},
)

# remove contour plots
if i0 == 0:
for cc in dax['map']['handle'].get_children():
if cc.__class__.__name__ == 'QuadContourSet':
cc.remove()

# remove legend
dax['theta_norm0']['handle'].get_legend().remove()

# ---------------------
# Adjust map x/y scales
# ---------------------

dax['map']['handle'].set_xlim(0.1, 10e3)
dax['map']['handle'].set_ylim(0.1, 10e3)
dax['theta_abs1']['handle'].set_ylabel('')
dax['theta_norm1']['handle'].legend(loc='lower right')

# --------------
# add a, b, c, d, e
# --------------

dabc = {
'theta_norm0': '(a)',
'theta_norm1': '(c)',
'theta_abs0': '(b)',
'theta_abs1': '(d)',
}
for kax, abc in dabc.items():
dax[kax]['handle'].grid(visible=True, which='major', axis='both')
dax[kax]['handle'].text(
0.95, 0.95,
abc,
fontsize=fontsize,
fontweight='bold',
horizontalalignment='right',
verticalalignment='top',
transform=dax[kax]['handle'].transAxes,
)

dax['map']['handle'].text(
0., 1.02,
"(e)",
fontsize=fontsize,
fontweight='bold',
horizontalalignment='left',
verticalalignment='bottom',
transform=dax['map']['handle'].transAxes,
)

# --------------
# save
# --------------

savefig(
fig=fig,
pfe_save=pfe_save,
path_save=path_save,
file=__file__,
)

return dax
Loading