From b4c2543fc9ca9e71cd0fe77d9f8552869fd7bb7d Mon Sep 17 00:00:00 2001 From: Philipp Arras <parras@mpa-garching.mpg.de> Date: Thu, 2 Sep 2021 11:56:00 +0200 Subject: [PATCH] Observation: actually slice during loading --- resolve/data/observation.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/resolve/data/observation.py b/resolve/data/observation.py index b9b2b7f4..b4fe3301 100644 --- a/resolve/data/observation.py +++ b/resolve/data/observation.py @@ -334,13 +334,23 @@ class Observation(BaseObservation): antpos.append(val) pol = Polarization.from_list(dct["polarization"]) direction = Direction.from_list(dct["direction"]) - slc = slice(None) if lo_hi_index is None else slice(*lo_hi_index) + if lo_hi_index is None: + vis = dct["vis"] + weight = dct["weight"] + freq = dct["freq"] + else: + slc = slice(*lo_hi_index) + # Convert view into its own array + vis = dct["vis"][..., slc].copy() + weight = dct["weight"][..., slc].copy() + freq = dct["freq"][slc].copy() + del dct return Observation( AntennaPositions.from_list(antpos), - dct["vis"][..., slc], - dct["weight"][..., slc], + vis, + weight, pol, - dct["freq"][slc], + freq, direction, ) -- GitLab