Source
636
636
637
637
if line.strip().endswith('/'):
638
638
break
639
639
continue
640
640
return
641
641
642
642
def get_spw_ranges(self):
643
643
# Get ranges for each spectral window
644
644
try:
645
645
tb.open(f'{self.vis}/SPECTRAL_WINDOW')
646
-
print(self.spws)
646
+
#print(self.spws)
647
647
for spw in self.spws:
648
648
chan_freq = tb.getcol('CHAN_FREQ')[:,spw]
649
649
min_freq = min(chan_freq) / (1e6)
650
650
max_freq = max(chan_freq) / (1e6)
651
651
self.spw_ranges[spw] = (min_freq, max_freq)
652
652
tb.close()
653
653
except Exception as e:
654
654
print("ERROR FAILED TO GET SPW FREQ RANGES")
655
655
656
656
def check_which_spw(self, freq):
657
657
in_spw = []
658
658
for spw, ranges in self.spw_ranges.items():
659
659
if ranges[0] >= freq[0] and ranges[1] <= freq[1]:
660
660
in_spw.append(spw)
661
661
# If there is no spw that this belongs to default to what we were setting this value to before
662
662
if not in_spw:
663
663
print("WARNING: NO CORRESPONDING SPW FOUND FOR FREQ {}".format(freq))
664
664
return [-1]
665
665
else:
666
-
print('SELECTED SPWS: ', in_spw)
666
+
#print('SELECTED SPWS: ', in_spw)
667
667
return in_spw
668
668
669
669
def process_gc(self, infp, keys):
670
670
antenna_name = find_antenna(keys[0], self.gain_keys)
671
671
if not antenna_name:
672
672
print('Antenna missing from GAIN group')
673
673
skip_values(infp)
674
674
return
675
675
try:
676
676
antenna = get_antenna_index(antenna_name, self.ant_names)
677
677
except:
678
678
print('Antenna %s not present in FITS-IDI file' % antenna_name)
679
679
skip_values(infp)
680
680
return
681
681
keys = dict(keys[0])
682
682
683
683
try:
684
-
print('FREQ: ', keys['FREQ'])
684
+
#print('FREQ: ', keys['FREQ'])
685
685
686
686
self.get_spw_ranges()
687
687
spw_ids = self.check_which_spw(keys['FREQ'])
688
688
except Exception as e:
689
689
spw_ids = [-1]
690
690
print('ANTAB HAS NO FREQ INFORMATION DEFAULTING TO FREQ ID -1')
691
691
692
692
dpfu = {}
693
693
try:
694
694
dpfu['R'] = keys['DPFU'][0]