@@ -465,13 +465,12 @@ def _small_mie_S1_S2(m, x, mu):
465465 return [S1 , S2 ]
466466
467467
468- def normalization_factor (a , b , x , norm_str ):
468+ def normalization_factor (m , x , norm_str ):
469469 """
470470 Figure out scattering function normalization.
471471
472472 Args:
473- a: complex array of An coefficients
474- b: complex array of Bn coefficients
473+ m: complex index of refraction of sphere
475474 x: dimensionless sphere size
476475 norm_str: string describing type of normalization
477476
@@ -486,26 +485,22 @@ def normalization_factor(a, b, x, norm_str):
486485 if norm in ['wiscombe' ]:
487486 return 1
488487
489- n = np .arange (1 , len (a ) + 1 )
490- cn = 2.0 * n + 1.0
491- qext = 2 * np .sum (cn * (a .real + b .real )) / x ** 2
488+ if norm in ['qsca' , 'scattering_efficiency' ]:
489+ return x * np .sqrt (np .pi )
492490
493- if norm in ['a' , 'albedo' ]:
494- return np .sqrt (np .pi * x ** 2 * qext )
491+ qext , qsca , _ , _ = _mie_scalar (m , x )
495492
496- qsca = 2 * np .sum (cn * (np .abs (a )** 2 + np .abs (b )** 2 )) / x ** 2
493+ if norm in ['a' , 'albedo' ]:
494+ return x * np .sqrt (np .pi * qext )
497495
498496 if norm in ['1' , 'one' , 'unity' ]:
499- return np .sqrt (qsca * np .pi * x ** 2 )
497+ return x * np .sqrt (qsca * np .pi )
500498
501499 if norm in ['four_pi' , '4pi' ]:
502- return np .sqrt (qsca * x ** 2 / 4 )
503-
504- if norm in ['qsca' , 'scattering_efficiency' ]:
505- return np .sqrt (np .pi * x ** 2 )
500+ return x * np .sqrt (qsca / 4 )
506501
507502 if norm in ['qext' , 'extinction_efficiency' ]:
508- return np .sqrt (qsca * np .pi * x ** 2 / qext )
503+ return x * np .sqrt (qsca * np .pi / qext )
509504
510505 raise ValueError ("normalization must be one of 'albedo' (default), 'one'"
511506 "'4pi', 'qext', 'qsca', 'bohren', or 'wiscombe'" )
@@ -549,7 +544,7 @@ def mie_S1_S2(m, x, mu, norm='albedo'):
549544 pi_nm1 = ((2 * n + 1 ) * mu [k ] * pi_nm1 - (n + 1 ) * pi_nm2 ) / n
550545 pi_nm2 = temp
551546
552- normalization = normalization_factor (a , b , x , norm )
547+ normalization = normalization_factor (m , x , norm )
553548
554549 S1 /= normalization
555550 S2 /= normalization
0 commit comments