Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
df4dee90
Commit
df4dee90
authored
Mar 27, 2020
by
Matthijs
Browse files
minor documentation changes
parent
e23497a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/Problems/OrbitalTomog/coronene_config.py
View file @
df4dee90
...
...
@@ -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
...
...
proxtoolbox/ProxOperators/P_binary.py
View file @
df4dee90
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 ind
e
ces of the nonzero elements of the array
"""
self
.
support_idx
=
config
[
'support_idx'
]
support_idx : array_like - vector of ind
i
ces 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
proxtoolbox/ProxOperators/P_nonneg_sparsity.py
View file @
df4dee90
...
...
@@ -4,8 +4,9 @@ import numpy as np
class
P_nonneg_sparsity
(
ProxOperator
):
"""
Projection subroutine for projecting onto s
upport
constraints
Projection subroutine for projecting onto s
parsity
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment