Skip to content

Commit b8b5a8d

Browse files
author
Clovis Lambert
committed
format
1 parent 992dbf0 commit b8b5a8d

2 files changed

Lines changed: 137 additions & 127 deletions

File tree

fluidsim/operators/spatial_average3d.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,13 @@ def _compute_bin_indices(self):
161161
This is done once at initialization to avoid repeated digitize calls.
162162
"""
163163
# Radial bin indices — shape (Nx_loc, Ny_loc, Nz_loc)
164-
self.r_indices = np.clip(
165-
np.digitize(self.r, self.r_bins) - 1, 0, self.nr - 1
166-
)
164+
self.r_indices = np.clip(np.digitize(self.r, self.r_bins) - 1, 0, self.nr - 1)
167165

168166
# Azimuthal bin indices
169167
self.rho_indices = np.clip(
170168
np.digitize(self.rho, self.rho_bins) - 1, 0, self.nrh - 1
171169
)
172-
self.z_indices = np.clip(
173-
np.digitize(self.Z, self.z_bins) - 1, 0, self.nz - 1
174-
)
170+
self.z_indices = np.clip(np.digitize(self.Z, self.z_bins) - 1, 0, self.nz - 1)
175171

176172
# ------------------------------------------------------------------ #
177173
# Radial average <f>_Omega(r) #
@@ -208,7 +204,7 @@ def compute_radial_average(self, field, return_std=False):
208204
# sin(phi) is the geometrical weight for the solid-angle average
209205
weights = np.sin(self.phi)
210206

211-
is_vector = (np.ndim(field) == 4 and np.shape(field)[0] == 3)
207+
is_vector = np.ndim(field) == 4 and np.shape(field)[0] == 3
212208

213209
if is_vector:
214210
field_avg = np.zeros((3, self.nr))
@@ -346,7 +342,7 @@ def compute_azimuthal_average(self, field, return_std=False):
346342
Azimuthal average in each (rho, z) bin (same on all processes).
347343
field_std : ndarray, same shape as field_avg (only if return_std=True)
348344
"""
349-
is_vector = (np.ndim(field) == 4 and np.shape(field)[0] == 3)
345+
is_vector = np.ndim(field) == 4 and np.shape(field)[0] == 3
350346

351347
if is_vector:
352348
field_avg = np.zeros((3, self.nrh, self.nz))
@@ -461,6 +457,5 @@ def compute_volume_weights(self):
461457
weights : ndarray, shape (Nx_loc, Ny_loc, Nz_loc)
462458
Volume weights on this process.
463459
"""
464-
d = self.oper.delta if hasattr(self.oper, 'delta') else 1.0
460+
d = self.oper.delta if hasattr(self.oper, "delta") else 1.0
465461
return np.full_like(self.X, d**3)
466-

0 commit comments

Comments
 (0)