|
6 | 6 | from autoconf import cached_property |
7 | 7 |
|
8 | 8 | import autoarray as aa |
| 9 | +import numpy as np |
9 | 10 |
|
10 | 11 | if TYPE_CHECKING: |
11 | 12 | from autogalaxy.galaxy.galaxy import Galaxy |
@@ -147,7 +148,7 @@ def model_image(self) -> aa.Array2D: |
147 | 148 |
|
148 | 149 | return adapt_model_image |
149 | 150 |
|
150 | | - def updated_via_instance_from(self, instance, mask=None) -> "AdaptImages": |
| 151 | + def updated_via_instance_from(self, instance, dataset_model, xp=np, mask=None) -> "AdaptImages": |
151 | 152 | """ |
152 | 153 | Returns adapt-images which have been updated to map galaxy instances instead of galaxy names. |
153 | 154 |
|
@@ -202,10 +203,60 @@ def updated_via_instance_from(self, instance, mask=None) -> "AdaptImages": |
202 | 203 | for galaxy_name, galaxy in instance.path_instance_tuples_for_class(Galaxy): |
203 | 204 | galaxy_name = str(galaxy_name) |
204 | 205 |
|
| 206 | + #print('grid_offset:', dataset_model.grid_offset) |
| 207 | + #print('grid_rotation:', dataset_model.grid_rotation) |
| 208 | + |
205 | 209 | if galaxy_name in self.galaxy_name_image_plane_mesh_grid_dict: |
206 | | - galaxy_image_plane_mesh_grid_dict[galaxy] = ( |
207 | | - self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] |
208 | | - ) |
| 210 | + |
| 211 | + # print('AdaptImage Here') |
| 212 | + |
| 213 | + # image_plane_mesh_grid = self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] |
| 214 | + # #print('image_plane_mesh_grid:', image_plane_mesh_grid) |
| 215 | + |
| 216 | + # moved_image_plane_mesh_grid = image_plane_mesh_grid.subtracted_and_rotated_from( |
| 217 | + # offset=dataset_model.grid_offset, |
| 218 | + # angle=dataset_model.grid_rotation, |
| 219 | + # xp=xp |
| 220 | + # ) |
| 221 | + |
| 222 | + # print('moved_image_plane_mesh_grid:', moved_image_plane_mesh_grid) |
| 223 | + |
| 224 | + #galaxy_image_plane_mesh_grid_dict[galaxy] = moved_image_plane_mesh_grid |
| 225 | + # print('What is this?') |
| 226 | + # print(self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name]) |
| 227 | + |
| 228 | + if dataset_model is not None: |
| 229 | + galaxy_image_plane_mesh_grid_dict[galaxy] = ( |
| 230 | + self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name].subtracted_and_rotated_from( |
| 231 | + offset=dataset_model.grid_offset, |
| 232 | + angle=dataset_model.grid_rotation_angle, |
| 233 | + xp=xp |
| 234 | + ) |
| 235 | + ) |
| 236 | + else: |
| 237 | + galaxy_image_plane_mesh_grid_dict[galaxy] = ( |
| 238 | + self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] |
| 239 | + ) |
| 240 | + |
| 241 | + # if self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] is not None: |
| 242 | + # print('Ever here?') |
| 243 | + # image_plane_mesh_grid = self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] |
| 244 | + # print('Ever here 1.5?') |
| 245 | + # moved_image_plane_mesh_grid = image_plane_mesh_grid.subtracted_and_rotated_from( |
| 246 | + # offset=dataset_model.grid_offset, |
| 247 | + # angle=dataset_model.grid_rotation_angle, |
| 248 | + # xp=xp |
| 249 | + # ) |
| 250 | + # print('Ever here2?') |
| 251 | + # print("What is moved_image_plane_mesh_grid?") |
| 252 | + # print(moved_image_plane_mesh_grid) |
| 253 | + # print("==========") |
| 254 | + # galaxy_image_plane_mesh_grid_dict[galaxy] = (moved_image_plane_mesh_grid) |
| 255 | + |
| 256 | + # else: |
| 257 | + # galaxy_image_plane_mesh_grid_dict[galaxy] = ( |
| 258 | + # self.galaxy_name_image_plane_mesh_grid_dict[galaxy_name] |
| 259 | + # ) |
209 | 260 |
|
210 | 261 | return AdaptImages( |
211 | 262 | galaxy_image_dict=galaxy_image_dict, |
|
0 commit comments