Skip to content

Commit

Permalink
pycraf.antenna: fix imt2020_composite_pattern tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinkel committed Aug 15, 2017
1 parent 678f193 commit e1b58fa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pycraf.pathprof
ellipsoid. Only rectangular limits (absolute coordinates) are supported.
This can be used to determine the area of SRTM pixels (in km^2).

pycraf.antenna
^^^^^^^^^^^^^^^
- Add correlation-level parameter to `imt2020_composite_pattern` function.


0.25.3 (2017-08-09)
====================
Expand Down
4 changes: 2 additions & 2 deletions pycraf/antenna/imt.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ def imt2020_composite_pattern(
[dimless]
N_H, N_V : int
Horizontal/Vertical number of single antenna elements
rho : float, optional
Correlation level (see 3GPP TR 37.840, 5.4.4.1.4, default: 1)
rho : `~astropy.units.Quantity`, optional
Correlation level (see 3GPP TR 37.840, 5.4.4.1.4, default: 1) [dimless]
Returns
-------
Expand Down
53 changes: 43 additions & 10 deletions pycraf/antenna/tests/test_antenna.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def test_imt2020_composite_pattern():
# not working:
# check_astro_quantities(imt.imt2020_composite_pattern, args_list)

azims = np.arange(-180, 180, 0.5)[::200] * apu.deg
elevs = np.arange(-90, 90, 0.5)[::100] * apu.deg
azims = np.linspace(-170, 170, 7) * apu.deg
elevs = np.linspace(-65, 65, 4) * apu.deg

# BS (outdoor) according to IMT.PARAMETER table 10 (multipage!)
G_Emax = 5 * cnv.dB
Expand All @@ -179,10 +179,13 @@ def test_imt2020_composite_pattern():
assert_quantity_allclose(
gains_array,
[
[-3.3119858e+02, -2.3773064e+01, -1.5343370e+01, -2.4861577e+01],
[-3.4144141e+02, -5.9032086e+01, -3.0494818e+01, -5.8627716e+01],
[-3.4980321e+02, -2.6020485e+01, 7.2968710e-02, -1.4303173e+01],
[-3.2730426e+02, -4.1613638e+01, -3.3511436e+01, -4.1442556e+01]
[-26.84474397, -26.78742409, -26.78742337, -26.84474599],
[-38.93066406, -37.95333672, -37.95333672, -38.93066406],
[-29.54158595, -27.4920591, -27.4920591, -29.54159263],
[-7.59590143, 8.86832778, 8.86832778, -7.59590143],
[-29.54159263, -27.4920591, -27.4920591, -29.54158595],
[-38.93066406, -37.95333672, -37.95333672, -38.93066406],
[-26.84474599, -26.78742337, -26.78742409, -26.84474397]
] * cnv.dB,
atol=1.e-2 * cnv.dB, rtol=1.e-4,
)
Expand All @@ -202,10 +205,40 @@ def test_imt2020_composite_pattern():
assert_quantity_allclose(
gains_array,
[
[-71.65367508, -48.39750099, -51.72422600, -53.09899139],
[-71.65367508, -34.74055308, -42.48623672, -23.25435181],
[-65.79568691, -37.13879018, -14.86999894, -23.49184427],
[-71.65367508, -38.27782536, -41.34740448, -44.02411652]
[-38.41604328, -23.76623774, -37.31241322, -40.32924271],
[-26.08025503, -22.76059723, -36.30677032, -27.99344826],
[-19.27646115, -7.04822194, -20.59439408, -21.18965438],
[-34.2128334, -9.48487504, -23.03104146, -36.12606049],
[-33.92118076, -26.211614, -39.75806176, -35.83437732],
[-41.83896255, -27.74344563, -41.28961372, -43.75215149],
[-43.43812561, -26.77295995, -40.31912613, -45.35131454]
] * cnv.dB
)

# test rho
rho = 50 * apu.percent

gains_array = imt.imt2020_composite_pattern(
azims[:, np.newaxis], elevs[np.newaxis],
azim_i, elev_j,
G_Emax,
A_m, SLA_nu,
azim_3db, elev_3db,
d_H, d_V,
N_H, N_V,
rho,
)

assert_quantity_allclose(
gains_array,
[
[-27.81689191, -24.33945388, -27.76250386, -27.88482141],
[-25.50662625, -23.73752856, -27.70019412, -26.24376309],
[-17.4177759, -6.17815893, -8.33298694, -17.95386317],
[-10.00205684, 0.8616368, 0.66564671, -10.00499249],
[-19.05914643, -8.42762696, -8.46233689, -19.08447626],
[-27.92129159, -26.15860176, -27.9094286, -27.95279717],
[-27.94851589, -25.79662728, -27.88453221, -27.97042871]
] * cnv.dB
)

Expand Down

0 comments on commit e1b58fa

Please sign in to comment.