Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
c31d6cd9
Commit
c31d6cd9
authored
13 years ago
by
Wouter Klijn
Browse files
Options
Downloads
Patches
Plain Diff
Task #3139: Add ComplexArray.py
parent
3f82a5fe
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitattributes
+1
-0
1 addition, 0 deletions
.gitattributes
CEP/Pipeline/recipes/sip/helpers/ComplexArray.py
+54
-0
54 additions, 0 deletions
CEP/Pipeline/recipes/sip/helpers/ComplexArray.py
with
55 additions
and
0 deletions
.gitattributes
+
1
−
0
View file @
c31d6cd9
...
...
@@ -1118,6 +1118,7 @@ CEP/Pipeline/recipes/sip/demixing/bbs_TauA.parset eol=lf
CEP/Pipeline/recipes/sip/demixing/bbs_TauA_smoothcal.parset eol=lf
CEP/Pipeline/recipes/sip/demixing/bbs_VirA.parset eol=lf
CEP/Pipeline/recipes/sip/demixing/bbs_VirA_smoothcal.parset eol=lf
CEP/Pipeline/recipes/sip/helpers/ComplexArray.py -text
CEP/Pipeline/recipes/sip/helpers/WritableParmDB.py -text
CEP/Pipeline/recipes/sip/helpers/__init__.py eol=lf
CEP/Pipeline/recipes/sip/helpers/metadata.py eol=lf
...
...
This diff is collapsed.
Click to expand it.
CEP/Pipeline/recipes/sip/helpers/ComplexArray.py
0 → 100644
+
54
−
0
View file @
c31d6cd9
import
numpy
# Untested copu pasta of jon swinbanks code
class
ComplexArray
(
object
):
def
__init__
(
self
):
raise
NotImplementedError
def
get_amp
(
self
):
return
numpy
.
absolute
(
numpy
.
nan_to_num
(
self
.
data
))
def
set_amp
(
self
,
new_amps
):
self
.
data
=
numpy
.
array
(
new_amps
)
*
self
.
data
/
numpy
.
absolute
(
self
.
data
)
amp
=
property
(
get_amp
,
set_amp
)
Ampl
=
amp
def
get_phase
(
self
):
return
numpy
.
angle
(
numpy
.
nan_to_num
(
self
.
data
))
def
set_phase
(
self
,
new_phase
):
self
.
data
=
numpy
.
vectorize
(
cmath
.
rect
)(
numpy
.
absolute
(
self
.
data
),
numpy
.
array
(
new_phase
)
)
phase
=
property
(
get_phase
,
set_phase
)
Phase
=
phase
def
get_real
(
self
):
return
numpy
.
real
(
numpy
.
nan_to_num
(
self
.
data
))
def
set_real
(
self
,
new_real
):
self
.
data
=
numpy
.
array
(
new_real
)
+
1j
*
numpy
.
imag
(
self
.
data
)
real
=
property
(
get_real
,
set_real
)
Real
=
real
def
get_imag
(
self
):
return
numpy
.
imag
(
numpy
.
nan_to_num
(
self
.
data
))
def
set_imag
(
self
,
new_imag
):
self
.
data
=
numpy
.
real
(
self
.
data
)
+
1j
*
numpy
.
array
(
new_imag
)
imag
=
property
(
get_imag
,
set_imag
)
Imag
=
imag
@property
def
writeable
(
self
):
return
dict
((
key
,
getattr
(
self
,
key
))
for
key
in
self
.
keys
)
class
RealImagArray
(
ComplexArray
):
keys
=
(
"
Real
"
,
"
Imag
"
)
def
__init__
(
self
,
real
,
imag
):
self
.
data
=
numpy
.
array
(
real
)
+
1j
*
numpy
.
array
(
imag
)
class
AmplPhaseArray
(
ComplexArray
):
keys
=
(
"
Ampl
"
,
"
Phase
"
)
def
__init__
(
self
,
ampl
,
phase
):
self
.
data
=
numpy
.
vectorize
(
cmath
.
rect
)(
numpy
.
array
(
ampl
),
numpy
.
array
(
phase
)
)
ARRAY_TYPES
=
[
RealImagArray
,
AmplPhaseArray
]
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