From e2c3aa20e7400b610866a86ff718953f8b825c65 Mon Sep 17 00:00:00 2001 From: bmarcote Date: Mon, 19 Dec 2022 15:14:24 +0100 Subject: [PATCH] More robust with missing stations --- evn_postprocess/experiment.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/evn_postprocess/experiment.py b/evn_postprocess/experiment.py index e725269..c0797ed 100644 --- a/evn_postprocess/experiment.py +++ b/evn_postprocess/experiment.py @@ -805,8 +805,11 @@ def get_setup_from_ms(self): ant_subband[antenna_name].add(spw) for antenna_name in self.antennas.names: - a_pass.antennas[antenna_name].subbands = tuple(ant_subband[antenna_name]) - a_pass.antennas[antenna_name].observed = len(a_pass.antennas[antenna_name].subbands) > 0 + try: + a_pass.antennas[antenna_name].subbands = tuple(ant_subband[antenna_name]) + a_pass.antennas[antenna_name].observed = len(a_pass.antennas[antenna_name].subbands) > 0 + except ValueError: + print(f"Antenna {antenna_name} in list not present in {a_pass.msfile}.") # Takes the predefined "best" antennas as reference if len(self.refant) == 0: @@ -829,8 +832,11 @@ def get_setup_from_ms(self): print(f"WARNING: {a_pass.msfile} not found.") for antenna_name in self.antennas.names: - self.antennas[antenna_name].observed = any([cp.antennas[antenna_name].observed \ - for cp in self.correlator_passes]) + try: + self.antennas[antenna_name].observed = any([cp.antennas[antenna_name].observed \ + for cp in self.correlator_passes]) + except ValueError: + print(f"Antenna {antenna_name} in list not present in {a_pass.msfile}.") def parse_expsum(self): """Parses the .expsum file associated to the experiment to get different