Commit 6cbdf264 authored by jansen31's avatar jansen31
Browse files

changed to import numpy.fft as fft, can change to scipy.fftpack easily

parent 0cd7b903
import numpy as np
import numpy.fft as fft
from scipy.io import loadmat
import matplotlib.pyplot as plt
def data_processor(config):
inp_data=loadmat('../../../InputData/OrbitalTomog/'+config['data_filename'])
inp=inp_data["I2"]
ny,nx = inp.shape
self.config['data'] = inp
self.config['norm_data'] = np.sqrt(np.sum(self.config['data']**2))
inp_data = loadmat('../../../InputData/OrbitalTomog/' + config['data_filename'])
inp = inp_data["I2"]
ny, nx = inp.shape
config['data'] = inp
config['norm_data'] = np.sqrt(np.sum(config['data'] ** 2))
# Keep the same resolution?
config['Ny'],config['Nx'] = ny,nx
config['Ny'], config['Nx'] = ny, nx
# Autokorrelation
config['threshold for support'] = 0.1
autocorrelation=np.fft.fftshift(np.fft.ifft2(np.fft.ifftshift(inp)))
autocorrelation = fft.fftshift(fft.ifft2(fft.ifftshift(inp)))
config['support'] = (autocorrelation < config['threshold for support'] * np.amax(autocorrelation)).astype(np.uint)
# Anfangsbedingungen
ph_init = 2*np.pi*np.random.rand(ny,nx)
ph_init = 2 * np.pi * np.random.rand(ny, nx)
# ph_init = np.angle(np.fft.fft2(ph_init));
config['u0'] = inp * np.exp(1j*ph_init)
previous = np.fft.fftshift(np.fft.ifft2(np.fft.ifftshift(u0)))
config['u0'] = inp * np.exp(1j * ph_init)
previous = fft.fftshift(fft.ifft2(fft.ifftshift(config['u0'])))
plt.figure(figsize=(15,4))
plt.figure(figsize=(15, 4))
plt.subplot(131)
plt.imshow(inp)
plt.colorbar()
......@@ -37,4 +38,4 @@ def data_processor(config):
plt.imshow(config['support'])
plt.colorbar()
plt.title("Initial support")
plt.show()
\ No newline at end of file
plt.show()
......@@ -55,24 +55,18 @@ new_config = {
# Algorithm:
'algorithm': 'AP', # used to be 'Projection',
'numruns': 1, # the only time this parameter will
# be different than 1 is when we are
# benchmarking...not something a normal user
# would be doing.
# The following are parameters specific to RAAR, HPR, and HAAR that the
# user should be able to set/modify. Surely
# there will be other algorithm specific parameters that a user might
# want to play with. Don't know how best
# to do this. Thinking of a GUI interface, we could hard code all the
# parameters the user might encounter and have the menu options change
# depending on the value of the 'method field.
# do different things depending on the chosen algorithm:
'numruns': 1, # the only time this parameter will be different than 1 is when we are
# benchmarking... not something a normal user would be doing.
# The following are parameters specific to RAAR, HPR, and HAAR that the user should be able to set/modify. Surely
# there will be other algorithm specific parameters that a user might want to play with. Don't know how best to do
# this. Thinking of a GUI interface, we could hard code all the parameters the user might encounter and have the
# menu options change depending on the value of the 'method field. do different things depending on the chosen
# algorithm:
# if(strcmp('method,'RAAR')||strcmp('method,'AP')||...
# strcmp('method,'HPR')||strcmp('method,'HAAR'))
# the following just points this driver to a patch that communicates
# the parameters defined at this level to the structures used in the
# algorithms developed by Russell.
# strcmp('method,'HPR')||strcmp('method,'HAAR'))
# the following just points this driver to a patch that communicates the parameters defined at this level to the
# structures used in the algorithms developed by Russell.
'problem_family': 'Phase',
# else # moreregularization parameters for Thorsten's algorithms:
# prbl' : complete_itreg_par(prbl),
......
......@@ -9,4 +9,7 @@ The "ProxOperators"-module contains all proximal operators that are already impl
from .proxoperators import *
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp", "P_SP", "Approx_PM_Gaussian", "Approx_PM_Poisson", "P_S", "P_S_real", "P_sequential_hyperplane_odd", "P_sequential_hyperplane_even","P_parallel_hyperplane", "P_block_parallel_hyperplane", "P_block_sequential_hyperplane", "Q_Heau", "P_Amod", "Approx_P_FreFra_Poisson"]
__all__ = ["P_diag","P_parallel","magproj", "Approx_P_JWST_Poisson", "P_amp", "P_SP", "Approx_PM_Gaussian",
"Approx_PM_Poisson", "P_S", "P_S_real", "P_sequential_hyperplane_odd", "P_sequential_hyperplane_even",
"P_parallel_hyperplane", "P_block_parallel_hyperplane", "P_block_sequential_hyperplane", "Q_Heau",
"P_Amod", "Approx_P_FreFra_Poisson"]
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