Skip to content

Commit e83f388

Browse files
committed
append_visibility frequency check
1 parent f9d43e3 commit e83f388

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎data_models/memory_data_models.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ def __init__(self,
767767
time=None, antenna1=None, antenna2=None, vis=None,
768768
weight=None, imaging_weight=None, integration_time=None,
769769
polarisation_frame=PolarisationFrame('stokesI'), cindex=None,
770-
blockvis=None):
770+
blockvis=None, source='anonymous'):
771771
"""Visibility
772772
773773
:param data:
@@ -786,6 +786,7 @@ def __init__(self,
786786
:param polarisation_frame:
787787
:param cindex:
788788
:param blockvis:
789+
:param source:
789790
"""
790791
if data is None and vis is not None:
791792
if imaging_weight is None:
@@ -829,6 +830,7 @@ def __init__(self,
829830
self.configuration = configuration # Antenna/station configuration
830831
self.polarisation_frame = polarisation_frame
831832
self.frequency_map = None
833+
self.source = source
832834

833835
def __str__(self):
834836
"""Default printer for Visibility
@@ -837,6 +839,7 @@ def __str__(self):
837839
ufrequency = numpy.unique(self.frequency)
838840
uchannel_bandwidth = numpy.unique(self.channel_bandwidth)
839841
s = "Visibility:\n"
842+
s += "\tSource: %s\n" % source
840843
s += "\tNumber of visibilities: %s\n" % self.nvis
841844
s += "\tNumber of channels: %d\n" % len(ufrequency)
842845
s += "\tFrequency: %s\n" % ufrequency
@@ -1004,6 +1007,7 @@ def __str__(self):
10041007
"""
10051008
s = "BlockVisibility:\n"
10061009
s += "\tSource %s\n" % self.source
1010+
s += "\tPhasecentre: %s\n" % self.phasecentre
10071011
s += "\tNumber of visibilities: %s\n" % self.nvis
10081012
s += "\tNumber of integrations: %s\n" % len(self.time)
10091013
s += "\tVisibility shape: %s\n" % str(self.vis.shape)
@@ -1012,7 +1016,6 @@ def __str__(self):
10121016
s += "\tChannel bandwidth: %s\n" % self.channel_bandwidth
10131017
s += "\tNumber of polarisations: %s\n" % self.npol
10141018
s += "\tPolarisation Frame: %s\n" % self.polarisation_frame.type
1015-
s += "\tPhasecentre: %s\n" % self.phasecentre
10161019
s += "\tConfiguration: %s\n" % self.configuration.name
10171020
s += "\tMetadata: %s\n" % self.meta
10181021

‎processing_components/visibility/operations.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def append_visibility(vis: Union[Visibility, BlockVisibility], othervis: Union[V
4141
assert abs(vis.phasecentre.dec.value - othervis.phasecentre.dec.value) < 1e-15, "Declinations differ"
4242
assert vis.phasecentre.separation(othervis.phasecentre).value < 1e-15, "Phasecentres differ"
4343
assert vis.source == othervis.source, "Not the same source"
44-
assert numpy.testing.assert_array_almost_equal_nulp(vis.frequency, othervis.frequency, nulp=12)
44+
if isinstance(vis, BlockVisibility):
45+
assert numpy.testing.assert_array_almost_equal_nulp(vis.frequency, othervis.frequency, nulp=12)
4546

4647
vis.data = numpy.hstack((vis.data, othervis.data))
4748
return vis

0 commit comments

Comments
 (0)