Replace scipy.constants with own constants module.
This commit is contained in:
parent
87c2fd24fe
commit
1aac5de903
|
@ -1,7 +1,26 @@
|
|||
# unit conversions, mostly for standalone usage
|
||||
# TODO avoid importing the "heavy" qpms parts
|
||||
from scipy.constants import epsilon_0 as ε_0, c, pi as π, e as eV, hbar, hbar as ℏ, mu_0 as μ_0
|
||||
pi = π
|
||||
"""
|
||||
Constants and unit conversion, mostly for standalode usage.
|
||||
|
||||
Previously, QPMS used scipy.constants in the python parts.
|
||||
Now the relevant ones are set explicitly here in order
|
||||
to avoid dependency on the whole scipy (which needs a fortran
|
||||
compiler to build.
|
||||
|
||||
The values are taken from scipy / "2018 CODATA recommended values".
|
||||
They slightly differ from the constants in GSL that are used
|
||||
in the C code. It would be desirable to use the same source,
|
||||
hence the values here might be subject to change in future versions.
|
||||
"""
|
||||
|
||||
epsilon_0 = ε_0 = 8.8541878128e-12 # ± 0.0000000013e-12 F m^-1
|
||||
c = speed_of_light = 299792458.
|
||||
eV = e = elementary_charge = 1.602176487e-19 # ± 0000000040e-19 C
|
||||
hbar = ℏ = 1.054571800e-34 # ± 0.000000013e-34 J s
|
||||
mu_0 = μ_0 = 1.25663706212e-6 # ± 0.00000000019 e-6 N A^-2
|
||||
|
||||
from math import pi
|
||||
π = pi
|
||||
|
||||
μm = 1e-6
|
||||
nm = 1e-9
|
||||
# "SCUFF FREQUENCY UNIT"
|
||||
|
|
|
@ -9,7 +9,7 @@ cimport cython
|
|||
import enum
|
||||
import warnings
|
||||
import os
|
||||
from scipy.constants import e as eV, hbar, c
|
||||
from .constants import e as eV, hbar, c
|
||||
from libc.stdlib cimport malloc, free, calloc, abort
|
||||
|
||||
class EpsMuGeneratorType(enum.Enum):
|
||||
|
|
|
@ -6,7 +6,7 @@ import numpy as np
|
|||
from .qpms_c import *
|
||||
ň = np.newaxis
|
||||
import scipy
|
||||
from scipy.constants import epsilon_0 as ε_0, c, pi as π, e, hbar as ℏ, mu_0 as μ_0
|
||||
from .constants import ε_0, c, pi, π, e, ℏ, μ_0
|
||||
eV = e
|
||||
from scipy.special import lpmn, lpmv, spherical_jn, spherical_yn, poch, gammaln, factorial
|
||||
import math
|
||||
|
|
|
@ -12,8 +12,7 @@ except ImportError:
|
|||
use_moble_quaternion = False
|
||||
|
||||
import re
|
||||
from scipy import interpolate
|
||||
from scipy.constants import hbar, e as eV, pi, c
|
||||
from .constants import hbar, eV, pi, c
|
||||
from .cycommon import get_mn_y, get_nelem
|
||||
from .cyquaternions import CQuat
|
||||
ň = np.newaxis
|
||||
|
@ -440,6 +439,7 @@ class TMatrix(TMatrixSpec):
|
|||
TODO support for different/multiple interpolators
|
||||
'''
|
||||
def __init__(self, tmatrix_spec):
|
||||
from scipy import interpolate
|
||||
#self.specification = tmatrix_spec
|
||||
self.lMax_override = tmatrix_spec.lMax_override
|
||||
self.tmatrix_path = tmatrix_spec.tmatrix_path
|
||||
|
|
Loading…
Reference in New Issue