How to use the autoarray.structures.grids function in autoarray

To help you get started, we’ve selected a few autoarray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jammy2211 / PyAutoLens / autolens / lens / plane.py View on Github external
def light_profile_centres(self):
        """Returns the light profile centres of the plane as a *Coordinates* object, which structures the centres
        in lists according to which galaxy they come from.

        Fo example, if a plane has two galaxies, the first with one light profile and second with two light profiles
        this  returns:

        [[(y0, x0)], [(y0, x0), (y1, x1)]]
        
        This is used for visualization, for example plotting the centres of all light profiles colored by their galaxy.
        """
        return grids.Coordinates(
            [
                list(galaxy.light_profile_centres)
                for galaxy in self.galaxies
                if galaxy.has_light_profile
            ]
github Jammy2211 / PyAutoLens / autolens / lens / ray_tracing.py View on Github external
def light_profile_centres(self):
        """Returns the light profile centres of the tracer as a *GridCoordinates* object, which structures the centres
        in lists according to which plane they come from.

        Fo example, if the tracer has two planes, the first with one light profile and second with two light profiles
        this returns:

        [[(y0, x0)], [(y0, x0), (y1, x1)]]

        This is used for visualization, for example plotting the centres of all light profiles colored by their galaxy.

        The centres of light-sheets are filtered out, as their centres are not relevant to lensing calculations

        """
        return grids.GridCoordinates(
            [
                list(plane.light_profile_centres)
                for plane in self.planes
                if plane.has_light_profile
            ]
github Jammy2211 / PyAutoLens / autolens / lens / ray_tracing.py View on Github external
    @grids.grid_like_to_structure_list
    def images_of_planes_from_grid(self, grid):

        traced_grids_of_planes = self.traced_grids_of_planes_from_grid(
            grid=grid, plane_index_limit=self.upper_plane_index_with_light_profile
        )

        images_of_planes = [
            self.planes[plane_index].image_from_grid(
                grid=traced_grids_of_planes[plane_index]
            )
            for plane_index in range(len(traced_grids_of_planes))
        ]

        if self.upper_plane_index_with_light_profile < self.total_planes - 1:
            for plane_index in range(
                self.upper_plane_index_with_light_profile, self.total_planes - 1
github Jammy2211 / PyAutoLens / autolens / lens / ray_tracing.py View on Github external
    @grids.grid_like_to_structure
    def image_from_grid(self, grid):
        return sum(self.images_of_planes_from_grid(grid=grid))
github Jammy2211 / PyAutoLens / autolens / pipeline / phase / abstract / result.py View on Github external
def source_plane_centres(self) -> grids.GridCoordinates:
        """Combine the source-plane light profile and inversion centres (see above) into a single list of source-plane
        centres.

        These centres are used by automatic position updating to determine the multiple-images of a best-fit lens model
        (and thus tracer) by back-tracing the centres to the image plane via the mass model."""

        centres = list(self.source_plane_light_profile_centres) + list(
            self.source_plane_inversion_centres
        )

        return grids.GridCoordinates(coordinates=centres)