Commit 1dafc462 authored by Andreas Theodosiou's avatar Andreas Theodosiou 🐧
Browse files

Merge branch 'develop' into 'master'

Release 0.2.1 to fix #3

Closes #3

See merge request !14
parents 610bf39f 0b0515fc
......@@ -299,7 +299,7 @@ class KeplerianOrbit(object):
return omega_per_dot
def __calc_orb(self, verbose=True):
def __calc_orb(self, verbose=False):
# define constants
omega_earth = const.omega_earth # omega earth
......
......@@ -3,7 +3,7 @@
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
import collections
import collections.abc
import copy
import numpy as np
......@@ -32,7 +32,7 @@ class OrbitParameters:
op = copy.copy(self)
op_vars = vars(op)
for k in op_vars:
if isinstance(op_vars[k], (collections.Sequence, np.ndarray)):
if isinstance(op_vars[k], (collections.abc.Sequence, np.ndarray)):
op_vars[k] = op_vars[k][key]
return op
......
......@@ -577,7 +577,7 @@ class pattern:
if left as None then the beamwidth is
calculated from the L
squint :
Azimuth pointing, in degree. Defaults to 9.
Azimuth pointing, in degree. Defaults to 0.
el0 :
Elevation pointing w.r.t. boresight, in degree.
Defaults to 0.
......
......@@ -717,6 +717,26 @@ def calc_aasr(
else:
we_tx = 1
if tx_ant is None:
tx_az_phase_attr = "wa_tx_phase_%i" % int(swth + 1)
tx_el_phase_attr = "we_tx_phase_%i" % int(swth + 1)
mcnf = getattr(conf, modename)
if hasattr(mcnf, tx_el_phase_attr):
we_tx = np.exp(1j * np.radians(getattr(mcnf, tx_el_phase_attr)))
# print(np.angle(we_tx))
info.msg(
"calc_nesz: applying elevation weighting to tx pattern!", 1
)
el0 = 0 # Pointing given in phase!
else:
we_tx = 1
el0 = np.degrees(np.mean(la_v)) - txcnf.tilt
# PLD 20220114 Adding code for azimuth beam spoiling
if hasattr(mcnf, tx_az_phase_attr):
info.msg("Applying azimuth phase spoiling. This will probably not work with azimuth steeing modes", 1)
wa_tx = np.exp(1j * np.radians(getattr(mcnf, tx_az_phase_attr)))
# print(np.angle(we_tx))
az0 = 0 # Pointing given in phase!
if hasattr(txcnf, "element_pattern"):
if type(txcnf.element_pattern) == list:
rel_ant = []
......@@ -757,7 +777,7 @@ def calc_aasr(
type_e=txcnf.type_e,
La=txcnf.La,
Le=txcnf.Le,
el0=(np.degrees(np.mean(la_v)) - txcnf.tilt),
el0=el0,
Nel_a=txcnf.Na,
Nel_e=txcnf.Ne,
wa=wa_tx,
......@@ -1327,7 +1347,7 @@ def calc_nesz(
Parameters
----------
conf :
configuration trampa.io.cfg.ConfigFile object with
configuration drama.io.cfg.ConfigFile object with
configuration read from parameter file
modename :
name of section in configuration file describing
......@@ -1433,10 +1453,11 @@ def calc_nesz(
else:
wa_tx = 1
if tx_ant is None:
tx_phase_attr = "w_tx_phase_%i" % int(swth + 1)
tx_az_phase_attr = "wa_tx_phase_%i" % int(swth + 1)
tx_el_phase_attr = "we_tx_phase_%i" % int(swth + 1)
mcnf = getattr(conf, modename)
if hasattr(mcnf, tx_phase_attr):
we_tx = np.exp(1j * np.radians(getattr(mcnf, tx_phase_attr)))
if hasattr(mcnf, tx_el_phase_attr):
we_tx = np.exp(1j * np.radians(getattr(mcnf, tx_el_phase_attr)))
# print(np.angle(we_tx))
info.msg(
"calc_nesz: applying elevation weighting to tx pattern!", 1
......@@ -1445,6 +1466,17 @@ def calc_nesz(
else:
we_tx = 1
el0 = np.degrees(np.mean(la_v)) - txcnf.tilt
# PLD 20220114 Adding code for azimuth beam spoiling
if hasattr(mcnf, tx_az_phase_attr):
info.msg("Applying azimuth phase spoiling. This will probably not work with azimuth steeing modes", 1)
wa_tx = np.exp(1j * np.radians(getattr(mcnf, tx_az_phase_attr)))
# print(np.angle(we_tx))
info.msg(
"calc_nesz: applying elevation weighting to tx pattern!", 1
)
az0 = 0 # Pointing given in phase!
if hasattr(txcnf, "element_pattern"):
if type(txcnf.element_pattern) == list:
el_ant = []
......
[metadata]
name = drama
version = 0.2
version = 0.2.1
author = Paco López-Dekker
author_email = F.LopezDekker@tudelft.nl
description = Delft Radar Modelling and perfornance Analysis (DRaMA)
......
......@@ -206,3 +206,15 @@ class TestJ2_Kepler(unittest.TestCase):
r_eci_expected = np.array([self.r_2h, self.r_3h])
np.testing.assert_allclose(r_eci / 1e3, r_eci_expected, atol=self.r_eci_atol)
def test_OrbitalParameters_indexing(self):
"""Test the indexing of the OrbitalParameters instance returned by j2_keppler.
"""
delta_t = np.array([2, 3]) * 3600
_, orb_p = d_two_body.j2_kepler(
delta_t, self.a, self.e, self.i, self.raan, self.arg_p, self.true_anomaly
)
_, orb_p_at_2h = d_two_body.j2_kepler(
delta_t[0], self.a, self.e, self.i, self.raan, self.arg_p, self.true_anomaly
)
np.testing.assert_allclose(orb_p[0].arg_p, orb_p_at_2h.arg_p, atol=self.r_eci_atol)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment