Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from __future__ import division 

2from . import cl_utils 

3from past.utils import old_div 

4 

5 

6def luminosity_to_flux(lumErg_S, dist_Mpc): 

7 """ 

8 *Convert luminosity to a flux* 

9 

10 **Key Arguments** 

11 

12 - ``lumErg_S`` -- luminosity in ergs/sec 

13 - ``dist_Mpc`` -- distance in Mpc 

14 

15 

16 **Return** 

17 

18 - ``fluxErg_cm2_S`` -- flux in ergs/cm2/s 

19 

20 """ 

21 ## STANDARD LIB ## 

22 ## THIRD PARTY ## 

23 import numpy as np 

24 import math 

25 ## LOCAL APPLICATION ## 

26 

27 ################ > VARIABLE SETTINGS ###### 

28 

29 ################ >ACTION(S) ################ 

30 # Convert the distance to cm 

31 distCm = dist_Mpc * MPC_2_CMS 

32 fluxErg_cm2_S = old_div(lumErg_S, (4 * np.pi * distCm ** 2)) 

33 

34 return fluxErg_cm2_S 

35 

36########################################################################## 

37# PRIVATE (HELPER) FUNCTIONS # 

38########################################################################## 

39if __name__ == '__main__': 

40 main()