From 5c620a5cdcaa28a61e937632018dfe00fab1a173 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Wed, 1 Jun 2022 11:38:54 +0200 Subject: [PATCH] finish extent logic --- halo_plot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/halo_plot.py b/halo_plot.py index 9ae4dd4..3055093 100644 --- a/halo_plot.py +++ b/halo_plot.py @@ -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)