Skip to content

Commit

Permalink
fixed position calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHelfer committed Jan 26, 2024
1 parent bc4d79e commit 61a1887
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion GeneralRelativity/Interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def get_postion(self, tensor: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]
)
# This array gives the position of the interpolated point in the interpolated array relative to the input array
position[ind[0], ind[1], ind[2]] = (
index_for_input_array + relative_position
index_for_input_array + relative_position + 1
)

return position
Expand Down Expand Up @@ -457,6 +457,13 @@ def plot_grid_position(self):
plt.close()


plt.subplot(1,2,1)
plt.imshow(interpolated[0,0,:,:,4])
plt.subplot(1,2,2)
interpolated,_ = self.non_vector_implementation(x)
plt.imshow(interpolated[0,0,:,:,4])
plt.savefig(f"interpolation_results.png")

if __name__ == "__main__":
print_grid_lay_out()
interpolation = interp(6, 3, 25)
Expand Down

0 comments on commit 61a1887

Please sign in to comment.