diff options
author | Aaron LI <aly@aaronly.me> | 2017-06-24 09:42:43 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-06-24 09:42:43 +0800 |
commit | 374795fc794e7306cbd4260942f6a3051489e656 (patch) | |
tree | f67ce34a98398d0950e8eb31a9c6f045f84874c0 /fg21sim/utils | |
parent | dcec2c7253b66c293c6816223bd8f57295308184 (diff) | |
download | fg21sim-374795fc794e7306cbd4260942f6a3051489e656.tar.bz2 |
Revert "utils/convert.py: Use 'utils.units' module"
This reverts commit eb660ae70db40d36418f1e4eb886fd9bb02af1a7.
Numba cannot recognize AUC/AC classes, or needs further updates
Diffstat (limited to 'fg21sim/utils')
-rw-r--r-- | fg21sim/utils/convert.py | 13 |
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 |