Commit f46bfd4e authored by robin.requadt's avatar robin.requadt
Browse files

Upload New File : P_M.py

parent cb0297bc
from proxoperators import ProxOperator
import numpy as np
class P_M(ProxOperator):
"""
Projection onto Fourier magnitude constraints
"""
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
"""
self.M = config['M']
def work(self,u):
"""
Applies the proxoperator P_M
Parameters
----------
u : array_like - function in the physical domain to be projected
Returns
-------
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 = eval('np.fft.fft2(u)')
b = eval('magproj(a,m)')
return eval('np.fft.ifft2(b)')
Supports Markdown
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