1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00

finish extent logic

This commit is contained in:
Lukas Winkler 2022-06-01 11:38:54 +02:00
parent 4210b02941
commit 5c620a5cdc
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -16,15 +16,18 @@ from read_vr_files import read_velo_halos
def increase_extent_1d(xmin: float, xmax: float, factor: float):
xrange = xmax - xmin
xcenter = (xmax + xmin) / 2
return
return xcenter - xrange / 2 * factor, xcenter + xrange / 2 * factor
def increase_extent(extent: Extent, factor: float) -> Extent:
xmin, xmax, ymin, ymax = extent
xmin, xmax = increase_extent_1d(xmin, xmax, factor)
ymin, ymax = increase_extent_1d(ymin, ymax, factor)
return xmin, xmax, ymin, ymax
def in_extent(extent: Extent, X, Y, factor=2) -> bool:
xmin, xmax, ymin, ymax = extent
xmin, xmax, ymin, ymax = increase_extent(extent, factor)
return (xmin < X < xmax) and (ymin < Y < ymax)