Skip to content

Commit

Permalink
Add a UVBeam.new method similar to the ones on UVData and UVCal
Browse files Browse the repository at this point in the history
Deprecate the unused `spw_array` and `Nspws` attributes on UVBeam.

Deprecate the `UVBeam.freq_interp_kind` attribute in favor of a parameter on the interp method.

Deprecate upper case strings in UVBeam.feed_array
  • Loading branch information
bhazelton committed Jan 22, 2024
1 parent 7790d06 commit a453036
Show file tree
Hide file tree
Showing 13 changed files with 959 additions and 136 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

### Added
- A new `freq_interp_kind` parameter to `UVBeam.interp`, `UVBeam._interp_az_za_rect_spline`
and `UVBeam._interp_healpix_bilinear` to allow the frequency interpolation
specification to be passed into the methods. Note this defaults to "cubic" rather
than "linear" (the old default for the attribute of the same name on UVBeam objects)
because several groups have found that a linear interpolation leads to nasty
artifacts in visibility simulations for EoR applications.
- A new `UVBeam.new()` method (based on new function `new_uvbeam`) that creates a new,
self-consistent `UVBeam` object from scratch from a set of flexible input parameters.
- Added a the `UVData.update_antenna_positions` method to enable making antenna
position updates with corresponding updates the uvw-coordinates and visibility phases.
- Added a switch to `UVData.write_ms` called `flip_conj`, which allows a user to write
Expand Down Expand Up @@ -32,6 +40,12 @@ tolerance value to be user-specified.
Additionally, failing this check results in a warning (was an error).

### Deprecated
- The `freq_interp_kind` attribute on UVBeams.
- The `spw_array` and `Nspws` attributes on UVBeam objects. Also the
`unset_spw_params` and `set_spw_params` parameters to the `use_future_array_shapes`
and `use_current_array_shapes` methods on UVBeam objects.
- Upper case feed names (e.g. "N" or "E") in UVBeam.feed_array. This was never
fully tested and didn't work properly.
- Having `freq_range` defined on non-wide-band gain style UVCal objects.
- Having `freq_array` and `channel_width` defined on wide-band UVCal objects.

Expand Down
17 changes: 1 addition & 16 deletions pyuvdata/uvbeam/beamfits.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ def read_beamfits(
"UVBeam does not support having a spectral window axis "
"larger than one."
)
if not use_future_array_shapes:
self.Nspws = 1
self.spw_array = np.array([0])

if n_dimensions > ax_nums["basisvec"] - 1:
if (
Expand All @@ -268,12 +265,7 @@ def read_beamfits(
"NAXIS" + str(ax_nums["basisvec"]), None
)

if (
self.Nspws is None or self.Naxes_vec is None
) and self.beam_type == "power":
if self.Nspws is None and not use_future_array_shapes:
self.Nspws = 1
self.spw_array = np.array([0])
if self.Naxes_vec is None and self.beam_type == "power":
if self.Naxes_vec is None:
self.Naxes_vec = 1

Expand Down Expand Up @@ -365,7 +357,6 @@ def read_beamfits(
self.model_name = primary_header.pop("MODEL", None)
self.model_version = primary_header.pop("MODELVER", None)
self.x_orientation = primary_header.pop("XORIENT", None)
self.freq_interp_kind = primary_header.pop("FINTERP", None)

self.history = str(primary_header.get("HISTORY", ""))
if not uvutils._check_history_version(
Expand Down Expand Up @@ -663,12 +654,6 @@ def write_beamfits(
if self.x_orientation is not None:
primary_header["XORIENT"] = self.x_orientation

if self.freq_interp_kind is not None:
primary_header["FINTERP"] = (
self.freq_interp_kind,
"frequency " "interpolation kind (scipy interp1d)",
)

if self.beam_type == "efield":
primary_header["FEEDLIST"] = "[" + ", ".join(self.feed_array) + "]"

Expand Down
3 changes: 0 additions & 3 deletions pyuvdata/uvbeam/cst_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ def read_cst_beam(
self.freq_array = np.zeros((1, self.Nfreqs))
self.bandpass_array = np.zeros((1, self.Nfreqs))

if not use_future_array_shapes:
self.Nspws = 1
self.spw_array = np.array([0])
self.pixel_coordinate_system = "az_za"
self._set_cs_params()

Expand Down
Loading

0 comments on commit a453036

Please sign in to comment.