Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_galaxies(cls, galaxies, cosmology=cosmo.Planck15):
plane_redshifts = plane_util.ordered_plane_redshifts_from(galaxies=galaxies)
galaxies_in_planes = plane_util.galaxies_in_redshift_ordered_planes_from(
galaxies=galaxies, plane_redshifts=plane_redshifts
)
planes = []
for plane_index in range(0, len(plane_redshifts)):
planes.append(
pl.Plane(galaxies=galaxies_in_planes[plane_index], cosmology=cosmology)
)
return Tracer(planes=planes, cosmology=cosmology)
source_plane_redshift=source_galaxies[0].redshift,
)
galaxies_in_planes = plane_util.galaxies_in_redshift_ordered_planes_from(
galaxies=lens_galaxies + line_of_sight_galaxies,
plane_redshifts=plane_redshifts,
)
plane_redshifts.append(source_galaxies[0].redshift)
galaxies_in_planes.append(source_galaxies)
planes = []
for plane_index in range(0, len(plane_redshifts)):
planes.append(
pl.Plane(
redshift=plane_redshifts[plane_index],
galaxies=galaxies_in_planes[plane_index],
cosmology=cosmology,
)
)
return Tracer(planes=planes, cosmology=cosmology)
]
if plane_index_with_redshift:
return self.traced_grids_of_planes_from_grid(grid=grid)[
plane_index_with_redshift[0]
]
for plane_index, plane_redshift in enumerate(self.plane_redshifts):
if redshift < plane_redshift:
plane_index_insert = plane_index
planes = self.planes
planes.insert(
plane_index_insert,
pl.Plane(redshift=redshift, galaxies=[], cosmology=self.cosmology),
)
tracer = Tracer(planes=planes, cosmology=self.cosmology)
return tracer.traced_grids_of_planes_from_grid(grid=grid)[plane_index_insert]