Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
de8244f6
Commit
de8244f6
authored
Sep 25, 2020
by
s.gretchko
Browse files
Merge branch 'master' into gretchko
parents
284d8efb
cf48ce2d
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
poetry.lock
0 → 100644
View file @
de8244f6
This diff is collapsed.
Click to expand it.
proxtoolbox/experiments/orbitaltomography/planar_molecule.py
View file @
de8244f6
...
...
@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
from
proxtoolbox.experiments.orbitaltomography.orbitExperiment
import
OrbitalTomographyExperiment
from
proxtoolbox.utils.visualization.complex_field_visualization
import
complex_to_rgb
from
proxtoolbox.utils.
O
rbital
T
omog
import
bin_array
,
shifted_fft
,
shifted_ifft
,
fourier_interpolate
,
roll_to_pos
from
proxtoolbox.utils.
o
rbital
t
omog
import
bin_array
,
shifted_fft
,
shifted_ifft
,
fourier_interpolate
,
roll_to_pos
class
PlanarMolecule
(
OrbitalTomographyExperiment
):
...
...
@@ -192,12 +192,15 @@ class PlanarMolecule(OrbitalTomographyExperiment):
bx4
.
set_ylabel
(
'Gap'
)
f
.
tight_layout
()
h
,
ax
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
9
,
3
))
h
,
ax
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
9
,
3
))
ax
[
0
].
imshow
(
self
.
data
)
ax
[
0
].
set_title
(
"Measured data"
)
prop
=
self
.
propagator
(
self
)
u_hat
=
prop
.
eval
(
self
.
algorithm
.
prox1
.
eval
(
self
.
algorithm
.
u
))
ax
[
1
].
imshow
(
abs
(
u_hat
))
ax
[
1
].
set_title
(
"Predicted measurement intensity"
)
ax
[
2
].
imshow
(
complex_to_rgb
(
u_hat
))
ax
[
2
].
set_title
(
"Predicted phase (by color)"
)
h
.
tight_layout
()
plt
.
show
()
...
...
proxtoolbox/experiments/orbitaltomography/planar_molecule_demo.py
View file @
de8244f6
...
...
@@ -2,7 +2,6 @@ import sys, os
# set proxpython path
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"/../../.."
)
from
proxtoolbox.experiments.orbitaltomography
import
planar_molecule
as
pm
if
__name__
==
"__main__"
:
# prevent execution when generating documentation
...
...
@@ -13,7 +12,8 @@ if __name__ == "__main__": # prevent execution when generating documentation
use_sparsity_with_support
=
True
,
sparsity_parameter
=
40
,
TOL
=
1e-10
,
lambda_0
=
0.85
,
lambda_max
=
0.5
,
lambda_switch
=
30
)
lambda_0
=
0.85
,
lambda_max
=
0.5
,
lambda_switch
=
30
,
rnd_seed
=
None
)
# Disable fixed pseudo-random number generator
# exp_pm.plotInputData()
exp_pm
.
run
()
exp_pm
.
show
()
proxtoolbox/proxoperators/P_M.py
View file @
de8244f6
...
...
@@ -37,7 +37,7 @@ class P_M(ProxOperator):
"""
m
=
self
.
data
a
=
self
.
prop
.
eval
(
u
)
b
=
magproj
(
a
,
m
)
b
=
magproj
(
m
,
a
)
return
self
.
invprop
.
eval
(
b
)
...
...
@@ -70,7 +70,7 @@ class P_M_masked(P_M):
array_like - p_M: the projection IN THE PHYSICAL (time) DOMAIN
"""
fourier_space_iterate
=
self
.
prop
.
eval
(
u
)
constrained
=
magproj
(
fourier_space_iterate
.
copy
()
,
self
.
data
)
constrained
=
magproj
(
self
.
data
,
fourier_space_iterate
.
copy
())
update
=
where
(
self
.
mask
,
fourier_space_iterate
,
constrained
)
return
self
.
invprop
(
update
)
...
...
@@ -97,7 +97,7 @@ class Approx_P_M(P_M):
# Now see that the propagated field is within the ball around the data (if any).
# If not, the projection is calculated, otherwise we do nothing.
if
h_u_hat
>=
self
.
data_ball
+
self
.
TOL2
:
b
=
magproj
(
u_hat
,
self
.
data
)
b
=
magproj
(
self
.
data
,
u_hat
)
return
self
.
invprop
.
eval
(
b
)
else
:
return
u
...
...
@@ -124,7 +124,7 @@ class Approx_P_M_masked(P_M_masked):
# Now see that the propagated field is within the ball around the data (if any).
# If not, the projection is calculated, otherwise we do nothing.
if
h_u_hat
>=
self
.
data_ball
+
self
.
TOL2
:
constrained
=
magproj
(
u_hat
.
copy
()
,
self
.
data
)
# Apply constraint
constrained
=
magproj
(
self
.
data
,
u_hat
.
copy
())
# Apply constraint
update
=
where
(
self
.
mask
,
u_hat
,
constrained
)
# Masking operation
return
self
.
invprop
(
update
)
# Propagate back
else
:
...
...
proxtoolbox/proxoperators/P_Sparsity.py
View file @
de8244f6
from
numpy
import
zeros_like
,
unravel_index
,
sum
,
max
import
numpy
as
np
from
proxtoolbox.proxoperators.proxoperator
import
ProxOperator
from
proxtoolbox.utils.
O
rbital
T
omog
import
tile_array
,
bin_array
from
proxtoolbox.utils.
o
rbital
t
omog
import
tile_array
,
bin_array
from
proxtoolbox.utils.size
import
size_matlab
__all__
=
[
'P_Sparsity'
,
'P_Sparsity_real'
,
'P_Sparsity_Symmetric'
,
'P_Sparsity_Symmetric_real'
,
...
...
proxtoolbox/proxoperators/propagators.py
View file @
de8244f6
from
numpy
import
pi
,
sqrt
,
conj
from
numpy.fft
import
fft2
,
ifft2
,
fft
,
ifft
from
proxtoolbox.utils.
O
rbital
T
omog
import
shifted_ifft
,
shifted_fft
from
proxtoolbox.utils.
o
rbital
t
omog
import
shifted_ifft
,
shifted_fft
__all__
=
[
'PropagatorFFTn'
,
'InvPropagatorFFTn'
,
'PropagatorFFT2'
,
'InvPropagatorFFT2'
,
...
...
pyproject.toml
0 → 100644
View file @
de8244f6
[tool.poetry]
name
=
"ProxPython"
version
=
"1.0.4"
description
=
""
authors
=
[
"Russell Luke <r.luke@math.uni-goettingen.de>"
]
[tool.poetry.dependencies]
python
=
"^3.8"
numpy
=
"^1.19.2"
scikit-image
=
"^0.17.2"
matplotlib
=
"^3.3.2"
scipy
=
"^1.5.2"
[tool.poetry.dev-dependencies]
[build-system]
requires
=
["poetry>=0.12"]
build-backend
=
"poetry.masonry.api"
singularity.def
0 → 100644
View file @
de8244f6
Bootstrap: docker
From: python:3.8.5-slim-buster
%setup
mkdir -p $SINGULARITY_ROOTFS/code
cp poetry.lock $SINGULARITY_ROOTFS/code/
cp pyproject.toml $SINGULARITY_ROOTFS/code/
%post
apt-get -qyy update
env DEBIAN_FRONTEND=noninteractive apt-get -qyy install -o APT::Install-Recommends=false -o APT::Install-Suggests=false \
git cmake ninja-build libscalapack-openmpi-dev \
build-essential curl
apt-get clean
export POETRY_HOME=/etc/poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ln -s /etc/poetry/bin/poetry /usr/local/bin/poetry
chmod a+rX /etc/poetry/bin/poetry
export PIP_NO_CACHE_DIR=off
export PIP_DISABLE_PIP_VERSION_CHECK=on
cd /code
poetry config virtualenvs.create false
poetry install --no-interaction --no-ansi
%runscript
exec poetry shell "$@"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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