Python scipy.constants.physical_constants() Examples
The following are 9
code examples of scipy.constants.physical_constants().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
scipy.constants
, or try the search function
.
Example #1
Source File: rystare.py From pyradi with MIT License | 6 votes |
def darkcurrentnoise(inttime, detarea,temptr, Egap, DFM=0.5e-5): """Calculate the dark current noise given detector parameters Args: | inttime (scalar): integration time in seconds | detarea (scalar): detector area in m2 | temptr (scalar): temperature in K | Egap (scalar): bandgap in eV | DFM (scalar): in units of nA/m2 Returns: | n (scalar): dark current noise as number of electrons Raises: | No exception is raised. """ keV = const.physical_constants['Boltzmann constant in eV/K'][0] ndarkcur = inttime * 2.55e15 * detarea * DFM * (temptr ** 1.5) * np.exp(-Egap/(2 * keV * temptr) ) return np.sqrt(ndarkcur) ############################################################ ##
Example #2
Source File: calculations_atom_single.py From ARC-Alkali-Rydberg-Calculator with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _eFieldCouplingDivE(self, n1, l1, j1, mj1, n2, l2, j2, mj2, s=0.5): # eFied coupling devided with E (witout actuall multiplication to getE) # delta(mj1,mj2') delta(l1,l2+-1) if ((abs(mj1 - mj2) > 0.1) or (abs(l1 - l2) != 1)): return 0 # matrix element result = self.atom.getRadialMatrixElement(n1, l1, j1, n2, l2, j2, s=s) *\ physical_constants["Bohr radius"][0] * C_e sumPart = self.eFieldCouplingSaved.getAngular(l1, j1, mj1, l2, j2, mj2, s=s) return result * sumPart
Example #3
Source File: chemical.py From thermo with MIT License | 5 votes |
def absolute_permittivity(self): r'''Absolute permittivity of the chemical at its current temperature, in units of [farad/meter]. Those units are equivalent to ampere^2*second^4/kg/m^3. Examples -------- >>> Chemical('water', T=293.15).absolute_permittivity 7.096684821859018e-10 ''' permittivity = self.permittivity if permittivity is not None: return permittivity*physical_constants['electric constant'][0] return None
Example #4
Source File: models.py From xrayutilities with GNU General Public License v2.0 | 5 votes |
def _prepare_kincalculation(self, qz, hkl): """ prepare kinematic calculation by calculating some helper values """ rel = constants.physical_constants['classical electron radius'][0] rel *= 1e10 k = self.exp.k0 # determine q-inplane t = self.exp._transform ql0 = t(self.lstack[0].material.Q(*hkl)) qinp = numpy.sqrt(ql0[0]**2 + ql0[1]**2) # calculate needed angles qv = numpy.asarray([t.inverse((ql0[0], ql0[1], q)) for q in qz]) Q = numpy.linalg.norm(qv, axis=1) theta = numpy.arcsin(Q / (2 * k)) domega = numpy.arctan2(qinp, qz) alphai, alphaf = (theta + domega, theta - domega) # calculate structure factors f = numpy.empty((len(self.lstack), len(qz)), dtype=numpy.complex) fhkl = numpy.empty(len(self.lstack), dtype=numpy.complex) for i, l in enumerate(self.lstack): m = l.material fhkl[i] = m.StructureFactor(m.Q(*hkl), en=self.energy) /\ m.lattice.UnitCellVolume() f[i, :] = m.StructureFactorForQ(qv, en0=self.energy) /\ m.lattice.UnitCellVolume() E = numpy.zeros(len(qz), dtype=numpy.complex) return rel, alphai, alphaf, f, fhkl, E, t
Example #5
Source File: rystare.py From pyradi with MIT License | 5 votes |
def set_photosensor_constants(strh5, initialise=True): r"""Defining the constants that are necessary for calculation of photon energy, dark current rate, etc. Args: | strh5 (hdf5 file): hdf5 file that defines all simulation parameters Returns: | in strh5: (hdf5 file) updated data fields Raises: | No exception is raised. Author: Mikhail V. Konnik, revised/ported by CJ Willers Original source: http://arxiv.org/pdf/1412.4031.pdf """ #Sensor material constants if (initialise): strh5['rystare/material/Eg-eV'] = 0. #bandgap still to be computed at at temperature # band gap energy, [eV], Varshni equation strh5['rystare/material/Eg-eV'][...] = strh5['rystare/photondetector/varshni/Egap0'][()] - \ (strh5['rystare/photondetector/varshni/varA'][()] * (strh5['rystare/photondetector/operatingtemperature'][()] ** 2)) /\ (strh5['rystare/photondetector/varshni/varB'][()] + strh5['rystare/photondetector/operatingtemperature'][()]) if (initialise): # do this always strh5['rystare/photondetector/darkcurrent/fixedPatternNoise/limitnegative'] = True # only used with 'Janesick-Gaussian' #Fundamental constants strh5['rystare/constants/Boltzman-Constant-eV'] = const.physical_constants['Boltzmann constant in eV/K'][0] #Boltzman constant, [eV/K]. strh5['rystare/constants/Boltzman-Constant-JK'] = const.physical_constants['Boltzmann constant'][0] #Boltzman constant, [J/K]. strh5['rystare/constants/q'] = const.e # charge of an electron [C], coulomb return strh5 ######################################################################################
Example #6
Source File: alkali_atom_functions.py From ARC-Alkali-Rydberg-Calculator with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getRabiFrequency2(self, n1, l1, j1, mj1, n2, l2, j2, q, electricFieldAmplitude, s=0.5): """ Returns a Rabi frequency for resonant excitation with a given electric field amplitude Args: n1,l1,j1,mj1 : state from which we are driving transition n2,l2,j2 : state to which we are driving transition q : laser polarization (-1,0,1 correspond to :math:`\\sigma^-`, :math:`\\pi` and :math:`\\sigma^+` respectively) electricFieldAmplitude : amplitude of electric field driving (V/m) s (float): optional, total spin angular momentum of state. By default 0.5 for Alkali atoms. Returns: float: Frequency in rad :math:`^{-1}`. If you want frequency in Hz, divide by returned value by :math:`2\\pi` """ mj2 = mj1 + q if abs(mj2) - 0.1 > j2: return 0 dipole = self.getDipoleMatrixElement(n1, l1, j1, mj1, n2, l2, j2, mj2, q, s=s) *\ C_e * physical_constants["Bohr radius"][0] freq = electricFieldAmplitude * abs(dipole) / hbar return freq
Example #7
Source File: alkali_atom_functions.py From ARC-Alkali-Rydberg-Calculator with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getC3term(self, n, l, j, n1, l1, j1, n2, l2, j2, s=0.5): """ C3 interaction term for the given two pair-states Calculates :math:`C_3` intaraction term for :math:`|n,l,j,n,l,j\\rangle \ \\leftrightarrow |n_1,l_1,j_1,n_2,l_2,j_2\\rangle` Args: n (int): principal quantum number l (int): orbital angular momenutum j (float): total angular momentum n1 (int): principal quantum number l1 (int): orbital angular momentum j1 (float): total angular momentum n2 (int): principal quantum number l2 (int): orbital angular momentum j2 (float): total angular momentum s (float): optional, total spin angular momentum of state. By default 0.5 for Alkali atoms. Returns: float: :math:`C_3 = \\frac{\\langle n,l,j |er\ |n_1,l_1,j_1\\rangle \ \\langle n,l,j |er|n_2,l_2,j_2\\rangle}{4\\pi\\varepsilon_0}` (:math:`h` Hz m :math:`{}^3`). """ d1 = self.getRadialMatrixElement(n, l, j, n1, l1, j1, s=s) d2 = self.getRadialMatrixElement(n, l, j, n2, l2, j2, s=s) d1d2 = 1 / (4.0 * pi * epsilon_0) * d1 * d2 * C_e**2 *\ (physical_constants["Bohr radius"][0])**2 return d1d2
Example #8
Source File: alkali_atom_functions.py From ARC-Alkali-Rydberg-Calculator with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getZeemanEnergyShift(self, l, j, mj, magneticFieldBz, s=0.5): r""" Retuns linear (paramagnetic) Zeeman shift. :math:`\mathcal{H}_P=\frac{\mu_B B_z}{\hbar}(\hat{L}_{\rm z}+\ g_{\rm S}S_{\rm z})` Args: l (int): orbital angular momentum j (float): total angular momentum mj (float): projection of total angular momentum alon z-axis magneticFieldBz (float): applied magnetic field (alon z-axis only) in units of T (Tesla) s (float): optional, total spin angular momentum of state. By default 0.5 for Alkali atoms. Returns: float: energy offset of the state (in J) """ prefactor = physical_constants["Bohr magneton"][0] * magneticFieldBz gs = - physical_constants["electron g factor"][0] sumOverMl = 0 for ml in np.linspace(mj - s, mj + s, round(2 * s + 1)): if abs(ml) <= l + 0.1: ms = mj - ml sumOverMl += (ml + gs * ms) * \ abs(CG(l, ml, s, ms, j, mj))**2 return prefactor * sumOverMl
Example #9
Source File: alkali_atom_functions.py From ARC-Alkali-Rydberg-Calculator with BSD 3-Clause "New" or "Revised" License | 4 votes |
def _atomLightAtomCoupling(n, l, j, nn, ll, jj, n1, l1, j1, n2, l2, j2, atom1, atom2=None, s=0.5, s2=None): """ Calculates radial part of atom-light coupling This function might seem redundant, since similar function exist for each of the atoms. Function that is not connected to specific atomic species is provided in order to provides route to implement inter-species coupling. """ if atom2 is None: # if not explicitly inter-species, assume it's the same species atom2 = atom1 if s2 is None: s2 = s # determine coupling dl = abs(l - l1) dj = abs(j - j1) c1 = 0 if dl == 1 and (dj < 1.1): c1 = 1 # dipole couplings1 elif (dl == 0 or dl == 2 or dl == 1) and(dj < 2.1): c1 = 2 # quadrupole coupling else: return False dl = abs(ll - l2) dj = abs(jj - j2) c2 = 0 if dl == 1 and (dj < 1.1): c2 = 1 # dipole coupling elif (dl == 0 or dl == 2 or dl == 1) and(dj < 2.1): c2 = 2 # quadrupole coupling else: return False radial1 = atom1.getRadialCoupling(n, l, j, n1, l1, j1, s=s) radial2 = atom2.getRadialCoupling(nn, ll, jj, n2, l2, j2, s=s2) # TO-DO: check exponent of the Boht radius (from where it comes?!) coupling = C_e**2 / (4.0 * pi * epsilon_0) * radial1 * radial2 *\ (physical_constants["Bohr radius"][0])**(c1 + c2) return coupling # ================== Saving and loading calculations (START) ==================