-
Notifications
You must be signed in to change notification settings - Fork 1
/
XUV_refractive_index.py
266 lines (218 loc) · 8.72 KB
/
XUV_refractive_index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
"""
This module creates the interpolation functions from tabulated scattering factors
(in the XUV range) for noble gases stored in the external 'XUV_refractive_index_tables.h5'
h5-file (the available tables are Henke: https://henke.lbl.gov/optical_constants/asf.html
and NIST: https://physics.nist.gov/PhysRefData/FFast/html/form.html). These functions are:
getf, getf1, getf2
Next, there are other functions to access directly polarisabilities, susceptibilities,
absorption lengths, ... (see their descriptions).
The functions are:
dispersion_function, beta_factor_ref, L_abs, susc_ref, polarisability
The module also provides the reference particle density 'N_ref_default' for
p = 1 bar & T = 20 °C
Note: The reference particle density is given by the ideal-gas law. Assuming this law,
it is directly scalable to any pressure p temperature T by p[bar]*((273.15+20)/T[Kelvin])
-------
Jan Vabek
ELI-Beamlines, CELIA, CTU in Prague (FNSPE) (2021 - 2022)
ELI ERIC (2023)
"""
import numpy as np
from scipy import interpolate
import h5py
import os
import units
import mynumerics as mn
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
# Load tabulated scattering factors stored in 'XUV_refractive_index_tables.h5'
# and create interpolating functions from them.
source_archive = os.path.join(THIS_DIR, 'XUV_refractive_index_tables.h5')
index_funct = {}
with h5py.File(source_archive, 'r') as SourceFile: # access option http://docs.h5py.org/en/stable/high/file.html#file
gases = list(SourceFile.keys())
index_table = {}
print(gases)
for gas in gases:
local_table = {
'Energy_f1': SourceFile[gas]['Energy_f1'][:],
'Energy_f2': SourceFile[gas]['Energy_f2'][:],
'f1': SourceFile[gas]['f1'][:],
'f2': SourceFile[gas]['f2'][:]
}
index_table.update({gas: local_table})
local_table = {
'f1': interpolate.interp1d(SourceFile[gas]['Energy_f1'][:], SourceFile[gas]['f1'][:]),
'f2': interpolate.interp1d(SourceFile[gas]['Energy_f2'][:], SourceFile[gas]['f2'][:])
}
index_funct.update({gas: local_table})
## FUNCTIONS PROVIDING THE SCATTERING FACTORS
def getf(g,E):
"""
Returns tabulated scattering factors for a given XUV photon.
Parameters
----------
g : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
E : scalar
the energy of the incident photon [eV]
Returns
-------
(f1, f2): the values of the scattering factors
"""
return index_funct[g]['f1'](E)[()], index_funct[g]['f2'](E)[()]
def getf1(g,E):
"""
Returns tabulated scattering factor 'f1' for a given XUV photon.
Parameters
----------
g : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
E : scalar
the energy of the incident photon [eV]
Returns
-------
f1: The scattering factor
"""
return index_funct[g]['f1'](E)[()]
def getf2(g,E):
"""
Returns tabulated scattering factor 'f2' for a given XUV photon.
Parameters
----------
g : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
E : scalar
the energy of the incident photon [eV]
Returns
-------
f1: The scattering factor
"""
return index_funct[g]['f2'](E)[()]
## VARIOUS FUNCTIONS TO PROVIDE DIRECTLY POLARISABILITIES, SUSCEPTIBILITIES, ...
N_ref_default = 1e5/(units.Boltzmann_constant*(273.15+20.)) # reference gas number density (p = 1 bar & T = 20 °C)
def dispersion_function(omega, pressure, gas, n_IR=1., N_ref=N_ref_default):
"""
Returns the part of the dephasing caused by the different phase velocities
of the IR and XUV fields. The output quantity is
(1/phase_velocity_IR) - (1/phase_velocity_XUV)
phase_velocity_XUV is computed from tabulated scattering factors
phase_velocity_IR = c_light/n_IR.
Possbile usage in linear medium (after the distance 'z') is
phase = omega*z*dispersion_function
Parameters
----------
omega : scalar
The frequency of the incident field [rad/s]
pressure : pressure [bar]
gas : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
n_IR : scalar, optional
The refractive index in the IR range. The default is 1 (i.e. vacuum progation).
N_ref : scalar, optional
gas number density for (see the module description).
The default is N_ref_default.
Returns
-------
(1/phase_velocity_IR) - (1/phase_velocity_XUV)
"""
f1_value = getf1(gas,mn.ConvertPhoton(omega, 'omegaSI', 'eV'))
lambdaSI = mn.ConvertPhoton(omega, 'omegaSI', 'lambdaSI')
nXUV = 1.0 - pressure*N_ref*units.r_electron_classical * ((lambdaSI**2)*f1_value/(2.0*np.pi))
phase_velocity_XUV = units.c_light / nXUV
phase_velocity_IR = units.c_light / n_IR
return ((1./phase_velocity_IR) - (1./phase_velocity_XUV))
def beta_factor_ref(omega, gas, N_ref=N_ref_default):
"""
It returns the imaginary poart 'beta' of the refractive index
n = n0 + 1j*beta
using tabulated scattering factors
Parameters
----------
omega : scalar
The frequency of the incident field [rad/s]
gas : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
N_ref : scalar, optional
gas number particle density
The default is N_ref_default (p = 1 bar & T = 20 °C)
Returns
-------
beta_factor : scalar
Notes
-------
See Chapter 3.1, Eqs. (3.12) and (3.13) of 'D. Attwood; SOFT X-RAYS AND
EXTREME ULTRAVIOLET RADIATION, Cambridge University Press, 1st Edition (2000)'
"""
f2_value = getf2(gas,mn.ConvertPhoton(omega, 'omegaSI', 'eV'))
lambdaXUV = mn.ConvertPhoton(omega, 'omegaSI', 'lambdaSI')
beta_factor = N_ref*units.r_electron_classical * \
((lambdaXUV**2)*f2_value/(2.0*np.pi))
return beta_factor
def L_abs(omega, pressure, gas, N_ref=N_ref_default):
"""
Returns absorption length in XUV range.
Parameters
----------
omega : scalar
The frequency of the incident field [rad/s]
pressure : pressure [bar]
gas : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
N_ref : scalar, optional
gas number particle density
The default is N_ref_default (p = 1 bar & T = 20 °C)
Returns
-------
L_abs [m]
"""
f2_value = getf2(gas,mn.ConvertPhoton(omega, 'omegaSI', 'eV'))
lambdaXUV = mn.ConvertPhoton(omega, 'omegaSI', 'lambdaSI')
return 1.0 / (2.0 * pressure * N_ref * units.r_electron_classical * lambdaXUV * f2_value)
def susc_ref(omega, gas, N_ref=N_ref_default):
"""
Returns susceptibility for p = 1 bar & T = 20 °C.
Parameters
----------
omega : scalar
The frequency of the incident field [rad/s]
gas : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
N_ref : scalar, optional
gas number particle density
The default is N_ref_default (p = 1 bar & T = 20 °C)
Returns
-------
susceptibility
"""
f1 = getf1(gas,mn.ConvertPhoton(omega, 'omegaSI', 'eV'))
nXUV_ref = 1.0 - N_ref*units.r_electron_classical*(mn.ConvertPhoton(omega,'omegaSI','lambdaSI')**2)*f1/(2.0*np.pi)
return nXUV_ref**2 - 1
def polarisability(omega, gas, N_ref=N_ref_default):
"""
Returns polarisability.
Parameters
----------
omega : scalar
The frequency of the incident field [rad/s]
gas : string
The specifier of gas and used tables, it has the form {'He', 'Ne', 'Ar',
'Kr', 'Xe'}+'_'+{'NIST','Henke'}. For example gas='Ar_NIST'.
N_ref : scalar, optional
gas number density for atmospheric pressure (see the module description).
The default is N_ref_default.
Returns
-------
polarisability
"""
f1 = getf1(gas,mn.ConvertPhoton(omega, 'omegaSI', 'eV'))
nXUV_ref = 1.0 - N_ref*units.r_electron_classical*(mn.ConvertPhoton(omega,'omegaSI','lambdaSI')**2)*f1/(2.0*np.pi)
susc_XUV_ref = nXUV_ref**2 - 1
pol_XUV = susc_XUV_ref/N_ref
return pol_XUV