Commit de8244f6 authored by s.gretchko's avatar s.gretchko
Browse files

Merge branch 'master' into gretchko

parents 284d8efb cf48ce2d
This diff is collapsed.
...@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt ...@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTomographyExperiment from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTomographyExperiment
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
from proxtoolbox.utils.OrbitalTomog import bin_array, shifted_fft, shifted_ifft, fourier_interpolate, roll_to_pos from proxtoolbox.utils.orbitaltomog import bin_array, shifted_fft, shifted_ifft, fourier_interpolate, roll_to_pos
class PlanarMolecule(OrbitalTomographyExperiment): class PlanarMolecule(OrbitalTomographyExperiment):
...@@ -192,12 +192,15 @@ class PlanarMolecule(OrbitalTomographyExperiment): ...@@ -192,12 +192,15 @@ class PlanarMolecule(OrbitalTomographyExperiment):
bx4.set_ylabel('Gap') bx4.set_ylabel('Gap')
f.tight_layout() 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].imshow(self.data)
ax[0].set_title("Measured data")
prop = self.propagator(self) prop = self.propagator(self)
u_hat = prop.eval(self.algorithm.prox1.eval(self.algorithm.u)) u_hat = prop.eval(self.algorithm.prox1.eval(self.algorithm.u))
ax[1].imshow(abs(u_hat)) ax[1].imshow(abs(u_hat))
ax[1].set_title("Predicted measurement intensity")
ax[2].imshow(complex_to_rgb(u_hat)) ax[2].imshow(complex_to_rgb(u_hat))
ax[2].set_title("Predicted phase (by color)")
h.tight_layout() h.tight_layout()
plt.show() plt.show()
......
...@@ -2,7 +2,6 @@ import sys, os ...@@ -2,7 +2,6 @@ import sys, os
# set proxpython path # set proxpython path
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../..") sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../..")
from proxtoolbox.experiments.orbitaltomography import planar_molecule as pm from proxtoolbox.experiments.orbitaltomography import planar_molecule as pm
if __name__ == "__main__": # prevent execution when generating documentation if __name__ == "__main__": # prevent execution when generating documentation
...@@ -13,7 +12,8 @@ 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, use_sparsity_with_support=True,
sparsity_parameter=40, sparsity_parameter=40,
TOL=1e-10, 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.plotInputData()
exp_pm.run() exp_pm.run()
exp_pm.show() exp_pm.show()
...@@ -37,7 +37,7 @@ class P_M(ProxOperator): ...@@ -37,7 +37,7 @@ class P_M(ProxOperator):
""" """
m = self.data m = self.data
a = self.prop.eval(u) a = self.prop.eval(u)
b = magproj(a, m) b = magproj(m, a)
return self.invprop.eval(b) return self.invprop.eval(b)
...@@ -70,7 +70,7 @@ class P_M_masked(P_M): ...@@ -70,7 +70,7 @@ class P_M_masked(P_M):
array_like - p_M: the projection IN THE PHYSICAL (time) DOMAIN array_like - p_M: the projection IN THE PHYSICAL (time) DOMAIN
""" """
fourier_space_iterate = self.prop.eval(u) 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) update = where(self.mask, fourier_space_iterate, constrained)
return self.invprop(update) return self.invprop(update)
...@@ -97,7 +97,7 @@ class Approx_P_M(P_M): ...@@ -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). # 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 not, the projection is calculated, otherwise we do nothing.
if h_u_hat >= self.data_ball + self.TOL2: 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) return self.invprop.eval(b)
else: else:
return u return u
...@@ -124,7 +124,7 @@ class Approx_P_M_masked(P_M_masked): ...@@ -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). # 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 not, the projection is calculated, otherwise we do nothing.
if h_u_hat >= self.data_ball + self.TOL2: 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 update = where(self.mask, u_hat, constrained) # Masking operation
return self.invprop(update) # Propagate back return self.invprop(update) # Propagate back
else: else:
......
from numpy import zeros_like, unravel_index, sum, max from numpy import zeros_like, unravel_index, sum, max
import numpy as np import numpy as np
from proxtoolbox.proxoperators.proxoperator import ProxOperator from proxtoolbox.proxoperators.proxoperator import ProxOperator
from proxtoolbox.utils.OrbitalTomog import tile_array, bin_array from proxtoolbox.utils.orbitaltomog import tile_array, bin_array
from proxtoolbox.utils.size import size_matlab from proxtoolbox.utils.size import size_matlab
__all__ = ['P_Sparsity', 'P_Sparsity_real', 'P_Sparsity_Symmetric', 'P_Sparsity_Symmetric_real', __all__ = ['P_Sparsity', 'P_Sparsity_real', 'P_Sparsity_Symmetric', 'P_Sparsity_Symmetric_real',
......
from numpy import pi, sqrt, conj from numpy import pi, sqrt, conj
from numpy.fft import fft2, ifft2, fft, ifft from numpy.fft import fft2, ifft2, fft, ifft
from proxtoolbox.utils.OrbitalTomog import shifted_ifft, shifted_fft from proxtoolbox.utils.orbitaltomog import shifted_ifft, shifted_fft
__all__ = ['PropagatorFFTn', 'InvPropagatorFFTn', __all__ = ['PropagatorFFTn', 'InvPropagatorFFTn',
'PropagatorFFT2', 'InvPropagatorFFT2', 'PropagatorFFT2', 'InvPropagatorFFT2',
......
[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"
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 "$@"
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