Pack of physical constants.
Project description
This module provides physical constants in uniform format.
[C], electron charge.
q_e = 1.60217662e-19
[J * s], Planks constant.
h = 6.62e-34
[m / s], speed of light.
c = 299792458
[kg], electron mass.
m_e = 9.10938356e-31
[m], electron radius
r_o = 2.8179403267e-15
[K], room temperature
t_room = 273 + 23
[J / K], Boltzmann constant
k_b = 1.38064852e-23
Converts pressure from [Torr] to [Pa]
def torr_to_pa(torr): return torr * 7.5006 * 1e-3
Converts temperature from [deg C] to [deg K]
def cels_to_kelv(cels: float) -> float: return cels + 273.15
floating point infinity
inf = float('inf')
linear interpolation
def interpolate(x_prev: float, x_tgt: float, x_next: float, y_prev: float, y_next: float) -> float:
return y_prev + (y_next - y_prev) * (x_tgt - x_prev) / (x_next - x_prev)
radians to degrees converter
def rad_to_deg(deg: float) -> float:
return deg * 180 / math.pi
angle between two vectors. Result from 0 to 2Pi.
def vector_angle(first_x: float, first_y: float, second_x: float, second_y: float) -> float:
angle = math.atan2(second_y - first_y, second_x - first_x)
if angle < 0:
angle += math.tau
return angle
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
phys_const-0.0.4.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for phys_const-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad70eb3005423fca1b4079ddad05160d4277d6e9c041251871596d052cb9573e |
|
MD5 | d7740d12e9bd64f3079356c46350f008 |
|
BLAKE2b-256 | fc4347818f5f72bc26a723fca6dec73fe64988eff965908fe78f3fc43d4a343c |