@@ -1432,16 +1432,24 @@ def create_mrt_line_kernel(width, sigma, outfile=None, shape=(1024, 2048),
1432
1432
LOG .info ('Inteprolating onto new grid to center kernel' )
1433
1433
theta_arr = np .arange (cutout .shape [1 ])
1434
1434
rho_arr = np .arange (cutout .shape [0 ])
1435
- theta_grid , rho_grid = np .meshgrid (theta_arr , rho_arr )
1436
1435
1437
1436
new_theta_arr = theta_arr + theta_shift
1438
1437
new_rho_arr = rho_arr + rho_shift
1439
1438
new_theta_grid , new_rho_grid = np .meshgrid (new_theta_arr , new_rho_arr )
1440
1439
1441
- # inteprolate onto new grid
1442
- f = interpolate .interp2d (theta_grid , rho_grid , cutout .data ,
1443
- kind = 'cubic' )
1444
- cutout = f (new_theta_arr , new_rho_arr ) # overwrite old cutout
1440
+ f = interpolate .RegularGridInterpolator ((rho_arr , theta_arr ),
1441
+ cutout .data ,
1442
+ bounds_error = False ,
1443
+ fill_value = 0 ,
1444
+ method = 'cubic' )
1445
+
1446
+ # unable to provide 2D grid of points for interpolation. Switching to
1447
+ # 1D, and then will switch back
1448
+ points = [[r , t ] for r , t in zip (np .ravel (new_rho_grid ),
1449
+ np .ravel (new_theta_grid ))]
1450
+
1451
+ # return to original shape and replace the old cutout
1452
+ cutout = np .reshape (f (points ), cutout .data .shape )
1445
1453
1446
1454
if ax :
1447
1455
fig4 , ax4 = plt .subplots ()
0 commit comments