@@ -50,6 +50,17 @@ def __init__(self, mask: Union[np.ndarray, List]):
5050
5151 @property
5252 def centre (self ) -> Tuple [float , float ]:
53+ """
54+ Returns the centre of the zoomed in region, which is the average of the maximum and minimum y and x pixel values
55+ of the unmasked region.
56+
57+ The y and x pixel values are the pixel coordinates of the unmasked region, which are derived from the
58+ `Mask2D` object. The pixel coordinates are in the same units as the pixel scales of the `Mask2D` object.
59+
60+ Returns
61+ -------
62+ The centre of the zoomed in region.
63+ """
5364 from autoarray .structures .grids .uniform_2d import Grid2D
5465
5566 grid = grid_2d_util .grid_2d_slim_via_mask_from (
@@ -73,6 +84,17 @@ def centre(self) -> Tuple[float, float]:
7384
7485 @property
7586 def offset_pixels (self ) -> Tuple [float , float ]:
87+ """
88+ Returns the offset of the centred of the zoomed in region from the centre of the `Mask2D` object in pixel
89+ units.
90+
91+ This is computed by subtracting the pixel coordinates of the `Mask2D` object from the pixel coordinates of
92+ the zoomed in region.
93+
94+ Returns
95+ -------
96+ The offset of the zoomed in region from the centre of the `Mask2D` object in pixel units.
97+ """
7698 if self .mask .pixel_scales is None :
7799 return self .mask .geometry .central_pixel_coordinates
78100
@@ -83,6 +105,17 @@ def offset_pixels(self) -> Tuple[float, float]:
83105
84106 @property
85107 def offset_scaled (self ) -> Tuple [float , float ]:
108+ """
109+ Returns the offset of the centred of the zoomed in region from the centre of the `Mask2D` object in scaled
110+ units.
111+
112+ This is computed by subtracting the pixel coordinates of the `Mask2D` object from the pixel coordinates of
113+ the zoomed in region.
114+
115+ Returns
116+ -------
117+ The offset of the zoomed in region from the centre of the `Mask2D` object in scaled units.
118+ """
86119 return (
87120 - self .mask .pixel_scales [0 ] * self .offset_pixels [0 ],
88121 self .mask .pixel_scales [1 ] * self .offset_pixels [1 ],
@@ -91,10 +124,12 @@ def offset_scaled(self) -> Tuple[float, float]:
91124 @property
92125 def region (self ) -> List [int ]:
93126 """
94- The zoomed rectangular region corresponding to the square encompassing all unmasked values. This zoomed
95- extraction region is a squuare, even if the mask is rectangular.
127+ The zoomed region corresponding to the square encompassing all unmasked values.
96128
97129 This is used to zoom in on the region of an image that is used in an analysis for visualization.
130+
131+ This zoomed extraction region is a square, even if the mask is rectangular, so that extraction regions are
132+ always squares which is important for ensuring visualization does not have aspect ratio issues.
98133 """
99134
100135 where = np .array (np .where (np .invert (self .mask .astype ("bool" ))))
@@ -119,22 +154,14 @@ def region(self) -> List[int]:
119154
120155 @property
121156 def shape_native (self ) -> Tuple [int , int ]:
122- region = self .region
123- return (region [1 ] - region [0 ], region [3 ] - region [2 ])
124-
125- @property
126- def mask_unmasked (self ) -> "Mask2D" :
127157 """
128- The scaled-grid of (y,x) coordinates of every pixel .
158+ The shape of the zoomed in region in pixels .
129159
130- This is defined from the top-left corner, such that the first pixel at location [0, 0] will have a negative x
131- value y value in scaled units.
132- """
133-
134- from autoarray .mask .mask_2d import Mask2D
160+ This is computed by subtracting the minimum and maximum y and x pixel values of the unmasked region.
135161
136- return Mask2D .all_false (
137- shape_native = self .shape_native ,
138- pixel_scales = self .mask .pixel_scales ,
139- origin = self .offset_scaled ,
140- )
162+ Returns
163+ -------
164+ The shape of the zoomed in region in pixels.
165+ """
166+ region = self .region
167+ return (region [1 ] - region [0 ], region [3 ] - region [2 ])
0 commit comments