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
513c9cd5
Commit
513c9cd5
authored
Nov 03, 2020
by
jansen31
Browse files
incoherent fields: sparsity applied to total intensity
parent
5a8b7d50
Changes
2
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/experiments/orbitaltomography/degenerate_orbits.py
View file @
513c9cd5
...
...
@@ -155,3 +155,10 @@ class DegenerateOrbital(PlanarMolecule):
if
show
:
plt
.
show
()
return
fig
def
interpolate_and_zoom
(
self
,
u
,
interpolation
=
2
,
zoom
=
0.5
):
"""
interpolate a field and zoom in to the center
"""
return
u
proxtoolbox/proxoperators/P_incoherent.py
View file @
513c9cd5
from
numpy
import
sum
from
numpy
import
sum
,
where
from
numpy.core._multiarray_umath
import
sqrt
,
array
from
proxtoolbox.proxoperators
import
P_M
,
P_Sparsity_real
...
...
@@ -27,9 +27,16 @@ class P_M_incoherent(P_M):
class
P_Sparsity_real_incoherent
(
P_Sparsity_real
):
"""
Apply a sparsity constraint to the combined intensity of a set of incoherent iterates
"""
def
__init__
(
self
,
experiment
):
super
(
P_Sparsity_real_incoherent
,
self
).
__init__
(
experiment
)
def
eval
(
self
,
u
,
prox_idx
=
None
):
out
=
array
([
super
(
P_Sparsity_real_incoherent
,
self
).
eval
(
u_i
)
for
u_i
in
u
])
u_real
=
u
.
real
density
=
sum
(
abs
(
u_real
)
**
2
,
axis
=
0
)
sparse
=
super
(
P_Sparsity_real_incoherent
,
self
).
eval
(
density
)
out
=
array
([
where
(
sparse
!=
0
,
u_i
,
0
)
for
u_i
in
u_real
])
# out = array([super(P_Sparsity_real_incoherent, self).eval(u_i) for u_i in u])
return
out
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