Skip to content
Snippets Groups Projects
Commit 43308ae4 authored by simply-nicky's avatar simply-nicky
Browse files

Merge branch 'dev0'

parents d42792ca d861b843
No related branches found
No related tags found
No related merge requests found
## Current build status
[![PyPI](https://img.shields.io/pypi/v/pyrost?color=brightgreen)](https://pypi.org/project/pyrost/)
[![Documentation Status](https://readthedocs.org/projects/robust-speckle-tracking/badge/?version=latest)](https://robust-speckle-tracking.readthedocs.io/en/latest/?badge=latest)
# pyrost # pyrost
Python Robust Speckle Tracking (**pyrost**) is a library for wavefront metrology Python Robust Speckle Tracking (**pyrost**) is a library for wavefront metrology
and sample imaging based on ptychographic speckle tracking algorithm. This and sample imaging based on ptychographic speckle tracking algorithm. This
...@@ -15,7 +19,6 @@ The documentation can be found on [Read the Docs](https://robust-speckle-trackin ...@@ -15,7 +19,6 @@ The documentation can be found on [Read the Docs](https://robust-speckle-trackin
- [h5py](https://www.h5py.org) 2.10.0 or later. - [h5py](https://www.h5py.org) 2.10.0 or later.
- [NumPy](https://numpy.org) 1.19.0 or later. - [NumPy](https://numpy.org) 1.19.0 or later.
- [SciPy](https://scipy.org) 1.5.2 or later. - [SciPy](https://scipy.org) 1.5.2 or later.
- [pyFFTW](https://github.com/pyFFTW/pyFFTW) 0.12.0 or later.
## Installation ## Installation
We recommend **not** building from source, but install the release from [pypi](https://test.pypi.org/project/rst/) We recommend **not** building from source, but install the release from [pypi](https://test.pypi.org/project/rst/)
......
...@@ -22,7 +22,7 @@ copyright = '2020, Nikolay Ivanov' ...@@ -22,7 +22,7 @@ copyright = '2020, Nikolay Ivanov'
author = 'Nikolay Ivanov' author = 'Nikolay Ivanov'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = '0.1.0' release = '0.1.1'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
......
...@@ -16,12 +16,10 @@ pyrost has the following **mandatory** runtime dependencies: ...@@ -16,12 +16,10 @@ pyrost has the following **mandatory** runtime dependencies:
CXI files. CXI files.
* `NumPy <https://numpy.org>`_ 1.19.0 or later. * `NumPy <https://numpy.org>`_ 1.19.0 or later.
* `SciPy <https://scipy.org>`_ 1.5.2 or later. * `SciPy <https://scipy.org>`_ 1.5.2 or later.
* `pyFFTW <https://github.com/pyFFTW/pyFFTW>`_ 0.12.0 or later, which is used
for the Fourier Transform wavefront reconstruction (:func:`pyrost.bin.ct_integrate`).
Packages Packages
-------- --------
pyrost packages are available through `pypi <https://test.pypi.org/project/rst/>`_ on pyrost packages are available through `pypi <https://pypi.org/project/pyrost/>`_ on
OS X as for now. OS X as for now.
pip pip
......
...@@ -15,5 +15,4 @@ dependencies: ...@@ -15,5 +15,4 @@ dependencies:
- sphinx - sphinx
- sphinx_rtd_theme - sphinx_rtd_theme
- mock - mock
- pillow - pillow
- pyfftw \ No newline at end of file
\ No newline at end of file
...@@ -10,5 +10,4 @@ dependencies: ...@@ -10,5 +10,4 @@ dependencies:
- llvm-openmp - llvm-openmp
- h5py - h5py
- numpy - numpy
- scipy - scipy
- pyfftw \ No newline at end of file
\ No newline at end of file
...@@ -5,7 +5,6 @@ from libc.math cimport sqrt, exp, pi, floor ...@@ -5,7 +5,6 @@ from libc.math cimport sqrt, exp, pi, floor
from cython.parallel import prange from cython.parallel import prange
cimport openmp cimport openmp
from posix.time cimport clock_gettime, timespec, CLOCK_REALTIME from posix.time cimport clock_gettime, timespec, CLOCK_REALTIME
from pyfftw import FFTW, empty_aligned
ctypedef fused float_t: ctypedef fused float_t:
np.float64_t np.float64_t
...@@ -631,12 +630,9 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr): ...@@ -631,12 +630,9 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr):
dtype = np.float64 if float_t is np.float64_t else np.float32 dtype = np.float64 if float_t is np.float64_t else np.float32
cdef: cdef:
int a = sx_arr.shape[0], b = sx_arr.shape[1], i, j, ii, jj int a = sx_arr.shape[0], b = sx_arr.shape[1], i, j, ii, jj
float_t[:, ::1] s_asdi = np.empty((2 * a, 2 * b), dtype=dtype)
complex_t[:, ::1] sf_asdi = np.empty((2 * a, 2 * b), dtype=np.complex128)
float_t xf, yf float_t xf, yf
np.ndarray[np.complex128_t, ndim=2] s_asdi = empty_aligned((2 * a, 2 * b), dtype='complex128')
np.ndarray[np.complex128_t, ndim=2] sf_asdi = empty_aligned((2 * a, 2 * b), dtype='complex128')
np.ndarray[np.complex128_t, ndim=2] w_asdi = empty_aligned((2 * a, 2 * b), dtype='complex128')
fft_obj = FFTW(s_asdi, sf_asdi, axes=(0, 1))
ifft_obj = FFTW(sf_asdi, w_asdi, axes=(0, 1), direction='FFTW_BACKWARD')
for i in range(a): for i in range(a):
for j in range(b): for j in range(b):
s_asdi[i, j] = -sx_arr[a - i - 1, b - j - 1] s_asdi[i, j] = -sx_arr[a - i - 1, b - j - 1]
...@@ -649,7 +645,7 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr): ...@@ -649,7 +645,7 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr):
for i in range(a): for i in range(a):
for j in range(b): for j in range(b):
s_asdi[i + a, j + b] = sx_arr[i, j] s_asdi[i + a, j + b] = sx_arr[i, j]
cdef np.ndarray[np.complex128_t, ndim=2] sfx_asdi = fft_obj().copy() cdef np.ndarray[np.complex128_t, ndim=2] sfx_asdi = np.fft.fft2(s_asdi)
for i in range(a): for i in range(a):
for j in range(b): for j in range(b):
s_asdi[i, j] = -sy_arr[a - i - 1, b - j - 1] s_asdi[i, j] = -sy_arr[a - i - 1, b - j - 1]
...@@ -662,12 +658,11 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr): ...@@ -662,12 +658,11 @@ def ct_integrate(float_t[:, ::1] sx_arr, float_t[:, ::1] sy_arr):
for i in range(a): for i in range(a):
for j in range(b): for j in range(b):
s_asdi[i + a, j + b] = sy_arr[i, j] s_asdi[i + a, j + b] = sy_arr[i, j]
cdef np.ndarray[np.complex128_t, ndim=2] sfy_asdi = fft_obj().copy() cdef np.ndarray[np.complex128_t, ndim=2] sfy_asdi = np.fft.fft2(s_asdi)
for i in range(2 * a): for i in range(2 * a):
xf = <float_t>(i) / 2 / a - i // a xf = <float_t>(i) / 2 / a - i // a
for j in range(2 * b): for j in range(2 * b):
yf = <float_t>(j) / 2 / b - j // b yf = <float_t>(j) / 2 / b - j // b
sf_asdi[i, j] = (xf * sfx_asdi[i, j] + yf * sfy_asdi[i, j]) / (2j * pi * (xf**2 + yf**2)) sf_asdi[i, j] = (xf * sfx_asdi[i, j] + yf * sfy_asdi[i, j]) / (2j * pi * (xf**2 + yf**2))
sf_asdi[0, 0] = 0 sf_asdi[0, 0] = 0
ifft_obj() return np.asarray(np.fft.ifft2(sf_asdi).real[a:, b:], dtype=dtype)
return np.asarray(w_asdi.real[a:, b:], dtype=dtype)
...@@ -2,5 +2,4 @@ Cython>=0.29.21 ...@@ -2,5 +2,4 @@ Cython>=0.29.21
CythonGSL>=0.2.2 CythonGSL>=0.2.2
h5py>=2.10.0 h5py>=2.10.0
numpy>=1.19.0 numpy>=1.19.0
scipy>=1.5.2 scipy>=1.5.2
pyfftw>=0.12.0 \ No newline at end of file
\ No newline at end of file
...@@ -53,7 +53,7 @@ with open('README.md', 'r') as readme: ...@@ -53,7 +53,7 @@ with open('README.md', 'r') as readme:
long_description = readme.read() long_description = readme.read()
setup(name='pyrost', setup(name='pyrost',
version='0.1.0', version='0.1.1',
author='Nikolay Ivanov', author='Nikolay Ivanov',
author_email="nikolay.ivanov@desy.de", author_email="nikolay.ivanov@desy.de",
long_description=long_description, long_description=long_description,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment