Commit df4dee90 authored by Matthijs's avatar Matthijs
Browse files

minor documentation changes

parent e23497a9
......@@ -24,9 +24,8 @@ new_config = {
# 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',
# Orbital imaging 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
......
import numpy as np
from numpy import shape, real, zeros
from .proxoperators import ProxOperator
class P_binary(ProxOperator):
"""
Projection subroutine for projecting onto nonnegativity and support constraints
"""
def __init__(self, config):
"""
Initialization
......@@ -13,11 +15,11 @@ class P_binary(ProxOperator):
Parameters
----------
config : dict - Dictionary containing the problem configuration. It must contain the following mapping:
support_idx : array_like - vector of indeces of the nonzero elements of the array
"""
self.support_idx = config['support_idx']
support_idx : array_like - vector of indices of the nonzero elements of the array
"""
self.support_idx = config['support_idx']
def work(self,u):
def work(self, u):
"""
Parameters
----------
......@@ -26,18 +28,10 @@ class P_binary(ProxOperator):
Returns
-------
p_binary : array_like - the projection IN THE PHYSICAL (time) DOMAIN onto 0 or 1.
"""
"""
support_idx = self.support_idx
p_binary=zeros(shape(u), np.float64)
p_binary[support_idx-1] = np.sign(real(u[support_idx-1])-0.5)
p_binary[support_idx-1] = np.maximum(p_binary[support_idx-1],1)
p_binary = zeros(shape(u), np.float64)
p_binary[support_idx - 1] = np.sign(real(u[support_idx - 1]) - 0.5)
p_binary[support_idx - 1] = np.maximum(p_binary[support_idx - 1], 1)
return p_binary
......@@ -4,8 +4,9 @@ import numpy as np
class P_nonneg_sparsity(ProxOperator):
"""
Projection subroutine for projecting onto support constraints
Projection subroutine for projecting onto sparsity constraints
"""
def __init__(self, config):
"""
Initialization
......@@ -33,9 +34,9 @@ class P_nonneg_sparsity(ProxOperator):
a = u.shape
b = 1
for i in range(len(a)):
b=a[i]*b
b = a[i] * b
tmp = np.real(u)
tmp[tmp<0] = 0
tmp[tmp < 0] = 0
tmp = np.reshape(tmp, b)
I = np.argsort(tmp) # gives indices of sorted array in ascending order
I = np.flip(I, axis=0) # reverses the array so that I gives the indices of sorted array in descending order
......
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