@@ -31,21 +31,37 @@ def planck_law(λ, T):
3131
3232
3333
34- @numba .njit (cache = True , parallel = True , fastmath = True )
35- def itot_flux (coeffs , law , grid ):
36- delta = 2.0 / grid
37- size = grid * grid
38- y = np .linspace (- 1 + delta / 2 , 1 - delta / 2 , grid )
39- z = y .copy ()
40- total = 0.0
41- for i in prange (grid ):
42- for j in range (grid ): # Hybrid: prange outer
43- yy , zz = y [i ], z [j ]
44- if yy * yy + zz * zz > 1 : continue
45- _ , limb = ld (yy , zz , coeffs , law )
46- total += limb * delta * delta
34+ @numba .njit (cache = True , nopython = True )
35+ def itot_flux (u1 : np .float64 , u2 : np .float64 , grid : np .int32 ):
36+ """
37+ Calculate the flux in each cell of the grid and integrate over the entire
38+ stellar disc.
39+
40+ Arguments
41+ ---------
42+ u1, u2 : float
43+ Quadratic limb-darkening parameters
44+ grid : int
45+ Grid size
46+ """
47+ # step of the grid. grid goes from -1 to 1, therefore 2 in total
48+ delta_grid = 2.0 / grid
49+ # total stellar intensity (without spots)
50+ total = 0
51+ y_positions = np .linspace (- 1.0 + delta_grid / 2.0 , 1.0 - delta_grid / 2.0 , grid )
52+ z_positions = np .linspace (- 1.0 + delta_grid / 2.0 , 1.0 - delta_grid / 2.0 , grid )
53+ # Scan of each cell on the grid
54+ for iy ,y in enumerate (y_positions ):
55+ for iz ,z in enumerate (z_positions ):
56+ # projected radius on the sky smaller than 1,
57+ # which means that we are on the stellar disc
58+ if (y ** 2 + z ** 2 ) <= 1 :
59+ _ , limb = ld (y , z , u1 , u2 )
60+ total += limb # check this
61+
4762 return total
4863
64+
4965@numba .njit (cache = True , nopython = True )
5066def doppler_shift_wave (wave : np .ndarray , rv : float ):
5167 """
0 commit comments