aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/utils/convert.py
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/utils/convert.py')
-rw-r--r--fg21sim/utils/convert.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/fg21sim/utils/convert.py b/fg21sim/utils/convert.py
index 1ada6ae..fc9a228 100644
--- a/fg21sim/utils/convert.py
+++ b/fg21sim/utils/convert.py
@@ -1,15 +1,14 @@
-# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me>
+# Copyright (c) 2016 Weitian LI <liweitianux@live.com>
# MIT license
"""
Utilities for conversion among common astronomical quantities.
"""
+import numpy as np
import astropy.units as au
import numba
-from .units import (Constants as AC, UnitConversions as AUC)
-
def Fnu_to_Tb(Fnu, omega, freq):
"""Convert flux density to brightness temperature, using the
@@ -93,11 +92,11 @@ def Sb_to_Tb_fast(Sb, freq):
Calculated brightness temperature, unit [ K ]
"""
# NOTE: `radian` is dimensionless
- rad2_to_deg2 = AUC.rad2deg ** 2
+ rad2_to_deg2 = np.rad2deg(1.0) * np.rad2deg(1.0)
Sb_rad2 = Sb * rad2_to_deg2 # unit: [ Jy/rad^2 ] -> [ Jy ]
- c = AC.c # speed of light, [ cm/s ]
- k_B = AC.k_B # Boltzmann constant, [ erg/K ]
- coef = 1e-35 # unit conversion factor
+ c = 29979245800.0 # speed of light, [ cm/s ]
+ k_B = 1.3806488e-16 # Boltzmann constant, [ erg/K ]
+ coef = 1e-35 # take care the unit conversions
Tb = coef * (Sb_rad2 * c*c) / (2 * k_B * freq*freq) # unit: [ K ]
return Tb