-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit_Convertor.py
27 lines (23 loc) · 1012 Bytes
/
Unit_Convertor.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
import math
import numpy as np
from scipy import constants
L = 100*constants.micro #EM Wavelength
F = constants.lambda2nu(L) #converted to frequency
FeV = constants.physical_constants['hertz-electron volt relationship']
F_K = constants.physical_constants['hertz-kelvin relationship']
print('EM wavelegnth of', L/constants.micro, 'um in vacuum equals', F/constants.giga, 'GHz')
print('EM wavelegnth of', L/constants.micro, 'um in vacuum worth', F*FeV[0], FeV[1])
print('EM wavelegnth of', L/constants.micro, 'um in vacuum worth', F*F_K[0], F_K[1])
L_array = np.arange(0.1,10,0.01) #in micron
F_array = constants.lambda2nu(L_array*constants.micro)
E_array = F_array*FeV[0]
# print(L_array)
# import matplotlib.pyplot as plt
# plt.plot(L_array,E_array)
# plt.title('Energy of light for each wavelength', fontsize=17, fontname='fantasy')
# plt.xlabel(r'$\lambda_{vac} (\mu{m})$', fontsize=17)
# plt.ylabel(r'Energy in eV', fontsize=17)
# plt.show()
from numericalunits import GHz, MHz
f = 9 * GHz
print(f / MHz)