Skip to content

Commit

Permalink
Add an Nants_telescope property to UVData for eq_coeffs
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed May 1, 2024
1 parent 123772c commit 60a2c2a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyuvdata/uvbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ def __iter__(self, uvparams_only=True):
"""
if uvparams_only:
attribute_list = [
a for a in dir(self) if isinstance(getattr(self, a), uvp.UVParameter)
a
for a in dir(self)
if a.startswith("_") and isinstance(getattr(self, a), uvp.UVParameter)
]
else:
attribute_list = [
Expand Down
4 changes: 4 additions & 0 deletions pyuvdata/uvcal/uvcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,10 @@ def check(
"2.5",
DeprecationWarning,
)

# call metadata_only to make sure that parameter requirements are set properly
self.metadata_only

# first run the basic check from UVBase
super(UVCal, self).check(
check_extra=check_extra, run_check_acceptability=run_check_acceptability
Expand Down
20 changes: 20 additions & 0 deletions pyuvdata/uvdata/uvdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,23 @@ def _set_telescope_requirements(self):
self.telescope._instrument.required = True
self.telescope._x_orientation.required = False

# This is required for eq_coeffs, which has Nants_telescope as one of its
# shapes. That's to allow us to line up the antenna_numbers/names with
# eq_coeffs so that we know which antenna each eq_coeff goes with.
@property
def Nants_telescope(self):
"""
The number of antennas in the telescope.

This property is stored on the Telescope object internally.
"""
return self._telescope.value.Nants

# TODO: do we want a setter on UVData for this?
@Nants_telescope.setter
def Nants_telescope(self, val):
self._telescope.value.Nants = val

Check warning on line 715 in pyuvdata/uvdata/uvdata.py

View check run for this annotation

Codecov / codecov/patch

pyuvdata/uvdata/uvdata.py#L715

Added line #L715 was not covered by tests

@staticmethod
def _clear_antpair2ind_cache(obj):
"""Clear the antpair2ind cache."""
Expand Down Expand Up @@ -2589,6 +2606,9 @@ def check(
"All values in the flex_spw_id_array must exist in the spw_array."
)

# call metadata_only to make sure that parameter requirements are set properly
self.metadata_only

# first run the basic check from UVBase

logger.debug("Doing UVBase check...")
Expand Down

0 comments on commit 60a2c2a

Please sign in to comment.