Commit b1a2d979 authored by jansen31's avatar jansen31
Browse files

extended imports for proxoperators to enable Approx_ operator

parent aa4e1195
......@@ -3,106 +3,102 @@
new_config = {
## We start very general.
##==========================================
## Problem parameters
##==========================================
## What is the name of the data file?
'data_filename' : 'coronen_homo1_fourier_noise15.mat',
## What type of object are we working with?
## Options are: 'phase', 'real', 'nonnegative', 'complex'
'object' : 'complex',
## What type of constraints do we have?
## Options are: 'support only', 'real and support', 'nonnegative and support',
## 'amplitude only', 'sparse real', 'sparse complex', and 'hybrid'
'constraint' : 'support only',
## What type of measurements are we working with?
## Options are: 'single diffraction', 'diversity diffraction',
## 'ptychography', and 'complex'
## Options are: '2D_ARPES', '3D_ARPES',
## '2D_time', and '3D_time'
'experiment' : '2D_ARPES',
## Next we move to things that most of our users will know
## better than we will. Some of these may be overwritten in the
## data processor file which the user will most likely write.
## Are the measurements in the far field or near field?
## Options are: 'far field' or 'near field',
'distance' : 'far field',
## What are the dimensions of the measurements?
'Nx' : 128,
'Ny' : 128,
#'fresnel_nr' : 0,
#moved this to phase
#if(strcmp('distance,'near field'))
# 'fresnel_nr' : 1*2*pi*'Nx,
#else
# 'fresnel_nr' : 0, #1*2*pi*'Nx,
#'magn' : 1,
## What are the noise characteristics (Poisson or Gaussian)?
'noise' : 'Poisson',
##==========================================
## Algorithm parameters
##==========================================
## Now set some algorithm parameters that the user should be
## able to control (without too much damage)
## 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:
#if(strcmp('method,'RAAR')||strcmp('method,'AP')||...
# strcmp('method,'HPR')||strcmp('method,'HAAR'))
# We start very general.
# ==========================================
# Problem parameters
# ==========================================
# What is the name of the data file?
'data_filename': 'coronen_homo1_fourier_noise15.mat',
# What type of object are we working with?
# Options are: 'phase', 'real', 'nonnegative', 'complex'
'object': 'complex',
# What type of constraints do we have?
# Options are: 'support only', 'real and support', 'nonnegative and support',
# 'amplitude only', 'sparse real', 'sparse complex', and 'hybrid'
'constraint': 'support only',
# What type of measurements are we working with?
# Options are: 'single diffraction', 'diversity diffraction',
# 'ptychography', and 'complex'
# Options are: '2D_ARPES', '3D_ARPES',
# '2D_time', and '3D_time'
'experiment': '2D_ARPES',
# Next we move to things that most of our users will know
# better than we will. Some of these may be overwritten in the
# data processor file which the user will most likely write.
# Are the measurements in the far field or near field?
# Options are: 'far field' or 'near field',
'distance': 'far field',
# What are the dimensions of the measurements?
'Nx': 128,
'Ny': 128,
# 'fresnel_nr' : 0,
# moved this to phase
# if(strcmp('distance,'near field'))
# 'fresnel_nr' : 1*2*pi*'Nx,
# else
# 'fresnel_nr' : 0, #1*2*pi*'Nx,
# 'magn' : 1,
# What are the noise characteristics (Poisson or Gaussian)?
'noise': 'Poisson',
# ==========================================
# Algorithm parameters
# ==========================================
# Now set some algorithm parameters that the user should be
# able to control (without too much damage)
# 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:
# 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.
#'problem_family' : 'Phase',
#else # moreregularization parameters for Thorsten's algorithms:
# prbl' : complete_itreg_par(prbl),
# 'problem_family' : 'Phase',
# else # moreregularization parameters for Thorsten's algorithms:
# prbl' : complete_itreg_par(prbl),
# This is just a patch to Thorsten's tools. May want to change this
# later
#'problem_family='Hohage',
#end
# 'problem_family='Hohage',
# end
# if(strcmp('problem_family,'Phase'))
# maximum number of iterations and tolerances
'MAXIT': 5000,
'TOL': 1e-10,
#if(strcmp('problem_family,'Phase'))
## maximum number of iterations and tolerances
'MAXIT' : 5000,
'TOL' : 1e-10,
## relaxaton parameters in RAAR, HPR and HAAR
'beta_0' : 0.85, #0.95 # starting relaxation prameter (only used with
# relaxaton parameters in RAAR, HPR and HAAR
'beta_0': 0.85, # 0.95 # starting relaxation prameter (only used with
# HAAR, HPR and RAAR)
'beta_max' :0.50, # maximum relaxation prameter (only used with
'beta_max': 0.50, # maximum relaxation prameter (only used with
# HAAR, RAAR, and HPR)
'beta_switch' : 30, # iteration at which beta moves from beta_0 -> beta_max
'beta_switch': 30, # iteration at which beta moves from beta_0 -> beta_max
## parameter for the data regularization
## need to discuss how/whether the user should
## put in information about the noise
'data_ball' : .999826,
# parameter for the data regularization
# need to discuss how/whether the user should
# put in information about the noise
'data_ball': .999826,
# 'data_ball' : .9998261e-0,
# the above is the percentage of the gap
# between the measured data and the
......@@ -114,50 +110,49 @@ new_config = {
# Ultimately the size of the gap depends
# on the inconsistency of the measurement model
# with the qualitative constraints.
#elseif(strcmp('problem_family,'Hohage'))
# 'alpha0' : 1e4,
# 'N_CG' : 70,
#end
# ##==========================================
# ## parameters for plotting and diagnostics
# ##==========================================
# 'plotWhat.n1=2,
# 'plotWhat.n2=3,
# 'plotWhat.plots' : 'PYWpyw',
# 'verbose' : 1, # options are 0 or 1
# 'graphics' : 1, # whether or not to display figures, options are 0 or 1.
# # default is 1.
# 'anim' : 1, # whether or not to disaply ``real time" reconstructions
# # options are 0=no, 1=yes, 2=make a movie
# # default is 1.
# 'graphics_display' : [], # unless specified, a default
# # plotting subroutine will generate
# # the graphics. Otherwise, the user
# # can write their own plotting subroutine
#
##==========================================
## parameters for plotting and diagnostics
##==========================================
'diagnostic' : True,
'verbose' : 1, # options are 0 or 1
'graphics' : 1, # whether or not to display figures, options are 0 or 1.
# default is 1.
'anim' : 2, # whether or not to disaply ``real time" reconstructions
# options are 0=no, 1=yes, 2=make a movie
# default is 1.
'graphics_display' : 'Phase_graphics' # unless specified, a default
# plotting subroutine will generate
# the graphics. Otherwise, the user
# can write their own plotting subroutine
# elseif(strcmp('problem_family,'Hohage'))
# 'alpha0' : 1e4,
# 'N_CG' : 70,
# end
# ##==========================================
# ## parameters for plotting and diagnostics
# ##==========================================
# 'plotWhat.n1=2,
# 'plotWhat.n2=3,
# 'plotWhat.plots' : 'PYWpyw',
# 'verbose' : 1, # options are 0 or 1
# 'graphics' : 1, # whether or not to display figures, options are 0 or 1.
# # default is 1.
# 'anim' : 1, # whether or not to disaply ``real time" reconstructions
# # options are 0=no, 1=yes, 2=make a movie
# # default is 1.
# 'graphics_display' : [], # unless specified, a default
# # plotting subroutine will generate
# # the graphics. Otherwise, the user
# # can write their own plotting subroutine
#
#==========================================
# parameters for plotting and diagnostics
#==========================================
'diagnostic': True,
'verbose': 1, # options are 0 or 1
'graphics': 1, # whether or not to display figures, options are 0 or 1.
# default is 1.
'anim': 2, # whether or not to disaply ``real time" reconstructions
# options are 0=no, 1=yes, 2=make a movie
# default is 1.
'graphics_display': 'Phase_graphics' # unless specified, a default
# plotting subroutine will generate
# the graphics. Otherwise, the user
# can write their own plotting subroutine
}
##======================================================================
## Technical/software specific parameters
##======================================================================
## Given the parameter values above, the following technical/algorithmic
## parameters are automatically set. The user does not need to know
## about these details, and so probably these parameters should be set in
## a module one level below this one.
#======================================================================
# Technical/software specific parameters
#======================================================================
# Given the parameter values above, the following technical/algorithmic
# parameters are automatically set. The user does not need to know
# about these details, and so probably these parameters should be set in
# a module one level below this one.
......@@ -8,9 +8,9 @@ The "ProxOperators"-module contains various specific operators that do the actua
"""
import numpy as np
from numpy import conj, dot, empty, ones, sqrt, sum, zeros, exp, nonzero, log, tile, shape, real, zeros_like
from numpy import conj, dot, empty, ones, sqrt, sum, zeros, exp, nonzero, log, tile, shape, real, zeros_like, pi
# from pyfftw.interfaces.scipy_fftpack import fft2, ifft2
from numpy.fft import fft2, ifft2, ifft # TODO: switch to scipy.fftpack? (is faster supposedly)
from numpy.fft import fft2, ifft2, ifft , fftshift, ifftshift# TODO: switch to scipy.fftpack? (is faster supposedly)
__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",
......
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