Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flow_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def _masked_mean(source, mask):
+ post_batch.shape[-len(patch_size) :]
) // 2 - 1
return ( # pyrefly: ignore[bad-return]
center_offset, # pytype: disable=bad-return-type # jax-ndarray
center_offset,
masked_xcorr(
pre_batch - pre_mean,
post_batch - post_mean,
Expand Down Expand Up @@ -435,7 +435,7 @@ def batched_xcorr_peaks(
xcorr,
center_offset, # pyrefly: ignore[bad-argument-type]
min_distance,
threshold_rel, # pytype: disable=wrong-arg-types # jax-ndarray
threshold_rel,
peak_radius,
)
return peaks
Expand Down Expand Up @@ -574,15 +574,15 @@ def flow_field(

if pre_mask is not None:
s = geom_utils.query_integral_image(
_integral_image(pre_mask), patch_size, step # pyrefly: ignore[bad-argument-type]
_integral_image(pre_mask), patch_size, step
)
m = (s / np.prod(patch_size) >= max_masked)[out_sel]
selection_mask[m] = False
del s

if post_mask is not None:
s = geom_utils.query_integral_image(
_integral_image(post_mask), post_patch_size, step # pyrefly: ignore[bad-argument-type]
_integral_image(post_mask), post_patch_size, step
)
m = (s / np.prod(post_patch_size) >= max_masked)[out_sel]
selection_mask[m] = False
Expand Down
2 changes: 1 addition & 1 deletion mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def elastic_mesh_3d(
fn = jnp.pad(f, pad_neg)
f_tot -= fn

return f_tot # pytype: disable=bad-return-type # jax-ndarray
return f_tot # pyrefly: ignore[bad-return]


@dataclasses.dataclass(frozen=True)
Expand Down
10 changes: 5 additions & 5 deletions processor/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def compute_ref_mesh_multiz(
curr_flow[1, ...][~m] = np.nan

curr_flow = np.array(
map_utils.compose_maps_fast( # pytype: disable=wrong-arg-types # jax-ndarray
map_utils.compose_maps_fast(
curr_flow, # pyrefly: ignore[bad-argument-type]
box.start[::-1], # pyrefly: ignore[bad-argument-type]
stride,
Expand Down Expand Up @@ -264,7 +264,7 @@ def compute_ref_mesh(
flow_utils.apply_mask(ref_mesh, mask)

flow = np.array(
map_utils.compose_maps_fast( # pytype: disable=wrong-arg-types # jax-ndarray
map_utils.compose_maps_fast(
flow, # pyrefly: ignore[bad-argument-type]
ref_box.start[::-1], # pyrefly: ignore[bad-argument-type]
stride,
Expand Down Expand Up @@ -459,7 +459,7 @@ def relax_mesh(

logging.info('Starting mesh relaxation with: %r', config)

x, e_kin, num_steps = mesh_lib.relax_mesh(x, prev, integration_config) # pytype: disable=wrong-arg-types # jax-ndarray
x, e_kin, num_steps = mesh_lib.relax_mesh(x, prev, integration_config) # pyrefly: ignore[bad-argument-type, bad-assignment]
x = np.array(x)
orig_x = x.copy()

Expand All @@ -481,7 +481,7 @@ def relax_mesh(
start_x = np.zeros_like(x)
start_x = self.maybe_update_init_state(start_x, prev, config.options)

x, _, prep_steps = mesh_lib.relax_mesh( # pytype: disable=wrong-arg-types # jax-ndarray
x, _, prep_steps = mesh_lib.relax_mesh( # pyrefly: ignore[bad-assignment]
start_x, # pyrefly: ignore[bad-argument-type]
x, # pyrefly: ignore[bad-argument-type]
dataclasses.replace(
Expand All @@ -503,7 +503,7 @@ def relax_mesh(
if mask is not None:
flow_utils.apply_mask(x, mask)

x, e_kin2, reg_steps = mesh_lib.relax_mesh(x, prev, integration_config) # pytype: disable=wrong-arg-types # jax-ndarray
x, e_kin2, reg_steps = mesh_lib.relax_mesh(x, prev, integration_config) # pyrefly: ignore[bad-argument-type, bad-assignment]
x = np.array(x)
return (
x,
Expand Down
4 changes: 2 additions & 2 deletions stitch_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def _apply_flow(
nbor_flow_3d = nbor_flow[:, None, ...]
nbor_mesh_3d = nbor_mesh[:, None, ...]

update = map_utils.compose_maps_fast( # pytype: disable=wrong-arg-types # jnp-type
update = map_utils.compose_maps_fast(
nbor_flow_3d,
start, # pyrefly: ignore[bad-argument-type]
stride,
Expand Down Expand Up @@ -601,7 +601,7 @@ def _update_mesh(
nbor_mesh = jax.lax.dynamic_index_in_dim(x, nbor_idx, axis=1, keepdims=False)
unused = 1
# pylint: disable=g-long-lambda
return ( # pytype: disable=bad-return-type # jax-ndarray
return ( # pyrefly: ignore[bad-return]
jax.lax.cond(
nbor_idx == -1, # invalid index?
lambda _: mesh, # nothing to update
Expand Down
Loading