Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nulling-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
smadani2
nulling-python
Commits
800199d6
Commit
800199d6
authored
4 years ago
by
Sepehr Madani
Browse files
Options
Downloads
Patches
Plain Diff
Fixed relative import, formatting
parent
651dee88
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/pattern.py
+44
-17
44 additions, 17 deletions
utils/pattern.py
with
44 additions
and
17 deletions
utils/pattern.py
+
44
−
17
View file @
800199d6
from
converter
import
deg_to_u
,
range_in_deg
from
cmath
import
exp
from
cmath
import
exp
from
math
import
radians
,
pi
from
math
import
pi
,
radians
def
compute_pattern
(
res
=
0.1
,
N
=
16
,
k
=
1
,
weights
=
None
,
single_patterns
=
None
,
calibration
=
None
,
degrees
=
None
):
from
.converter
import
deg_to_u
,
range_in_deg
def
compute_pattern
(
res
=
0.1
,
N
=
16
,
k
=
1
,
weights
=
None
,
single_patterns
=
None
,
calibration
=
None
,
degrees
=
None
,
):
"""
Computes the pattern absolute value of the given parameters.
"""
Computes the pattern absolute value of the given parameters.
res: the computation resolution.
res: the computation resolution.
...
@@ -16,14 +26,28 @@ def compute_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=None, cali
...
@@ -16,14 +26,28 @@ def compute_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=None, cali
calibration values are assumed to be in degrees.
calibration values are assumed to be in degrees.
"""
"""
single_pattern
=
compute_single_pattern
(
res
=
res
,
N
=
N
,
k
=
k
,
weights
=
weights
,
\
single_pattern
=
compute_single_pattern
(
single_patterns
=
single_patterns
,
calibration
=
calibration
,
degrees
=
degrees
)
res
=
res
,
N
=
N
,
pattern
=
[
abs
(
sum
(
pattern_i
))
for
pattern_i
in
single_pattern
]
k
=
k
,
weights
=
weights
,
single_patterns
=
single_patterns
,
calibration
=
calibration
,
degrees
=
degrees
,
)
pattern
=
[
abs
(
sum
(
pattern_i
))
for
pattern_i
in
single_pattern
]
return
pattern
return
pattern
def
compute_single_pattern
(
res
=
0.1
,
N
=
16
,
k
=
1
,
weights
=
None
,
single_patterns
=
None
,
calibration
=
None
,
degrees
=
None
):
def
compute_single_pattern
(
res
=
0.1
,
N
=
16
,
k
=
1
,
weights
=
None
,
single_patterns
=
None
,
calibration
=
None
,
degrees
=
None
,
):
"""
Computes the single pattern of each of the antennas given the parameters in a nested list.
"""
Computes the single pattern of each of the antennas given the parameters in a nested list.
see compute_pattern for more details.
see compute_pattern for more details.
"""
"""
...
@@ -31,7 +55,7 @@ def compute_single_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=Non
...
@@ -31,7 +55,7 @@ def compute_single_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=Non
degrees
=
range_in_deg
(
res
)
degrees
=
range_in_deg
(
res
)
total_length
=
len
(
degrees
)
total_length
=
len
(
degrees
)
if
weights
is
None
:
if
weights
is
None
:
weights
=
[
1
]
*
N
weights
=
[
1
]
*
N
if
single_patterns
is
None
:
if
single_patterns
is
None
:
...
@@ -42,17 +66,20 @@ def compute_single_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=Non
...
@@ -42,17 +66,20 @@ def compute_single_pattern(res=0.1, N=16, k=1, weights=None, single_patterns=Non
cos_degs
=
deg_to_u
(
degrees
)
cos_degs
=
deg_to_u
(
degrees
)
calibration_rad
=
[
radians
(
x
)
for
x
in
calibration
]
calibration_rad
=
[
radians
(
x
)
for
x
in
calibration
]
assert
len
(
weights
)
==
len
(
calibration
)
==
len
(
single_patterns
)
==
N
,
\
assert
(
"
some vector here has the wrong length! (weights, calibration, single_patterns)
"
len
(
weights
)
==
len
(
calibration
)
==
len
(
single_patterns
)
==
N
),
"
some vector here has the wrong length! (weights, calibration, single_patterns)
"
single_pattern
=
[[
weights
[
ant_i
]
*
exp
(
-
1j
*
(
k
*
pi
*
u
*
ant_i
-
calibration_rad
[
ant_i
]))
\
for
ant_i
in
range
(
N
)]
for
u
in
cos_degs
]
single_pattern
=
[
[
weights
[
ant_i
]
*
exp
(
-
1j
*
(
k
*
pi
*
u
*
ant_i
-
calibration_rad
[
ant_i
]))
for
ant_i
in
range
(
N
)
]
for
u
in
cos_degs
]
return
single_pattern
return
single_pattern
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
print
(
compute_pattern
())
print
(
compute_pattern
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment