From 374795fc794e7306cbd4260942f6a3051489e656 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 24 Jun 2017 09:42:43 +0800 Subject: Revert "utils/convert.py: Use 'utils.units' module" This reverts commit eb660ae70db40d36418f1e4eb886fd9bb02af1a7. Numba cannot recognize AUC/AC classes, or needs further updates --- fg21sim/utils/convert.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'fg21sim/utils') 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 +# Copyright (c) 2016 Weitian LI # 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 -- cgit v1.2.2