|
18 | 18 | from anaflow.tools.special import sph_surf |
19 | 19 |
|
20 | 20 | try: |
21 | | - from ._laplace_accel import ( |
22 | | - solve_homogeneous as _solve_homogeneous, |
23 | | - solve_multilayer as _solve_multilayer, |
24 | | - ) |
| 21 | + from ._laplace_accel import solve_homogeneous as _solve_homogeneous |
| 22 | + from ._laplace_accel import solve_multilayer as _solve_multilayer |
25 | 23 | except ImportError as exc: # pragma: no cover - extension is mandatory |
26 | 24 | raise ImportError( |
27 | 25 | "anaflow.flow._laplace_accel extension missing. " |
@@ -143,15 +141,9 @@ def grf_laplace( |
143 | 141 | # ensure that input is treated as contiguous arrays |
144 | 142 | s = np.ascontiguousarray(np.atleast_1d(np.asarray(s, dtype=np.float64))) |
145 | 143 | rad = np.ascontiguousarray(np.atleast_1d(np.asarray(rad, dtype=np.float64))) |
146 | | - S_part = np.ascontiguousarray( |
147 | | - np.atleast_1d(np.asarray(S_part, dtype=np.float64)) |
148 | | - ) |
149 | | - K_part = np.ascontiguousarray( |
150 | | - np.atleast_1d(np.asarray(K_part, dtype=np.float64)) |
151 | | - ) |
152 | | - R_part = np.ascontiguousarray( |
153 | | - np.atleast_1d(np.asarray(R_part, dtype=np.float64)) |
154 | | - ) |
| 144 | + S_part = np.ascontiguousarray(np.atleast_1d(np.asarray(S_part, dtype=np.float64))) |
| 145 | + K_part = np.ascontiguousarray(np.atleast_1d(np.asarray(K_part, dtype=np.float64))) |
| 146 | + R_part = np.ascontiguousarray(np.atleast_1d(np.asarray(R_part, dtype=np.float64))) |
155 | 147 |
|
156 | 148 | # the dimension is used by nu in the literature (See Barker 88) |
157 | 149 | dim = float(dim) |
@@ -192,24 +184,13 @@ def grf_laplace( |
192 | 184 | diff_sr0 = float(np.sqrt(S_part[0] / K_part[0])) |
193 | 185 | cond_vals = np.asarray(pump_cond(s, **cond_kw), dtype=np.float64) |
194 | 186 | if cond_vals.shape != s.shape: |
195 | | - cond_vals = np.broadcast_to(cond_vals, s.shape).astype( |
196 | | - np.float64, copy=True |
197 | | - ) |
| 187 | + cond_vals = np.broadcast_to(cond_vals, s.shape).astype(np.float64, copy=True) |
198 | 188 | cond_vals = np.ascontiguousarray(cond_vals, dtype=np.float64) |
199 | 189 |
|
200 | 190 | if R_part[0] > 0.0: |
201 | | - qs = ( |
202 | | - -np.power(s, -0.5) |
203 | | - / diff_sr0 |
204 | | - * R_part[0] ** nu1 |
205 | | - * cond_vals |
206 | | - ) |
| 191 | + qs = -np.power(s, -0.5) / diff_sr0 * R_part[0] ** nu1 * cond_vals |
207 | 192 | else: |
208 | | - qs = ( |
209 | | - -np.power(2.0 / diff_sr0, nu) |
210 | | - * np.power(s, -nu / 2.0) |
211 | | - * cond_vals |
212 | | - ) |
| 193 | + qs = -np.power(2.0 / diff_sr0, nu) * np.power(s, -nu / 2.0) * cond_vals |
213 | 194 | qs = np.ascontiguousarray(qs, dtype=np.float64) |
214 | 195 |
|
215 | 196 | difsr = np.ascontiguousarray(np.sqrt(S_part / K_part), dtype=np.float64) |
|
0 commit comments