Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
madarrays
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
Container registry
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
skmad-suite
madarrays
Commits
690dfa66
Commit
690dfa66
authored
6 years ago
by
Florent Jaillet
Browse files
Options
Downloads
Patches
Plain Diff
Replace the _complex_entries_only decorator by the use of a simple method
parent
b9f0a0fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.cache/v/cache/lastfailed
+1
-0
1 addition, 0 deletions
.cache/v/cache/lastfailed
madarrays/mad_array.py
+13
-18
13 additions, 18 deletions
madarrays/mad_array.py
with
14 additions
and
18 deletions
.cache/v/cache/lastfailed
0 → 100644
+
1
−
0
View file @
690dfa66
{}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
madarrays/mad_array.py
+
13
−
18
View file @
690dfa66
...
...
@@ -91,16 +91,6 @@ def _merge_masks(ma1, ma2):
return
{
'
mask
'
:
np
.
logical_or
(
ma1
.
unknown_mask
,
ma2
.
unknown_mask
)}
def
_complex_masking_only
(
f
):
def
decorated
(
self
):
if
not
self
.
_complex_masking
:
errmsg
=
'
Method not defined if masking is not complex.
'
raise
ValueError
(
errmsg
)
return
f
(
self
)
decorated
.
__doc__
=
f
.
__doc__
return
decorated
UFUNC_NOT_RETURNING_MADARRAYS
=
[
'
bitwise_and
'
,
'
bitwise_or
'
,
'
bitwise_xor
'
,
'
invert
'
,
'
left_shift
'
,
'
right_shift
'
,
'
greater
'
,
'
greater_equal
'
,
'
less
'
,
...
...
@@ -429,7 +419,6 @@ class MadArray(np.ndarray):
return
np
.
copy
(
self
.
_mask
)
@property
@_complex_masking_only
def
any_unknown_mask
(
self
):
"""
Boolean mask for coefficients with unknown magnitude and/or phase.
...
...
@@ -446,10 +435,10 @@ class MadArray(np.ndarray):
ValueError
If `complex_masking` is False.
"""
self
.
_raise_if_not_complex_masking
()
return
~
(
self
.
_mask
==
0
)
@property
@_complex_masking_only
def
all_unknown_mask
(
self
):
"""
Boolean mask for coefficients with both unknown magnitude and phase.
...
...
@@ -466,10 +455,10 @@ class MadArray(np.ndarray):
ValueError
If `complex_masking` is False.
"""
self
.
_raise_if_not_complex_masking
()
return
self
.
_mask
==
3
@property
@_complex_masking_only
def
known_phase_mask
(
self
):
"""
Boolean mask for coefficients with known phase.
...
...
@@ -485,10 +474,10 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
~
np
.
logical_or
(
self
.
_mask
==
1
,
self
.
_mask
==
3
)
@property
@_complex_masking_only
def
unknown_phase_mask
(
self
):
"""
Boolean mask for coefficients with unknown phase.
...
...
@@ -504,10 +493,10 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
np
.
logical_or
(
self
.
_mask
==
1
,
self
.
_mask
==
3
)
@property
@_complex_masking_only
def
known_magnitude_mask
(
self
):
"""
Boolean mask for coefficients with known magnitude.
...
...
@@ -523,10 +512,10 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
~
np
.
logical_or
(
self
.
_mask
==
2
,
self
.
_mask
==
3
)
@property
@_complex_masking_only
def
unknown_magnitude_mask
(
self
):
"""
Boolean mask for coefficients with unknown magnitude
...
...
@@ -542,10 +531,10 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
np
.
logical_or
(
self
.
_mask
==
2
,
self
.
_mask
==
3
)
@property
@_complex_masking_only
def
unknown_phase_only_mask
(
self
):
"""
Boolean mask for coefficients with unknown phase and known magnitude.
...
...
@@ -562,10 +551,10 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
self
.
_mask
==
1
@property
@_complex_masking_only
def
unknown_magnitude_only_mask
(
self
):
"""
Boolean mask for coefficients with unknown magnitude and known phase.
...
...
@@ -582,6 +571,7 @@ class MadArray(np.ndarray):
ValueError
If masking is not complex.
"""
self
.
_raise_if_not_complex_masking
()
return
self
.
_mask
==
2
@property
...
...
@@ -620,6 +610,11 @@ class MadArray(np.ndarray):
else
:
return
np
.
average
(
self
.
unknown_mask
)
def
_raise_if_not_complex_masking
(
self
):
if
not
self
.
_complex_masking
:
errmsg
=
'
Method not defined if masking is not complex.
'
raise
ValueError
(
errmsg
)
def
is_masked
(
self
):
"""
Indicate if one or several elements are masked.
"""
return
np
.
any
(
self
.
_mask
)
...
...
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