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

pyrost.simulation and pyrost.abberations_fit are fully revamped, v 0.3.0

parent 24c803c7
Branches
Tags
No related merge requests found
Showing
with 1068 additions and 1249 deletions
graft tests
graft pyrost/config
graft pyrost/bin
graft pyrost/ini_templates
exclude dev.pyx
include pytest.ini
include LICENSE
......
This diff is collapsed.
dev.pxd 100644 → 100755
#cython: language_level=3, boundscheck=False, wraparound=False, initializedcheck=False, cdivision=True, embedsignature=True
cdef extern from "gsl/gsl_math.h":
ctypedef struct gsl_function:
double (* function) (double x, void * params) nogil
void * params
cdef extern from "gsl/gsl_integration.h":
ctypedef struct gsl_integration_workspace
ctypedef struct gsl_integration_qaws_table
ctypedef struct gsl_integration_qawo_table
ctypedef struct gsl_integration_cquad_workspace
cdef enum:
GSL_INTEG_GAUSS15 = 1
GSL_INTEG_GAUSS21 = 2
GSL_INTEG_GAUSS31 = 3
GSL_INTEG_GAUSS41 = 4
GSL_INTEG_GAUSS51 = 5
GSL_INTEG_GAUSS61 = 6
cdef enum gsl_integration_qawo_enum:
GSL_INTEG_COSINE, GSL_INTEG_SINE
gsl_integration_cquad_workspace * gsl_integration_cquad_workspace_alloc (size_t n) nogil
void gsl_integration_cquad_workspace_free (gsl_integration_cquad_workspace * w) nogil
int gsl_integration_cquad (gsl_function * f, double a, double b, double epsabs, double epsrel, gsl_integration_cquad_workspace * workspace, double * result, double * abserr, size_t * nevals) nogil
gsl_integration_workspace * gsl_integration_workspace_alloc(size_t n) nogil
void gsl_integration_workspace_free(gsl_integration_workspace * w) nogil
int gsl_integration_qag(gsl_function *f, double a, double b, double epsabs, double epsrel, size_t limit, int key, gsl_integration_workspace * workspace, double * result, double * abserr) nogil
cdef extern from "gsl/gsl_rng.h":
ctypedef struct gsl_rng_type
......
This diff is collapsed.
def make_ext(modname, pyxfilename):
from distutils.extension import Extension
from distutils.core import Extension
import numpy
from Cython.Build import cythonize
import os
......
......@@ -22,7 +22,7 @@ copyright = '2020, Nikolay Ivanov'
author = 'Nikolay Ivanov'
# The full version, including alpha/beta/rc tags
release = '0.2.0'
release = '0.3.0'
# -- General configuration ---------------------------------------------------
......
aperture_wp
===========
.. autofunction:: pyrost.bin.aperture_wp
\ No newline at end of file
bar_positions
=============
.. autofunction:: pyrost.bin.bar_positions
\ No newline at end of file
fft_convolve
============
.. autofunction:: pyrost.bin.fft_convolve
\ No newline at end of file
fft_convolve_scan
=================
.. autofunction:: pyrost.bin.fft_convolve_scan
\ No newline at end of file
fhf_wp
======
.. autofunction:: pyrost.bin.fhf_wp
\ No newline at end of file
fhf_wp_scan
===========
.. autofunction:: pyrost.bin.fhf_wp_scan
\ No newline at end of file
fraunhofer_1d
=============
.. autofunction:: pyrost.bin.fraunhofer_1d
\ No newline at end of file
fraunhofer_1d_scan
==================
.. autofunction:: pyrost.bin.fraunhofer_1d_scan
\ No newline at end of file
lens_wp
=======
.. autofunction:: pyrost.bin.lens_wp
\ No newline at end of file
rsc_wp
======
.. autofunction:: pyrost.bin.rsc_wp
\ No newline at end of file
......@@ -2,4 +2,7 @@ STSim
=====
.. autoclass:: pyrost.simulation.STSim
:members:
\ No newline at end of file
:members:
:exclude-members: update_bar_positions
.. automethod:: update_bar_positions
\ No newline at end of file
......@@ -12,10 +12,12 @@ the wavefronts. All the functions are written in `Cython`_.
:maxdepth: 1
:caption: Contents
c_funcs/lens_wp
c_funcs/aperture_wp
c_funcs/fraunhofer_1d
c_funcs/fraunhofer_1d_scan
c_funcs/rsc_wp
c_funcs/fhf_wp
c_funcs/fhf_wp_scan
c_funcs/bar_positions
c_funcs/barcode_profile
c_funcs/fft_convolve
c_funcs/fft_convolve_scan
c_funcs/make_frames
c_funcs/make_whitefield
\ No newline at end of file
......@@ -151,6 +151,7 @@ In the end you can save the results to a CXI file.
/frame_selector Group
/frame_selector/good_frames Dataset {200}
/speckle_tracking Group
/speckle_tracking/error_frame Dataset {1, 2000}
/speckle_tracking/dfs Dataset {SCALAR}
/speckle_tracking/dss Dataset {SCALAR}
/speckle_tracking/mask Dataset {1, 2000}
......
......@@ -158,8 +158,10 @@ the phase profile with polynomial function using :class:`pyrost.AbberationsFit`.
.. doctest::
>>> data.update_phase(st_res)
>>> fit_ss = data.fit_phase(axis=0, max_order=3)
>>> fit_fs = data.fit_phase(axis=1, max_order=3)
>>> fit_obj_ss = data.get_fit(axis=0)
>>> fit_ss = fit_obj_ss.fit(max_order=3)
>>> fit_obj_fs = data.get_fit(axis=1)
>>> fit_fs = fit_obj_fs.fit(max_order=3)
>>> fig, ax = plt.subplots(figsize=(10, 10)) # doctest: +SKIP
>>> ax.imshow(data.get('phase')) # doctest: +SKIP
......@@ -176,12 +178,12 @@ the phase profile with polynomial function using :class:`pyrost.AbberationsFit`.
.. doctest::
>>> fig, axes = plt.subplots(1, 2, figsize=(16, 6)) # doctest: +SKIP
>>> axes[0].plot(data.get('phase').mean(axis=0), label='Reconstructed profile') # doctest: +SKIP
>>> axes[0].plot(data.get_fit(axis=1).phase_model(fit_fs['ph_fit'], fit_fs['pixels']), # doctest: +SKIP
>>> label='Polynomial fit') # doctest: +SKIP
>>> axes[0].plot(fit_obj_fs.pixels, fit_obj_fs.phase, label='Reconstructed profile') # doctest: +SKIP
>>> axes[0].plot(fit_obj_fs.pixels, fit_obj_fs.model(fit_fs['ph_fit']), # doctest: +SKIP
label='Polynomial fit') # doctest: +SKIP
>>> axes[0].set_xlabel('fast axis', fontsize=15) # doctest: +SKIP
>>> axes[1].plot(data.get('phase').mean(axis=1), label='Reconstructed profile') # doctest: +SKIP
>>> axes[1].plot(data.get_fit(axis=0).phase_model(fit_ss['ph_fit'], fit_ss['pixels']), # doctest: +SKIP
>>> axes[1].plot(fit_obj_ss.pixels, fit_obj_ss.phase, label='Reconstructed profile') # doctest: +SKIP
>>> axes[1].plot(fit_obj_ss.pixels, fit_obj_ss.model(fit_ss['ph_fit']), # doctest: +SKIP
>>> label='Polynomial fit') # doctest: +SKIP
>>> axes[1].set_xlabel('slow axis') # doctest: +SKIP
>>> for ax in axes: # doctest: +SKIP
......@@ -224,6 +226,7 @@ In the end you can save the results to a CXI file.
/frame_selector Group
/frame_selector/good_frames Dataset {120}
/speckle_tracking Group
/speckle_tracking/error_frame Dataset {516, 1556}
/speckle_tracking/dfs Dataset {SCALAR}
/speckle_tracking/dss Dataset {SCALAR}
/speckle_tracking/mask Dataset {516, 1556}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment