Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan DeKraker committed Dec 22, 2024
1 parent 1155b20 commit ac448b5
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions hippunfold/workflow/scripts/create_warps.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,22 @@ def summary(name, array):
# we have points defined by coord_flat_{ap,pd,io}, and corresponding value as native_coords_phys[:,i]
# and we want to interpolate on a grid in the unfolded space


# unnormalize and add a bit of noise so points don't ever perfectly overlap
coord_flat_ap_unnorm = coord_flat_ap * unfold_dims[0]
coord_flat_pd_unnorm = coord_flat_pd * unfold_dims[1]
coord_flat_io_unnorm = coord_flat_io * unfold_dims[2]

# add some noise to avoid perfectly overlapping datapoints!
points = (
coord_flat_ap * unfold_dims[0]
+ (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
coord_flat_pd * unfold_dims[1]
+ (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
coord_flat_io * unfold_dims[2]
+ (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
points = np.stack(
[
coord_flat_ap_unnorm + (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
coord_flat_pd_unnorm + (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
coord_flat_io_unnorm + (np.random.rand(coord_flat_ap.shape[0]) - 0.5) * 1e-6,
],
axis=1,
)
summary("points", points)


# perform the interpolation
Expand Down

0 comments on commit ac448b5

Please sign in to comment.