2 Constants and unit conversion, mostly for standalode usage.
4 Previously, QPMS used scipy.constants in the python parts.
5 Now the relevant ones are set explicitly here in order
6 to avoid dependency on the whole scipy (which needs a fortran
9 The values are taken from scipy / "2018 CODATA recommended values".
10 They slightly differ from the constants in GSL that are used
11 in the C code. It would be desirable to use the same source,
12 hence the values here might be subject to change in future versions.
15 epsilon_0
= ε_0
= 8.8541878128e-12 # ± 0.0000000013e-12 F m^-1
16 c
= speed_of_light
= 299792458.
17 eV
= e
= elementary_charge
= 1.602176487e-19 # ± 0000000040e-19 C
18 hbar
= ℏ
= 1.054571800e-34 # ± 0.000000013e-34 J s
19 mu_0
= μ_0
= 1.25663706212e-6 # ± 0.00000000019 e-6 N A^-2
26 # "SCUFF FREQUENCY UNIT"
30 #freqs = freqs_weirdunits * c / μm
32 def nm2eV(lambda_nm
, n
= 1):
33 return 2*π
*c
/(n
* lambda_nm
* nm
) / (eV
/ ℏ
)
35 def eV2nm(e_eV
, n
= 1):
36 return 2*π
*c
/(n
* e_eV
* (eV
/ℏ
)) / nm
40 Scuff frequency units to eV.
42 return e_SU
* SU
/ (eV
/ ℏ
)
45 return e_eV
* (eV
/ ℏ
) / SU
47 def SU2nm(e_SU
, n
= 1):
48 return 2*π
*c
/(n
* e_SU
* SU
) / nm
50 def nm2SU(lambda_nm
, n
= 1):
51 return 2*π
*c
/(n
* lambda_nm
* nm
) / SU