-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better approach for testing the AnalyticBeam plugin code
- Loading branch information
Showing
3 changed files
with
87 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2024 Radio Astronomy Software Group | ||
# Licensed under the 2-clause BSD License | ||
"""Define an AnalyticBeam subclass for testing the AnalyticBeam plugin code.""" | ||
|
||
from dataclasses import InitVar, dataclass, field | ||
from typing import Literal | ||
|
||
import numpy.typing as npt | ||
|
||
from ..uvbeam.analytic_beam import AnalyticBeam | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class AnalyticTest(AnalyticBeam): | ||
"""A test class to support testing the AnalyticBeam plugin code.""" | ||
|
||
radius: float | ||
feed_array: npt.NDArray[str] | None = field(default=None, repr=False, compare=False) | ||
x_orientation: Literal["east", "north"] = field( | ||
default="east", repr=False, compare=False | ||
) | ||
|
||
include_cross_pols: InitVar[bool] = True | ||
|
||
basis_vector_type = "az_za" | ||
|
||
def _efield_eval( | ||
self, | ||
*, | ||
az_array: npt.NDArray[float], | ||
za_array: npt.NDArray[float], | ||
freq_array: npt.NDArray[float], | ||
) -> npt.NDArray[float]: | ||
"""Evaluate the efield at the given coordinates.""" | ||
data_array = self._get_empty_data_array(az_array.size, freq_array.size) | ||
|
||
return data_array | ||
|
||
def _power_eval( | ||
self, | ||
*, | ||
az_array: npt.NDArray[float], | ||
za_array: npt.NDArray[float], | ||
freq_array: npt.NDArray[float], | ||
) -> npt.NDArray[float]: | ||
"""Evaluate the power at the given coordinates.""" | ||
data_array = self._get_empty_data_array( | ||
az_array.size, freq_array.size, beam_type="power" | ||
) | ||
|
||
return data_array | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters