_util.py 418 Bytes
Newer Older
Fang Yuedong's avatar
Fang Yuedong committed
1
2
3
import numpy as np
import os

Fang Yuedong's avatar
Fang Yuedong committed
4
5
6
VC_A = 2.99792458e+18  # speed of light: A/s
VC_M = 2.99792458e+8   # speed of light: m/s
H_PLANK = 6.626196e-27 # Plank constant: erg s
Fang Yuedong's avatar
Fang Yuedong committed
7
8
9
10
11
12
13
14
15

def photonEnergy(lambd):
	""" The energy of photon at a given wavelength

	Parameter:
		lambd: the wavelength in unit of Angstrom
	Return:
		eph: energy of photon in unit of erg
	"""
Fang Yuedong's avatar
Fang Yuedong committed
16
17
	nu = VC_A / lambd
	eph = H_PLANK * nu
Fang Yuedong's avatar
Fang Yuedong committed
18
	return eph