Skip to content

Commit

Permalink
Fix black
Browse files Browse the repository at this point in the history
  • Loading branch information
chaithyagr committed May 23, 2024
1 parent 238ec00 commit a58962c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/example_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

# %%
flat_traj = traj.reshape(-1, 2)
weights = np.sqrt(np.sum(flat_traj ** 2, axis=1))
weights = np.sqrt(np.sum(flat_traj**2, axis=1))
nufft = get_operator("finufft")(traj, shape=mri_2D.shape, density=weights)
adjoint_manual = nufft.adj_op(kspace)
fig, axs = plt.subplots(1, 3, figsize=(15, 5))
Expand Down
2 changes: 1 addition & 1 deletion src/mrinufft/density/geometry_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def voronoi_unique(traj, *args, **kwargs):

# For edge point (infinite voronoi cells) we extrapolate from neighbours
# Initial implementation in Jeff Fessler's MIRT
rho = np.sum(traj ** 2, axis=1)
rho = np.sum(traj**2, axis=1)
igood = (rho > 0.6 * np.max(rho)) & ~np.isinf(wi)
if len(igood) < 10:
print("dubious extrapolation with", len(igood), "points")
Expand Down
4 changes: 1 addition & 3 deletions src/mrinufft/extras/smaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ def _extract_kspace_center(
a_0 = 0.5 if window_fun in ["hann", "hanning"] else 0.53836
window = a_0 + (1 - a_0) * xp.cos(xp.pi * radius / threshold)
elif window_fun == "ellipse":
window = (
xp.sum(kspace_loc ** 2 / xp.asarray(threshold) ** 2, axis=1) <= 1
)
window = xp.sum(kspace_loc**2 / xp.asarray(threshold) ** 2, axis=1) <= 1
else:
raise ValueError("Unsupported window function.")
data_thresholded = window * kspace_data
Expand Down
1 change: 1 addition & 0 deletions src/mrinufft/extras/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils for extras module."""

from mrinufft._utils import MethodRegister

register_smaps = MethodRegister("sensitivity_maps")
Expand Down
1 change: 1 addition & 0 deletions src/mrinufft/io/siemens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Siemens specific rawdat reader, wrapper over pymapVBVD."""

import numpy as np


Expand Down
6 changes: 3 additions & 3 deletions src/mrinufft/trajectories/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,19 @@ def Ra(vector, theta):
return np.array(
[
[
cos_t + v_x ** 2 * (1 - cos_t),
cos_t + v_x**2 * (1 - cos_t),
v_x * v_y * (1 - cos_t) + v_z * sin_t,
v_x * v_z * (1 - cos_t) - v_y * sin_t,
],
[
v_y * v_x * (1 - cos_t) - v_z * sin_t,
cos_t + v_y ** 2 * (1 - cos_t),
cos_t + v_y**2 * (1 - cos_t),
v_y * v_z * (1 - cos_t) + v_x * sin_t,
],
[
v_z * v_x * (1 - cos_t) + v_y * sin_t,
v_z * v_y * (1 - cos_t) - v_x * sin_t,
cos_t + v_z ** 2 * (1 - cos_t),
cos_t + v_z**2 * (1 - cos_t),
],
]
)
Expand Down
4 changes: 2 additions & 2 deletions src/mrinufft/trajectories/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def stack_spherically(

# Attribute shots to stacks following density proportional to surface
Nc_per_stack = np.ones(nb_stacks).astype(int)
density = radii ** 2 # simplified version
density = radii**2 # simplified version
for _ in range(Nc - nb_stacks):
idx = np.argmax(density / Nc_per_stack)
Nc_per_stack[idx] += 1
Expand Down Expand Up @@ -406,7 +406,7 @@ def shellify(
)

# Carve upper hemisphere from trajectory
z_coords = KMAX ** 2 - shell_upper[..., 0] ** 2 - shell_upper[..., 1] ** 2
z_coords = KMAX**2 - shell_upper[..., 0] ** 2 - shell_upper[..., 1] ** 2
z_signs = np.sign(z_coords)
shell_upper[..., 2] += z_signs * np.sqrt(np.abs(z_coords))

Expand Down
10 changes: 5 additions & 5 deletions src/mrinufft/trajectories/trajectory3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def initialize_3D_wave_caipi(
elif packing == Packings.CIRCLE:
positions = [[0, 0]]
counter = 0
while len(positions) < side ** 2:
while len(positions) < side**2:
counter += 1
perimeter = 2 * np.pi * counter
nb_shots = int(np.trunc(perimeter))
Expand Down Expand Up @@ -353,11 +353,11 @@ def initialize_3D_seiffert_spiral(
"""
# Normalize ellipses integrations by the requested period
spiral = np.zeros((1, Ns // (1 + in_out), 3))
period = 4 * ellipk(curve_index ** 2)
period = 4 * ellipk(curve_index**2)
times = np.linspace(0, nb_revolutions * period, Ns // (1 + in_out), endpoint=False)

# Initialize first shot
jacobi = ellipj(times, curve_index ** 2)
jacobi = ellipj(times, curve_index**2)
spiral[0, :, 0] = jacobi[0] * np.cos(curve_index * times)
spiral[0, :, 1] = jacobi[0] * np.sin(curve_index * times)
spiral[0, :, 2] = jacobi[1]
Expand Down Expand Up @@ -655,7 +655,7 @@ def initialize_3D_seiffert_shells(
Nc_per_shell[idx] += 1

# Normalize ellipses integrations by the requested period
period = 4 * ellipk(curve_index ** 2)
period = 4 * ellipk(curve_index**2)
times = np.linspace(0, nb_revolutions * period, Ns, endpoint=False)

# Create shells one by one
Expand All @@ -667,7 +667,7 @@ def initialize_3D_seiffert_shells(
k0 = radii[i]

# Initialize first shot
jacobi = ellipj(times, curve_index ** 2)
jacobi = ellipj(times, curve_index**2)
trajectory[count, :, 0] = k0 * jacobi[0] * np.cos(curve_index * times)
trajectory[count, :, 1] = k0 * jacobi[0] * np.sin(curve_index * times)
trajectory[count, :, 2] = k0 * jacobi[1]
Expand Down

0 comments on commit a58962c

Please sign in to comment.