Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
365772ff
Commit
365772ff
authored
Mar 27, 2020
by
Matthijs
Browse files
masked Modulus projection;
takes 'data' if 'M' is not available
parent
36c294f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/ProxOperators/P_M.py
View file @
365772ff
...
...
@@ -16,7 +16,10 @@ class P_M(ProxOperator):
config : dict - Dictionary containing the problem configuration. It must contain the following mapping:
'M' : array_like - nonegative real FOURIER DOMAIN CONSTRAINT
"""
self
.
M
=
config
[
'M'
]
try
:
self
.
M
=
config
[
'M'
]
except
KeyError
:
self
.
M
=
config
[
'data'
]
def
work
(
self
,
u
):
"""
...
...
@@ -31,6 +34,41 @@ class P_M(ProxOperator):
array_like - [p_M,phat_M] ,where p_M = the projection IN THE PHYSICAL (time) DOMAIN and phat_M = projection IN THE FOURIER DOMAIN
"""
m
=
self
.
M
a
=
np
.
fft
.
fft2
(
u
,
axes
=
None
)
a
=
np
.
fft
.
fft2
(
u
,
axes
=
None
)
b
=
magproj
(
a
,
m
)
return
np
.
fft
.
ifft2
(
b
,
axes
=
None
)
return
np
.
fft
.
ifft2
(
b
,
axes
=
None
)
class
P_M_masked
(
P_M
):
"""
Projection onto Fourier magnitude constraints, leaving alone points masked by 'data_zeros'
"""
def
__init__
(
self
,
config
):
"""
Initialization
Parameters
----------
config : dict - Dictionary containing the problem configuration. It must contain the following mapping:
'M' : array_like - nonegative real FOURIER DOMAIN CONSTRAINT
'data_zeros': array_like, true for masked points, false for non-masked points (where the measurement can be applied).
"""
super
(
P_M_masked
,
self
).
__init__
(
config
)
self
.
mask
=
config
[
'data_zeros'
]
def
work
(
self
,
u
):
"""
Applies the proxoperator P_M_masked
Parameters
----------
u : array_like - function in the physical domain to be projected
Returns
-------
array_like - p_M: the projection IN THE PHYSICAL (time) DOMAIN
"""
constrained
=
super
(
P_M_masked
,
self
).
work
(
u
)
update
=
np
.
where
(
self
.
mask
,
u
,
constrained
)
return
update
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment