@@ -382,7 +382,8 @@ def from_sub_grid_2d_pixel_scales_and_sub_size(cls, sub_grid_2d, pixel_scales, s
382382 @classmethod
383383 def manual_1d (cls , grid , shape_2d , pixel_scales = None , sub_size = 1 , origin = (0.0 , 0.0 )):
384384
385- grid = np .asarray (grid )
385+ if type (grid ) is list :
386+ grid = np .asarray (grid )
386387
387388 if type (pixel_scales ) is float :
388389 pixel_scales = (pixel_scales , pixel_scales )
@@ -400,7 +401,8 @@ def manual_1d(cls, grid, shape_2d, pixel_scales=None, sub_size=1, origin=(0.0, 0
400401 @classmethod
401402 def manual_2d (cls , grid , pixel_scales = None , sub_size = 1 , origin = (0.0 , 0.0 )):
402403
403- grid = np .asarray (grid )
404+ if type (grid ) is list :
405+ grid = np .asarray (grid )
404406
405407 if type (pixel_scales ) is float :
406408 pixel_scales = (pixel_scales , pixel_scales )
@@ -499,8 +501,9 @@ class MaskedGrid(AbstractGrid):
499501
500502 @classmethod
501503 def manual_1d (cls , grid , mask ):
502-
503- grid = np .asarray (grid )
504+
505+ if type (grid ) is list :
506+ grid = np .asarray (grid )
504507
505508 if grid .shape [0 ] != mask .sub_pixels_in_mask :
506509 raise exc .GridException ('The input 1D grid does not have the same number of entries as sub-pixels in'
@@ -511,7 +514,8 @@ def manual_1d(cls, grid, mask):
511514 @classmethod
512515 def manual_2d (cls , grid , mask ):
513516
514- grid = np .asarray (grid )
517+ if type (grid ) is list :
518+ grid = np .asarray (grid )
515519
516520 if (grid .shape [0 ], grid .shape [1 ]) != mask .sub_shape_2d :
517521 raise exc .GridException ('The input grid is 2D but not the same dimensions as the sub-mask '
@@ -562,7 +566,8 @@ def __new__(
562566 nearest_irregular_1d_index_for_mask_1d_index : ndarray
563567 A 1D array that maps every grid pixel to its nearest pixelization-grid pixel.
564568 """
565- grid = np .asarray (grid )
569+ if type (grid ) is list :
570+ grid = np .asarray (grid )
566571 obj = grid .view (cls )
567572 obj .nearest_irregular_1d_index_for_mask_1d_index = (
568573 nearest_irregular_1d_index_for_mask_1d_index
@@ -793,13 +798,11 @@ def from_mask_grid_and_pixel_scale_interpolation_grids(
793798
794799 rescale_factor = mask .pixel_scale / pixel_scale_interpolation_grid
795800
796- rescaled_mask = mask_util .rescaled_mask_2d_from_mask_2d_and_rescale_factor (
797- mask_2d = mask , rescale_factor = rescale_factor
798- )
801+ mask = mask .mapping .mask_sub_1
799802
800- interp_mask = mask_util . edge_buffed_mask_2d_from_mask_2d ( mask_2d = rescaled_mask ). astype (
801- "bool"
802- )
803+ rescaled_mask = mask . mapping . rescaled_mask_from_rescale_factor ( rescale_factor = rescale_factor )
804+
805+ interp_mask = rescaled_mask . mapping . edge_buffed_mask
803806
804807 interp_grid = grid_util .grid_1d_via_mask_2d (
805808 mask_2d = interp_mask ,
@@ -813,7 +816,7 @@ def from_mask_grid_and_pixel_scale_interpolation_grids(
813816
814817 return Interpolator (
815818 grid = grid ,
816- interp_grid = interp_grid ,
819+ interp_grid = MaskedGrid . manual_1d ( grid = interp_grid , mask = interp_mask ) ,
817820 pixel_scale_interpolation_grid = pixel_scale_interpolation_grid ,
818821 )
819822
0 commit comments