Commit ae0f1ec6 authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Included various necessary import statements in CDP_processor

parent efa6476f
from numpy.random import randn, random_sample
from numpy.linalg import norm
from numpy import sqrt, conj, fft, tile
import numpy as np
def CDP_processor(config):
# Implementation of the Wirtinger Flow (WF) algorithm presented in the paper
# "Phase Retrieval via Wirtinger Flow: Theory and Algorithms"
......@@ -11,10 +16,10 @@ def CDP_processor(config):
## Make image
n1 = config['Ny']
n2 = config['Nx'] # for 1D signals, this will be 1
x = randn((n1,n2)) + 1j*randn((n1,n2))
x = randn(n1,n2) + 1j*randn(n1,n2)
config['truth']=x
config['norm_truth']=norm(x,'fro')
config['truth_dim'] = s.shape
config['truth_dim'] = x.shape
## Make masks and linear sampling operators
......@@ -31,7 +36,7 @@ def CDP_processor(config):
Masks[:,:,ll] = np.random.choice(np.array([1j, -1j, 1, -1]),(n1,n2))
# Sample magnitudes and make masks
temp = rand(Masks.shape);
temp = random_sample(Masks.shape) #works like rand but accepts tuple as argument
Masks = Masks * ( (temp <= 0.2)*sqrt(3) + (temp > 0.2)/sqrt(2) )
config['Masks'] = conj(Masks)
# Saving the conjugate of the mask saves on computing the conjugate
......
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