反差指数计算

反差指数计算

喻园

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import math


<!--more-->

# 修正issue与公式来源
# https://github.com/Stellarium/stellarium/issues/1145

# 根据你的环境设置NELM:
# ! Class 1 = NELM 7.6-8.0; average NELM is 7.8
# ! Class 2 = NELM 7.1-7.5; average NELM is 7.3
# ! Class 3 = NELM 6.6-7.0; average NELM is 6.8
# ! Class 4 = NELM 6.1-6.5; average NELM is 6.3
# ! Class 5 = NELM 5.6-6.0; average NELM is 5.8
# ! Class 6 = NELM 5.1-5.5; average NELM is 5.3
# ! Class 7 = NELM 4.6-5.0; average NELM is 4.8
# ! Class 8 = NELM 4.1-4.5; average NELM is 4.3
# ! Class 9 = NELM 4.0
# ! @arg idx Bortle Scale Index (valid: 1..9, will be forced to valid range)
NELM = 7.3

# 输入:深空天体的星等、长轴与短轴(arcsec)
# 输出:深空天体的反差指数
def calContrastIndex(mag, majorAxisSize, minorAxisSize):
# // Compute an extended object's contrast index: http://www.unihedron.com/projects/darksky/NELM2BCalc.html
# // Sky brightness
# // Source: Schaefer, B.E. Feb. 1990. Telescopic Limiting Magnitude. PASP 102:212-229
# // URL: http://adsbit.harvard.edu/cgi-bin/nph-iarticle_query?bibcode=1990PASP..102..212S [1990PASP..102..212S]
def getSurfaceBrightnessWithExtinction(mag, majorAxisSize, minorAxisSize):
sq = 3600 * 3600
# arcsec^2 or arcmin^2
if minorAxisSize == 0:
SurfaceArea = math.pi * (majorAxisSize / 2) * (majorAxisSize / 2) # S = pi*R^2 = pi*(D/2)^2
else:
SurfaceArea = math.pi * (majorAxisSize / 2) * (minorAxisSize / 2) # S = pi*a*b
if mag < 99 and majorAxisSize > 0:
return mag + 2.5 * math.log10(SurfaceArea * sq)
else:
return 99
B_mpsas = 21.58 - 5 * math.log10(math.pow(10, 1.586 - NELM * 0.2) - 1)
# // Compute an extended object's contrast index
# // Source: Clark, R.N., 1990. Appendix E in Visual Astronomy of the Deep Sky, Cambridge University Press and Sky Publishing.
# // URL: http://www.clarkvision.com/visastro/appendix-e.html
return -0.4 * (getSurfaceBrightnessWithExtinction(mag,majorAxisSize,minorAxisSize) - B_mpsas)