Commit 365772ff authored by Matthijs's avatar Matthijs
Browse files

masked Modulus projection;

takes 'data' if 'M' is not available
parent 36c294f5
......@@ -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
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