From 61a1887ae9a667b2f28d137cb59fe81e525db87b Mon Sep 17 00:00:00 2001 From: ThomasHelfer Date: Thu, 25 Jan 2024 20:31:39 -0500 Subject: [PATCH] fixed position calculation --- GeneralRelativity/Interpolation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GeneralRelativity/Interpolation.py b/GeneralRelativity/Interpolation.py index d6c0787..0789088 100644 --- a/GeneralRelativity/Interpolation.py +++ b/GeneralRelativity/Interpolation.py @@ -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 @@ -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)