diff --git a/.buildinfo b/.buildinfo index 4bcc1213..9868aea9 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 6848b516c4ed6be226725a93b9a42501 +config: 568d14806a47ed6129c18c1d7af0f561 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/README.textile b/README.textile deleted file mode 100644 index 8a18775e..00000000 --- a/README.textile +++ /dev/null @@ -1 +0,0 @@ -h1. GitHub Pages README file diff --git a/_downloads/tutorial-part1.zip b/_downloads/tutorial-part1.zip new file mode 100644 index 00000000..96f6a3a1 Binary files /dev/null and b/_downloads/tutorial-part1.zip differ diff --git a/_downloads/tutorial-part2.zip b/_downloads/tutorial-part2.zip new file mode 100644 index 00000000..5a120ec8 Binary files /dev/null and b/_downloads/tutorial-part2.zip differ diff --git a/_images/image1.png b/_images/image1.png new file mode 100644 index 00000000..8452f820 Binary files /dev/null and b/_images/image1.png differ diff --git a/_images/image2.png b/_images/image2.png new file mode 100644 index 00000000..926881dc Binary files /dev/null and b/_images/image2.png differ diff --git a/_images/image3.png b/_images/image3.png new file mode 100644 index 00000000..6e8f4919 Binary files /dev/null and b/_images/image3.png differ diff --git a/_images/image4.png b/_images/image4.png new file mode 100644 index 00000000..0fac1937 Binary files /dev/null and b/_images/image4.png differ diff --git a/_sources/api_reference.txt b/_sources/api_reference.txt new file mode 100644 index 00000000..73f70e69 --- /dev/null +++ b/_sources/api_reference.txt @@ -0,0 +1,124 @@ +.. _api_reference: + +API reference +============= + +This is a complete api reference to the openpiv python module. + +The ``openpiv.preprocess`` module +---------------------------------- +.. automodule:: openpiv.preprocess + +.. currentmodule:: openpiv.preprocess + +.. autosummary:: + :toctree: generated/ + + dynamic_masking + + +The ``openpiv.tools`` module +---------------------------- +.. automodule:: openpiv.tools + +.. currentmodule:: openpiv.tools + +.. autosummary:: + :toctree: generated/ + + imread + save + display + display_vector_field + Multiprocesser + +The ``openpiv.pyprocess`` module +-------------------------------- +.. automodule:: openpiv.pyprocess + +.. currentmodule:: openpiv.pyprocess + +.. autosummary:: + :toctree: generated/ + + normalize_intensity + correlate_windows + get_coordinates + get_field_shape + moving_window_array + find_first_peak + find_second_peak + find_subpixel_peak_position + piv + + +The ``openpiv.process`` module +-------------------------------- +.. automodule:: openpiv.process + +.. currentmodule:: openpiv.process + +.. autosummary:: + :toctree: generated/ + + extended_search_area_piv + CorrelationFunction + get_coordinates + get_field_shape + correlate_windows + normalize_intensity + +The ``openpiv.lib`` module +-------------------------------- +.. automodule:: openpiv.lib + +.. currentmodule:: openpiv.lib + +.. autosummary:: + :toctree: generated/ + + sincinterp + replace_nans + + +The ``openpiv.filters`` module +------------------------------ + +.. automodule:: openpiv.filters + +.. currentmodule:: openpiv.filters + +.. autosummary:: + :toctree: generated/ + + gaussian + _gaussian_kernel + replace_outliers + + +The ``openpiv.validation`` module +--------------------------------- + +.. automodule:: openpiv.validation + +.. currentmodule:: openpiv.validation + +.. autosummary:: + :toctree: generated/ + + global_val + sig2noise_val + global_std + local_median_val + +The ``openpiv.scaling`` module +------------------------------ + +.. automodule:: openpiv.scaling + +.. currentmodule:: openpiv.scaling + +.. autosummary:: + :toctree: generated/ + + uniform diff --git a/_sources/developers.txt b/_sources/developers.txt new file mode 100644 index 00000000..33823e6d --- /dev/null +++ b/_sources/developers.txt @@ -0,0 +1,45 @@ +Information for developers and contributors +=========================================== + +OpenPiv need developers to improve further. Your support, code and contribution is very welcome and +we are grateful you can provide some. Please send us an email to openpiv-develop@lists.sourceforge.net +to get started, or for any kind of information. + +We use `git `_ for development version control, and we have a main repository on `github `_. + + +Development workflow +-------------------- +This is absolutely not a comprehensive guide of git development, and it is only an indication of our workflow. + +1) Download and install git. Instruction can be found `here `_. +2) Set up a github account. +3) Clone OpenPiv repository using:: + + git clone http://github.com/alexlib/openpiv-python.git + +4) create a branch `new_feature` where you implement your new feature. +5) Fix, change, implement, document code, ... +6) From time to time fetch and merge your master branch with that of the main repository. +7) Be sure that everything is ok and works in your branch. +8) Merge your master branch with your `new_feature` branch. +9) Be sure that everything is now ok and works in you master branch. +10) Send a `pull request `_. + +11) Create another branch for a new feature. + +Which language can i use? +------------------------- +As a general rule, we use Python where it does not make any difference with code speed. In those situations where Python speed is +the bottleneck, we have some possibilities, depending on your skills and background. If something has to be written from scratch +use the first language from the following which you are confortable with: cython, c, c++, fortran. If you have existing, debugged, tested code that +you would like to share, then no problem. We accept it, whichever language may be written in! + +Things OpenPiv currently needs, (in order of importance) +-------------------------------------------------------- +* The implementation of advanced processing algorithms +* Good documentations +* Flow field filtering and validation functions +* Cython wrappers for c/c++ codes. +* a good graphical user interface + diff --git a/_sources/downloads_page.txt b/_sources/downloads_page.txt new file mode 100644 index 00000000..b8cb9d6b --- /dev/null +++ b/_sources/downloads_page.txt @@ -0,0 +1,14 @@ +.. _downloads: + +Download OpenPIV Example +======================== + +Tutorial files +-------------- + +These are zip files containing sample images and python scripts for analysing them with OpenPIV. These files are included in the source code if cloned from the Git. + + +Part 1: how to process an image pair. :download:`source code and sample images ` + +Part 2: how to process in batch a list of image pairs. :download:`source code and sample images ` diff --git a/_sources/faq.txt b/_sources/faq.txt new file mode 100644 index 00000000..bc87edcc --- /dev/null +++ b/_sources/faq.txt @@ -0,0 +1,53 @@ +Frequently Asked Questions +========================== + +OpenPIV - what is it for? +-------------------------- + +OpenPIV is an initiative of scientists to develop a software, algorithms and methods for the state-of-the-art experimental tool of Particle Image Velocimetry (PIV) which are free, open source, and easy to operate. +OpenPIV is the successor of the well known URAPIV software - it is faster, more friendly and much more flexible. +OpenPIV is provided using Matlab, Python or 32bit Windows executable (based on C++ and Qt source). + +How to cite this work +---------------------- + +Taylor, Z.J.; Gurka, R.; Kopp, G.A.; Liberzon, A.; , "Long-Duration Time-Resolved PIV to Study Unsteady Aerodynamics," Instrumentation and Measurement, IEEE Transactions on , vol.59, no.12, pp.3262-3269, Dec. 2010 +doi: 10.1109/TIM.2010.2047149 +URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5464317&isnumber=5609237 + + +How to contribute ? +-------------------- + +Python or Matlab versions: + +1. Open Github account +2. Visit our Git repositories through https://github.com/openpiv +3. Fork Matlab, Python or C++ repository +4. Fix, commit, push to your repository and send us a pull request. +5. Register on openpiv-develop mailing list through http://sf.net/projects/openpiv + + +How to download the C++/Qt version +----------------------------------- + +Visit http://www.openpiv.net for the direct links to various versions + + +Getting started tutorials +--------------------------- + +See the screencast http://www.youtube.com/watch?v=63o-UpKgxF0 of our Matlab version. + +Python and C++ versions video tutorials are in preparation. + + + +Support and documentation +-------------------------- + +How to get support? Where to ask questions? + +1. Sourceforge.net forums https://sourceforge.net/projects/openpiv/support[[BR]] +2. e-mail to openpiv2008@gmail.com +3. Open a feature request or bug issue on Github. diff --git a/_sources/gui_doc.txt b/_sources/gui_doc.txt new file mode 100644 index 00000000..6df496d4 --- /dev/null +++ b/_sources/gui_doc.txt @@ -0,0 +1,10 @@ +.. _gui: + +==================================== +The OpenPIV graphical user interface +==================================== + + +Under construction ... + + diff --git a/_sources/index.txt b/_sources/index.txt index 30604511..0db4985e 100644 --- a/_sources/index.txt +++ b/_sources/index.txt @@ -1,34 +1,40 @@ -.. OpenPiv documentation master file, created by +.. OpenPIV documentation master file, created by sphinx-quickstart on Mon Apr 18 23:22:32 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -OpenPiv: a python package for PIV image analysis. +OpenPIV: a python package for PIV image analysis. ================================================= -OpenPiv is a effort of scientists to deliver a tool for the analysis of PIV images +OpenPIV is a effort of scientists to deliver a tool for the analysis of PIV images using state-of-the-art algorithms. Openpiv is released under the `GPL Licence `_, which means that the source code is freely available for users to study, copy, modify and improve. Because of its permissive licence, you are welcome to download and try -OpenPiv for whatever need you may have. Furthermore, you are encouraged to contribute -to OpenPiv, with code, suggestions and critics. +OpenPIV for whatever need you may have. Furthermore, you are encouraged to contribute +to OpenPIV, with code, suggestions and critics. -OpenPiv exists in three forms: Matlab, C++ and Python. This is the home page of the Python implementation. +OpenPIV exists in three forms: Matlab, C++ and Python. This is the home page of the Python implementation. ========= Contents: ========= .. toctree:: - :maxdepth: 1 + :maxdepth: 2 :titlesonly: - src/installation_instruction - src/developers - src/tutorial - src/api_reference - + introduction + faq + installation_instruction + developers + tutorial + downloads_page + api_reference + gui_doc + + + Indices and tables ================== diff --git a/_sources/installation_instruction.txt b/_sources/installation_instruction.txt new file mode 100644 index 00000000..eda19185 --- /dev/null +++ b/_sources/installation_instruction.txt @@ -0,0 +1,104 @@ +.. _installation_instruction: + +======================== +Installation instruction +======================== + +.. _dependencies: + +Dependencies +============ + +OpenPIV would not have been possible if other great open source projects did not +exist. We make extensive use of code and tools that other people have created, so +you should install them before you can use OpenPIV. + +The dependencies are: + +* `python `_ +* `scipy `_ +* `numpy `_ +* `cython `_ + +On all platforms, the binary Enthought Python Distribution (EPD) is recommended. +Visit http://www.enthought.com + +How to install the dependencies on Linux +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +On a Linux platform installing these dependencies should be trick. Often, if not always, +python is installed by default, while the other dependencies should appear in your package +manager. + +How to install the dependencies on Windows +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +On Windows all these dependencies, as well as several other useful packages, can be installed +using the Python(x,y) distribution, available at http://www.pythonxy.com/. Note: Install it in Custom Directories, +without spaces in the directory names (i.e. Program Files are prohibited), e.g. C:\Pythonxy\ + + +How to install the dependencies on a Mac +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com. However, if you use EPD Free distribution, you need to install Cython from http://www.cython.org + + + + +Get OpenPIV source code! +======================== + +At this moment the only way to get OpenPIV's source code is using git. +`Git `_ Git is a distributed revision control system and +our code is hosted at `GitHub `_. + +Bleeding edge development version +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are interested in the source code you are welcome to browse out git repository +stored at https://github.com/alexlib/openpiv-python. If you want to download the source code +on your machine, for testing, you need to set up git on your computer. Please look at +http://help.github.com/ which provide extensive help for how to set up git. + +To follow the development of OpenPIV, clone our repository with the command:: + + git clone http://github.com/alexlib/openpiv-python.git + +and update from time to time. You can also download a tarball containing everything. + +Then add the path where the OpenPIV source are to the PYTHONPATH environment variable, so +that OpenPIV module can be imported and used in your programs. Remeber to build the extension +with :: + + python setup.py build + +.. Stable source distribution +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. If you do not want to follow the development of OpenPIV and you prefer a more stable +.. version, download the source distributions available at http://www.openpiv.sourceforge.net, +.. in the downloads page. Then unpack it and execute the following command:: + +.. python setupy.py install --prefix=$DIR + +.. where ``$DIR`` is the folder you want ot install OpenPIV in. If you want to install it system +.. wide omit the ``--prefix`` option, but you should have root priviles to do so. Remember to +.. update the PYTHONPATH environment variable if you used a custom installation directory. + + +.. Download pre-built binary distributions +.. ======================================= + +.. For Windows we provide pre-built distributions which can be used without the hassles +.. of compilation and other boring things you may not want to dig into. This is currently a work +.. in progress. Check back soon! + + + +Having problems? +================ +If you encountered some issues, found difficult to install OpenPIV following these instructions +please drop us an email to openpiv-develop@lists.sourceforge.net , so that we can help you and +improve this page! + + + + + diff --git a/_sources/introduction.txt b/_sources/introduction.txt new file mode 100644 index 00000000..42ad9d58 --- /dev/null +++ b/_sources/introduction.txt @@ -0,0 +1,20 @@ +Introduction +============ + + +Why this project? +----------------- +Particle Image Velocimetry is the state-of-the-art measurement technique and it's not so much magic behind the analysis of images that create velocity vector maps. Not so much magic is also in converting those velocity maps into very useful information for scientists, doctors and engineers. We started PIV at the times when the only available software was commercial, closed-source (who knew the open source then) and extremely buggy. We had to write our own algorithms to analyse our PIV data. We believe in open science, open engineering and open source. We believe in sharing and we believe in collaboration. Please, join us, if you share the same vision. + + +How this project has started? +----------------------------- + +This project started in 1998 by then graduate students, Roi Gurka and Alex Liberzon, under supervision of Dr. Uri Shavit at the Technion, Haifa. At that time, the project was called (for the obvious reasons) URAPIV. The original software was written in Matlab (probably version 4 or 5) and released as an open source as a Matlab toolbox. + + +Where this project is going? +---------------------------- + +Our plans are to create a crowd minded open source alternative to the commercial source-closed projects that promise high quality and high reproducibility of the scientific and industrial PIV-based measurements and analysis. + diff --git a/_sources/src/api_reference.txt b/_sources/src/api_reference.txt index 4e8c0c25..73f70e69 100644 --- a/_sources/src/api_reference.txt +++ b/_sources/src/api_reference.txt @@ -5,6 +5,18 @@ API reference This is a complete api reference to the openpiv python module. +The ``openpiv.preprocess`` module +---------------------------------- +.. automodule:: openpiv.preprocess + +.. currentmodule:: openpiv.preprocess + +.. autosummary:: + :toctree: generated/ + + dynamic_masking + + The ``openpiv.tools`` module ---------------------------- .. automodule:: openpiv.tools @@ -17,7 +29,8 @@ The ``openpiv.tools`` module imread save display - + display_vector_field + Multiprocesser The ``openpiv.pyprocess`` module -------------------------------- @@ -35,7 +48,6 @@ The ``openpiv.pyprocess`` module moving_window_array find_first_peak find_second_peak - find_pixel_peak_position find_subpixel_peak_position piv @@ -50,10 +62,26 @@ The ``openpiv.process`` module :toctree: generated/ extended_search_area_piv + CorrelationFunction + get_coordinates + get_field_shape + correlate_windows + normalize_intensity + +The ``openpiv.lib`` module +-------------------------------- +.. automodule:: openpiv.lib + +.. currentmodule:: openpiv.lib + +.. autosummary:: + :toctree: generated/ + sincinterp + replace_nans -The ``openpiv.filters`` module +The ``openpiv.filters`` module ------------------------------ .. automodule:: openpiv.filters @@ -65,6 +93,7 @@ The ``openpiv.filters`` module gaussian _gaussian_kernel + replace_outliers The ``openpiv.validation`` module @@ -79,6 +108,8 @@ The ``openpiv.validation`` module global_val sig2noise_val + global_std + local_median_val The ``openpiv.scaling`` module ------------------------------ diff --git a/_sources/src/developers.txt b/_sources/src/developers.txt index c210aaad..33823e6d 100644 --- a/_sources/src/developers.txt +++ b/_sources/src/developers.txt @@ -16,7 +16,7 @@ This is absolutely not a comprehensive guide of git development, and it is only 2) Set up a github account. 3) Clone OpenPiv repository using:: - git clone http://github.com/gasagna/OpenPiv.git + git clone http://github.com/alexlib/openpiv-python.git 4) create a branch `new_feature` where you implement your new feature. 5) Fix, change, implement, document code, ... diff --git a/_sources/src/downloads_page.txt b/_sources/src/downloads_page.txt new file mode 100644 index 00000000..23c3d2da --- /dev/null +++ b/_sources/src/downloads_page.txt @@ -0,0 +1,14 @@ +.. _downloads: + +Download OpenPIV Example +======================== + +Tutorial files +-------------- + +These are zip files containing sample images and python scripts for analysing them with OpenPIV. These files are included in the source code if cloned from the Git. + + +Part 1: how to process an image pair. :download:`source code and sample images <../downloads/tutorial-part1.zip>` + +Part 2: how to process in batch a list of image pairs. :download:`source code and sample images <../downloads/tutorial-part2.zip>` diff --git a/_sources/src/generated/openpiv.filters.replace_outliers.txt b/_sources/src/generated/openpiv.filters.replace_outliers.txt new file mode 100644 index 00000000..884a7cf2 --- /dev/null +++ b/_sources/src/generated/openpiv.filters.replace_outliers.txt @@ -0,0 +1,6 @@ +openpiv.filters.replace_outliers +================================ + +.. currentmodule:: openpiv.filters + +.. autofunction:: replace_outliers \ No newline at end of file diff --git a/_sources/src/generated/openpiv.lib.replace_nans.txt b/_sources/src/generated/openpiv.lib.replace_nans.txt new file mode 100644 index 00000000..0197862b --- /dev/null +++ b/_sources/src/generated/openpiv.lib.replace_nans.txt @@ -0,0 +1,6 @@ +openpiv.lib.replace_nans +======================== + +.. currentmodule:: openpiv.lib + +.. autofunction:: replace_nans \ No newline at end of file diff --git a/_sources/src/generated/openpiv.lib.sincinterp.txt b/_sources/src/generated/openpiv.lib.sincinterp.txt new file mode 100644 index 00000000..fa5e4ba8 --- /dev/null +++ b/_sources/src/generated/openpiv.lib.sincinterp.txt @@ -0,0 +1,6 @@ +openpiv.lib.sincinterp +====================== + +.. currentmodule:: openpiv.lib + +.. autofunction:: sincinterp \ No newline at end of file diff --git a/_sources/src/generated/openpiv.preprocess.dynamic_masking.txt b/_sources/src/generated/openpiv.preprocess.dynamic_masking.txt new file mode 100644 index 00000000..9a5a3ae9 --- /dev/null +++ b/_sources/src/generated/openpiv.preprocess.dynamic_masking.txt @@ -0,0 +1,6 @@ +openpiv.preprocess.dynamic_masking +================================== + +.. currentmodule:: openpiv.preprocess + +.. autofunction:: dynamic_masking \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.CorrelationFunction.txt b/_sources/src/generated/openpiv.process.CorrelationFunction.txt new file mode 100644 index 00000000..5944ccfb --- /dev/null +++ b/_sources/src/generated/openpiv.process.CorrelationFunction.txt @@ -0,0 +1,24 @@ +openpiv.process.CorrelationFunction +=================================== + +.. currentmodule:: openpiv.process + +.. autoclass:: CorrelationFunction + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~CorrelationFunction.__init__ + ~CorrelationFunction.sig2noise_ratio + ~CorrelationFunction.subpixel_peak_position + + + + + + \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.correlate_windows.txt b/_sources/src/generated/openpiv.process.correlate_windows.txt new file mode 100644 index 00000000..0348d448 --- /dev/null +++ b/_sources/src/generated/openpiv.process.correlate_windows.txt @@ -0,0 +1,6 @@ +openpiv.process.correlate_windows +================================= + +.. currentmodule:: openpiv.process + +.. autofunction:: correlate_windows \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.extended_search_area_piv.txt b/_sources/src/generated/openpiv.process.extended_search_area_piv.txt new file mode 100644 index 00000000..1757277b --- /dev/null +++ b/_sources/src/generated/openpiv.process.extended_search_area_piv.txt @@ -0,0 +1,6 @@ +openpiv.process.extended_search_area_piv +======================================== + +.. currentmodule:: openpiv.process + +.. autofunction:: extended_search_area_piv \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.get_coordinates.txt b/_sources/src/generated/openpiv.process.get_coordinates.txt new file mode 100644 index 00000000..e97a7ada --- /dev/null +++ b/_sources/src/generated/openpiv.process.get_coordinates.txt @@ -0,0 +1,6 @@ +openpiv.process.get_coordinates +=============================== + +.. currentmodule:: openpiv.process + +.. autofunction:: get_coordinates \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.get_field_shape.txt b/_sources/src/generated/openpiv.process.get_field_shape.txt new file mode 100644 index 00000000..5f3f360b --- /dev/null +++ b/_sources/src/generated/openpiv.process.get_field_shape.txt @@ -0,0 +1,6 @@ +openpiv.process.get_field_shape +=============================== + +.. currentmodule:: openpiv.process + +.. autofunction:: get_field_shape \ No newline at end of file diff --git a/_sources/src/generated/openpiv.process.normalize_intensity.txt b/_sources/src/generated/openpiv.process.normalize_intensity.txt new file mode 100644 index 00000000..7e2b5384 --- /dev/null +++ b/_sources/src/generated/openpiv.process.normalize_intensity.txt @@ -0,0 +1,6 @@ +openpiv.process.normalize_intensity +=================================== + +.. currentmodule:: openpiv.process + +.. autofunction:: normalize_intensity \ No newline at end of file diff --git a/_sources/src/generated/openpiv.pyprocess.demean.txt b/_sources/src/generated/openpiv.pyprocess.demean.txt deleted file mode 100644 index e725bc5f..00000000 --- a/_sources/src/generated/openpiv.pyprocess.demean.txt +++ /dev/null @@ -1,6 +0,0 @@ -openpiv.pyprocess.demean -======================== - -.. currentmodule:: openpiv.pyprocess - -.. autofunction:: demean \ No newline at end of file diff --git a/_sources/src/generated/openpiv.pyprocess.find_pixel_peak_position.txt b/_sources/src/generated/openpiv.pyprocess.find_pixel_peak_position.txt deleted file mode 100644 index 0d3051a9..00000000 --- a/_sources/src/generated/openpiv.pyprocess.find_pixel_peak_position.txt +++ /dev/null @@ -1,6 +0,0 @@ -openpiv.pyprocess.find_pixel_peak_position -========================================== - -.. currentmodule:: openpiv - -.. automethod:: pyprocess.find_pixel_peak_position \ No newline at end of file diff --git a/_sources/src/generated/openpiv.pyprocess.normalize_intensity.txt b/_sources/src/generated/openpiv.pyprocess.normalize_intensity.txt index fc68d5bd..23578e7e 100644 --- a/_sources/src/generated/openpiv.pyprocess.normalize_intensity.txt +++ b/_sources/src/generated/openpiv.pyprocess.normalize_intensity.txt @@ -1,6 +1,6 @@ openpiv.pyprocess.normalize_intensity ===================================== -.. currentmodule:: openpiv +.. currentmodule:: openpiv.pyprocess -.. automethod:: pyprocess.normalize_intensity \ No newline at end of file +.. autofunction:: normalize_intensity \ No newline at end of file diff --git a/_sources/src/generated/openpiv.pyprocess.signal_noise_ratio.txt b/_sources/src/generated/openpiv.pyprocess.signal_noise_ratio.txt deleted file mode 100644 index 8c85b698..00000000 --- a/_sources/src/generated/openpiv.pyprocess.signal_noise_ratio.txt +++ /dev/null @@ -1,6 +0,0 @@ -openpiv.pyprocess.signal_noise_ratio -==================================== - -.. currentmodule:: openpiv.pyprocess - -.. autofunction:: signal_noise_ratio \ No newline at end of file diff --git a/_sources/src/generated/openpiv.tools.Multiprocesser.txt b/_sources/src/generated/openpiv.tools.Multiprocesser.txt new file mode 100644 index 00000000..04734b54 --- /dev/null +++ b/_sources/src/generated/openpiv.tools.Multiprocesser.txt @@ -0,0 +1,23 @@ +openpiv.tools.Multiprocesser +============================ + +.. currentmodule:: openpiv.tools + +.. autoclass:: Multiprocesser + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~Multiprocesser.__init__ + ~Multiprocesser.run + + + + + + \ No newline at end of file diff --git a/_sources/src/generated/openpiv.tools.display_vector_field.txt b/_sources/src/generated/openpiv.tools.display_vector_field.txt new file mode 100644 index 00000000..18e78ff4 --- /dev/null +++ b/_sources/src/generated/openpiv.tools.display_vector_field.txt @@ -0,0 +1,6 @@ +openpiv.tools.display_vector_field +================================== + +.. currentmodule:: openpiv.tools + +.. autofunction:: display_vector_field \ No newline at end of file diff --git a/_sources/src/generated/openpiv.validation.global_std.txt b/_sources/src/generated/openpiv.validation.global_std.txt new file mode 100644 index 00000000..21c059d7 --- /dev/null +++ b/_sources/src/generated/openpiv.validation.global_std.txt @@ -0,0 +1,6 @@ +openpiv.validation.global_std +============================= + +.. currentmodule:: openpiv.validation + +.. autofunction:: global_std \ No newline at end of file diff --git a/_sources/src/generated/openpiv.validation.global_val.txt b/_sources/src/generated/openpiv.validation.global_val.txt new file mode 100644 index 00000000..bfa8c94e --- /dev/null +++ b/_sources/src/generated/openpiv.validation.global_val.txt @@ -0,0 +1,6 @@ +openpiv.validation.global_val +============================= + +.. currentmodule:: openpiv.validation + +.. autofunction:: global_val \ No newline at end of file diff --git a/_sources/src/generated/openpiv.validation.local_median_val.txt b/_sources/src/generated/openpiv.validation.local_median_val.txt new file mode 100644 index 00000000..262ea1be --- /dev/null +++ b/_sources/src/generated/openpiv.validation.local_median_val.txt @@ -0,0 +1,6 @@ +openpiv.validation.local_median_val +=================================== + +.. currentmodule:: openpiv.validation + +.. autofunction:: local_median_val \ No newline at end of file diff --git a/_sources/src/generated/openpiv.validation.sig2noise_val.txt b/_sources/src/generated/openpiv.validation.sig2noise_val.txt new file mode 100644 index 00000000..0a21a75c --- /dev/null +++ b/_sources/src/generated/openpiv.validation.sig2noise_val.txt @@ -0,0 +1,6 @@ +openpiv.validation.sig2noise_val +================================ + +.. currentmodule:: openpiv.validation + +.. autofunction:: sig2noise_val \ No newline at end of file diff --git a/_sources/src/gui_doc.txt b/_sources/src/gui_doc.txt index 8de2c25b..a7e0b0f9 100644 --- a/_sources/src/gui_doc.txt +++ b/_sources/src/gui_doc.txt @@ -1,5 +1,5 @@ .. _gui: ==================================== -The OpenPiv graphical user interface +The OpenPIV graphical user interface ==================================== diff --git a/_sources/src/installation_instruction.txt b/_sources/src/installation_instruction.txt index e7f99e49..eda19185 100644 --- a/_sources/src/installation_instruction.txt +++ b/_sources/src/installation_instruction.txt @@ -4,18 +4,21 @@ Installation instruction ======================== +.. _dependencies: + Dependencies ============ -OpenPiv would not have been possible if other great open source projects did not +OpenPIV would not have been possible if other great open source projects did not exist. We make extensive use of code and tools that other people have created, so -you should install them before you can use OpenPiv. +you should install them before you can use OpenPIV. The dependencies are: * `python `_ * `scipy `_ * `numpy `_ +* `cython `_ On all platforms, the binary Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com @@ -29,17 +32,21 @@ manager. How to install the dependencies on Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ On Windows all these dependencies, as well as several other useful packages, can be installed -using the Python(x,y) distribution, available at http://www.pythonxy.com/ +using the Python(x,y) distribution, available at http://www.pythonxy.com/. Note: Install it in Custom Directories, +without spaces in the directory names (i.e. Program Files are prohibited), e.g. C:\Pythonxy\ + How to install the dependencies on a Mac ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com +The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com. However, if you use EPD Free distribution, you need to install Cython from http://www.cython.org + + -Get Openpiv source code! +Get OpenPIV source code! ======================== -At this moment the only way to get OpenPiv's source code is using git. +At this moment the only way to get OpenPIV's source code is using git. `Git `_ Git is a distributed revision control system and our code is hosted at `GitHub `_. @@ -47,31 +54,31 @@ Bleeding edge development version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you are interested in the source code you are welcome to browse out git repository -stored at https://github.com/gasagna/OpenPiv. If you want to download the source code +stored at https://github.com/alexlib/openpiv-python. If you want to download the source code on your machine, for testing, you need to set up git on your computer. Please look at http://help.github.com/ which provide extensive help for how to set up git. -To follow the development of OpenPiv, clone our repository with the command:: +To follow the development of OpenPIV, clone our repository with the command:: git clone http://github.com/alexlib/openpiv-python.git and update from time to time. You can also download a tarball containing everything. -Then add the path where the OpenPiv source are to the PYTHONPATH environment variable, so -that OpenPiv module can be imported and used in your programs. Remeber to build the extension +Then add the path where the OpenPIV source are to the PYTHONPATH environment variable, so +that OpenPIV module can be imported and used in your programs. Remeber to build the extension with :: python setup.py build .. Stable source distribution .. ^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. If you do not want to follow the development of OpenPiv and you prefer a more stable +.. If you do not want to follow the development of OpenPIV and you prefer a more stable .. version, download the source distributions available at http://www.openpiv.sourceforge.net, .. in the downloads page. Then unpack it and execute the following command:: .. python setupy.py install --prefix=$DIR -.. where ``$DIR`` is the folder you want ot install OpenPiv in. If you want to install it system +.. where ``$DIR`` is the folder you want ot install OpenPIV in. If you want to install it system .. wide omit the ``--prefix`` option, but you should have root priviles to do so. Remember to .. update the PYTHONPATH environment variable if you used a custom installation directory. @@ -87,7 +94,7 @@ with :: Having problems? ================ -If you encountered some issues, found difficult to install OpenPiv following these instructions +If you encountered some issues, found difficult to install OpenPIV following these instructions please drop us an email to openpiv-develop@lists.sourceforge.net , so that we can help you and improve this page! diff --git a/_sources/src/tutorial.txt b/_sources/src/tutorial.txt index 65f15ceb..ce73b4b3 100644 --- a/_sources/src/tutorial.txt +++ b/_sources/src/tutorial.txt @@ -1,72 +1,127 @@ -======== +======== Tutorial ======== -This tutorial focuses on the use of the openpiv python module for scripting. This tutorial only shows some of the most commonly used features of -OpenPiv. Check the complete API reference at :ref:`api_reference` +This is a series of examples and tutorials which focuses on showing features and capabilities of OpenPIV, so that after reading you should be able to set up scripts for your own analyses. If you are looking for a complete reference to the OpenPiv api, please look at :ref:`api_reference`. It is assumed that you have Openpiv installed on your system along with a working python environment as well as the necessary :ref:`OpenPiv dependencies `. For installation details on various platforms see :ref:`installation_instruction`. + -First step is to install OpenPiv. For installation details -on various platforms see :ref:`installation_instruction`. +In this tutorial we are going to use some example data provided with the source distribution of OpenPIV. Altough it is not necessary, you may find helpful to actually run the code examples as the tutorial progresses. If you downloaded a tarball file, you should find these examples under the directory openpiv/docs/examples. Similarly if you cloned the git repository. If you cannot find them, dowload example images as well as the python source code from the :ref:`downloads ` page. -This tutorial uses some of the example data provided with the source distribution -of OpenPiv that you can find in our `GitHub repository `_. First example: how to process an image pair =========================================== -Here is a complete working example showing how to process an image pair. :: +The first example shows how to process a single image pair. This is a common task and may be useful if you are studying how does a certain algorithm behaves. We assume that the current working directory is where the two image of the first example are located. Here is the code:: import openpiv.tools - import openpiv.pyprocess + import openpiv.process import openpiv.scaling frame_a = openpiv.tools.imread( 'exp1_001_a.bmp' ) frame_b = openpiv.tools.imread( 'exp1_001_b.bmp' ) - u, v = openpiv.pyprocess.piv( frame_a, frame_b, window_size=48, overlap=32, dt=0.02, sig2noise_lim=1.5 ) - x, y = openpiv.pyprocess.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 ) - x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 1236.6 ) + u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' ) - openpiv.tools.save(x, y, u, v, 'exp1_001.txt') + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 ) + + u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 ) + + u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2) + x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 ) + + openpiv.tools.save(x, y, u, v, 'exp1_001.txt' ) + +This code can be executed as a script, or you can type each command in an `Ipython `_ console with pylab mode set, so that you can visualize result as they are available. I will follow the second option and i will present the results of each command. We first import some of the openpiv modules.:: import openpiv.tools - import openpiv.pyprocess + import openpiv.process import openpiv.scaling -Module ``openpiv.tools`` contains mostly contains utilities and tools, such as file I/O and multiprocessing -facilities. Module ``openpi.pyprocess`` contains a pure Python implementation of the PIV cross-correlation -algorithm and several helper functions. Last, module ``openpiv.scaling`` contains function for field scaling -and plate calibration stuff. +Module ``openpiv.tools`` contains mostly contains utilities and tools, such as file I/O and multiprocessingvfacilities. Module ``openpiv.process`` contains advanced algorithms for PIV analysis and several helper functions. Last, module ``openpiv.scaling`` contains functions for field scaling. We then load the two image files into numpy arrays:: frame_a = openpiv.tools.imread( 'exp1_001_a.bmp' ) frame_b = openpiv.tools.imread( 'exp1_001_b.bmp' ) -In this example we use the pure python implementation to get the velocity field from the image pair.:: +Inspecting the attributes of one of the two images we can see that:: + + frame_a.shape + (369, 511) + + frame_a.dtype + dtype('int32') + +image has a size of 369x511 pixels and are contained in 32 bit integer arrays. Using pylab graphical capabilities it is easy to visualize one of the two frames::: + + matshow ( frame_a, cmap=cm.Greys _r ) + +which results in this figure. + +.. image:: ../images/image1.png + :height: 500px + :align: center + +In this example we are going to use the function :py:func:`openpiv.process.extended_search_area_piv` to process the image pair.:: + + u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' ) - u, v = openpiv.pyprocess.piv( frame_a, frame_b, window_size=48, overlap=32, dt=0.02, sig2noise_lim=1.5 ) -The function :py:func:`openpiv.pyprocess.piv` is a python implementation of the standard cross-correlation -algorithm. We also provide some options to the function, namely the ``window_size``, i.e. the size of the -interrogation windows, the ``overlap`` between the windows in pixels and the time delay in seconds ``dt`` between -the two image frames. ``sig2noise_lim`` is the lower limit for the signal to noise ratio accepted before a vector is considered -an outlier. +This method is a zero order displacement predictor cross-correlation algorithm, which cope with the problem of loss of pairs when the interrogation window is small, by increasing the search area on the second image. We also provide some options to the function, namely the ``window_size``, i.e. the size of the interrogation window on ``frame_a``, the ``overlap`` in pixels between adjacent windows, the time delay in seconds ``dt`` between the two image frames an te size in pixels of the extended search area on ``frame_b``. ``sig2noise_method`` specifies which method to use for the evalutaion of the signal/noise ratio. The function also returns a third array, ``sig2noise`` which contains the signal to noise ratio obtained from each cross-correlation function, intended as the ratio between the heigth of the first and second peaks. -We then compute the coordinates of the centers of the interrogation windows using :py:func:`openpiv.pyprocess.get_coordinates`.:: +We then compute the coordinates of the centers of the interrogation windows using :py:func:`openpiv.process.get_coordinates`.:: - x, y = openpiv.pyprocess.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 ) + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 ) -Note that we have provided some the same options we have given in the previuos command. +Note that we have provided some the same options we have given in the previous command to the processing function. + +We can now plot the vector plot on a new figure to inspect the result of the analysis, using:: -Then we apply an uniform scaling with the function :py:func:`openpiv.scaling.uniform` providing the ``scaling_factor`` value, in pixels per meters -if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively. :: + close() + quiver( x, y, u, v ) + +and we obtain: - x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 1236.6 ) +.. image:: ../images/image2.png + :height: 500px + :align: center + +Several outliers vectors can be observed as a result of the small interrogation window size and we need to apply a validation scheme. Since we have information about the signal to noise ratio of the cross-correlation function we can apply a well know filtering scheme, classifing a vector as an outlier if its signal to noise ratio exceeds a certain threshold. To accomplish this task we use the function:: + + u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 ) + +with a threshold value set to ``1.3``. This function actually sets to NaN all those vector for which the signal to noise ratio is below 1.3. Therefore, the +arrays ``u`` and ``v`` contains some np.nan elements. Furthermore, we get in output a third variable ``mask``, which is a boolean array where elements corresponding to invalid vectors have been replace by Nan. The result of the filtering is shown in the following image, which we obtain with the two commands:: + + figure() + quiver( x, y, u, v ) + +.. image:: ../images/image3.png + :height: 500px + :align: center + +The final step is to replace the missing vector. This is done which the function :py:func:`openpiv.filters.replace_outliers`, which implements an iterative image inpainting algorithm with a specified kernel. We pass to this function the two velocity components arrays, a method type ``localmean``, the number of passes and the size of the kernel.:: + + u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2 ) + +The flow field now appears much more smooth and the outlier vectors have been correctly replaced. :: + + figure() + quiver( x, y, u, v ) + +.. image:: ../images/image4.png + :height: 500px + :align: center + + + +The last step is to apply an uniform scaling to the flow field to get dimensional units. We use the function :py:func:`openpiv.scaling.uniform` providing the ``scaling_factor`` value, in pixels per meters if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively. :: + + x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 ) Finally we save the data to an ascii file, for later processing, using::: @@ -74,34 +129,26 @@ Finally we save the data to an ascii file, for later processing, using::: Second example: how to process in batch a list of image pairs. -================================================================= +============================================================== -It if often the case, where several hundreds of image pairs have been sampled -in an experiment and have to be processed. For these tasks it is easier to -launch the analysis in batch and process all the image pairs -with the same processing parameters. OpenPiv, with its powerful python -scripting capabilities, provides a convenient way to -accomplish this task and offers multiprocessing facilities for machines -which have multiple cores, to speed up the computation. Since the analysis -is an embarassingly parallel problem, the speed up that can be reached -is quite high and almost equal to the number of core your machine has. +It if often the case, where several hundreds of image pairs have been sampled in an experiment and have to be processed. For these tasks it is easier to launch the analysis in batch and process all the image pairs with the same processing parameters. OpenPiv, with its powerful python scripting capabilities, provides a convenient way to accomplish this task and offers multiprocessing facilities for machines which have multiple cores, to speed up the computation. Since the analysis is an embarassingly parallel problem, the speed up that can be reached is quite high and almost equal to the number of core your machine has. -Compared to the previous example we have to setup some more things in the python -script we will use for the batch processing. +Compared to the previous example we have to setup some more things in the python script we will use for the batch processing. Let's first import the needed modules.:: import openpiv.tools import openpiv.scaling - import openpiv.pyprocess + import openpiv.process -We then define a python function which will be excecuted for each image pair. -Here it is::: +We then define a python function which will be excecuted for each image pair. In this function we can specify any operation to execute on each single image pair, but here, for clarity we will setup a basic analysis, without a validation/replacement step. + +Here is an example of valid python function::: def func( args ): """A function to process each image pair.""" - # this line is REQUIRED for the multiprocessing to work + # this line is REQUIRED for multiprocessing to work # always use it in your custom function file_a, file_b, counter = args @@ -115,41 +162,37 @@ Here it is::: frame_a = openpiv.tools.imread( file_a ) frame_b = openpiv.tools.imread( file_b ) - # process image pair with the purepython implementation - u, v = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=24*3 ) + # process image pair with extended search area piv algorithm. + u, v = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=32, overlap=16, dt=0.02, search_area_size=64 ) # get window centers coordinates - x, y = openpiv.pyprocess.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 ) - - # get flow field in dimensional units: 1236.6 are pixels per millimiters so x, y, u, v will be in millimeters and millimeters/seconds - x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 16.7 ) + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=32, overlap=16 ) # save to a file openpiv.tools.save(x, y, u, v, 'exp1_%03d.txt' % counter, fmt='%8.7f', delimiter='\t' ) -The function we have written *must* accept in input a single argument. This argument is a three element tuple, which -you have to unpack in the function as we have done with:: +The function we have specified *must* accept in input a single argument. This argument is a three element tuple, which you have to unpack inside the function body as we have done with:: file_a, file_b, counter = args -The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair -we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into -its three elements, you can use them to load the images and do the rest. +The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into its three elements, you can use them to load the images and do the rest. -This is just half of the job. In the same script we are going to write the following two lines of code.:: +The *simple* processing function we wrote is just half of the job. We still need to specify which image pairs to process and where they are located. Therefore, in the same script we add the following two lines of code.:: - task = openpiv.tools.Multiprocesser( data_dir = '/home/User/images', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' ) + task = openpiv.tools.Multiprocesser( data_dir = '.', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' ) task.run( func = func, n_cpus=8 ) -The first line creates an instance of the :py:func:`Openpiv.tools.Multiprocesser` class. To construct the class -you have to pass three arguments: +where we have set datadir to ``.`` because the script and the images are in the same folder. The first line creates an instance of the :py:func:`openpiv.tools.Multiprocesser` class. This class is responsible of sharing the processing work to multiple processes, so that the analysis can be executed in parallell. To construct the class you have to pass it three arguments: * ``data_dir``: the directory where image files are located * ``pattern_a`` and ``pattern_b``: the patterns for matching image files for frames `a` and `b`. -The second line actually launch the batch process, using for each image pair the ``func`` function we have provided. Note that we have set the ``n_cpus`` option -to be equal to ``8`` becasue my machine has eight core. You should not set ``n_cpus`` higher than the number of -core your machine has, becasue you don't get any speed up. + +.. note:: + Variables ``pattern_a`` and ``pattern_b`` are shell globbing patterns. Let 's say we have thousands of files for frame `a` in a sequence like file0001-a.tif, file0002-a.tif, file0003-a.tif, file0004-a.tif, ..., and the same for frames `b` file0001-b.tif, file0002-b.tif, file0003-b.tif, file0004-b.tif. To match these files we would set ``pattern_a = file*-a.tif`` and ``pattern_b = file*-a.tif``. Basically, the `*` is a wildcard to match 0001, 0002, 0003, ... + + +The second line actually launches the batch process, using for each image pair the ``func`` function we have provided. Note that we have set the ``n_cpus`` option to be equal to ``8`` just because my machine has eight cores. You should not set ``n_cpus`` higher than the number of core your machine has, because you would not get any speed up. diff --git a/_sources/tutorial.txt b/_sources/tutorial.txt new file mode 100644 index 00000000..84025f09 --- /dev/null +++ b/_sources/tutorial.txt @@ -0,0 +1,201 @@ +======== +Tutorial +======== + +This is a series of examples and tutorials which focuses on showing features and capabilities of OpenPIV, so that after reading you should be able to set up scripts for your own analyses. If you are looking for a complete reference to the OpenPiv api, please look at :ref:`api_reference`. It is assumed that you have Openpiv installed on your system along with a working python environment as well as the necessary :ref:`OpenPiv dependencies `. For installation details on various platforms see :ref:`installation_instruction`. + + +In this tutorial we are going to use some example data provided with the source distribution of OpenPIV. Altough it is not necessary, you may find helpful to actually run the code examples as the tutorial progresses. If you downloaded a tarball file, you should find these examples under the directory ``openpiv/docs/examples``. Similarly if you cloned the git repository. If you cannot find them, dowload example images as well as the python source code from the :ref:`downloads ` page. + + +First example: how to process an image pair +=========================================== + +The first example shows how to process a single image pair. This is a common task and may be useful if you are studying how does a certain algorithm behaves. We assume that the current working directory is where the two image of the first example are located. Here is the code:: + + + import openpiv.tools + import openpiv.process + import openpiv.scaling + + frame_a = openpiv.tools.imread( 'exp1_001_a.bmp' ) + frame_b = openpiv.tools.imread( 'exp1_001_b.bmp' ) + + u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' ) + + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 ) + + u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 ) + + u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2) + + x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 ) + + openpiv.tools.save(x, y, u, v, 'exp1_001.txt' ) + +This code can be executed as a script, or you can type each command in an `Ipython `_ console with pylab mode set, so that you can visualize result as they are available. I will follow the second option and i will present the results of each command. + +We first import some of the openpiv modules.:: + + import openpiv.tools + import openpiv.process + import openpiv.scaling + +Module ``openpiv.tools`` contains mostly contains utilities and tools, such as file I/O and multiprocessingvfacilities. Module ``openpiv.process`` contains advanced algorithms for PIV analysis and several helper functions. Last, module ``openpiv.scaling`` contains functions for field scaling. + +We then load the two image files into numpy arrays:: + + frame_a = openpiv.tools.imread( 'exp1_001_a.bmp' ) + frame_b = openpiv.tools.imread( 'exp1_001_b.bmp' ) + +Inspecting the attributes of one of the two images we can see that:: + + frame_a.shape + (369, 511) + + frame_a.dtype + dtype('int32') + +image has a size of 369x511 pixels and are contained in 32 bit integer arrays. Using pylab graphical capabilities it is easy to visualize one of the two frames::: + + matshow ( frame_a, cmap=cm.Greys _r ) + +which results in this figure. + +.. image:: ./images/image1.png + :height: 500px + :align: center + +In this example we are going to use the function :py:func:`openpiv.process.extended_search_area_piv` to process the image pair.:: + + u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' ) + + +This method is a zero order displacement predictor cross-correlation algorithm, which cope with the problem of loss of pairs when the interrogation window is small, by increasing the search area on the second image. We also provide some options to the function, namely the ``window_size``, i.e. the size of the interrogation window on ``frame_a``, the ``overlap`` in pixels between adjacent windows, the time delay in seconds ``dt`` between the two image frames an te size in pixels of the extended search area on ``frame_b``. ``sig2noise_method`` specifies which method to use for the evalutaion of the signal/noise ratio. The function also returns a third array, ``sig2noise`` which contains the signal to noise ratio obtained from each cross-correlation function, intended as the ratio between the heigth of the first and second peaks. + +We then compute the coordinates of the centers of the interrogation windows using :py:func:`openpiv.process.get_coordinates`.:: + + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 ) + +Note that we have provided some the same options we have given in the previous command to the processing function. + +We can now plot the vector plot on a new figure to inspect the result of the analysis, using:: + + close() + quiver( x, y, u, v ) + +and we obtain: + +.. image:: ./images/image2.png + :height: 500px + :align: center + +Several outliers vectors can be observed as a result of the small interrogation window size and we need to apply a validation scheme. Since we have information about the signal to noise ratio of the cross-correlation function we can apply a well know filtering scheme, classifing a vector as an outlier if its signal to noise ratio exceeds a certain threshold. To accomplish this task we use the function:: + + u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 ) + +with a threshold value set to ``1.3``. This function actually sets to NaN all those vector for which the signal to noise ratio is below 1.3. Therefore, the +arrays ``u`` and ``v`` contains some np.nan elements. Furthermore, we get in output a third variable ``mask``, which is a boolean array where elements corresponding to invalid vectors have been replace by Nan. The result of the filtering is shown in the following image, which we obtain with the two commands:: + + figure() + quiver( x, y, u, v ) + +.. image:: ./images/image3.png + :height: 500px + :align: center + +The final step is to replace the missing vector. This is done which the function :py:func:`openpiv.filters.replace_outliers`, which implements an iterative image inpainting algorithm with a specified kernel. We pass to this function the two velocity components arrays, a method type ``localmean``, the number of passes and the size of the kernel.:: + + u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2 ) + +The flow field now appears much more smooth and the outlier vectors have been correctly replaced. :: + + figure() + quiver( x, y, u, v ) + +.. image:: ./images/image4.png + :height: 500px + :align: center + + + +The last step is to apply an uniform scaling to the flow field to get dimensional units. We use the function :py:func:`openpiv.scaling.uniform` providing the ``scaling_factor`` value, in pixels per meters if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively. :: + + x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 ) + +Finally we save the data to an ascii file, for later processing, using::: + + openpiv.tools.save(x, y, u, v, 'exp1_001.txt') + + +Second example: how to process in batch a list of image pairs. +============================================================== + +It if often the case, where several hundreds of image pairs have been sampled in an experiment and have to be processed. For these tasks it is easier to launch the analysis in batch and process all the image pairs with the same processing parameters. OpenPiv, with its powerful python scripting capabilities, provides a convenient way to accomplish this task and offers multiprocessing facilities for machines which have multiple cores, to speed up the computation. Since the analysis is an embarassingly parallel problem, the speed up that can be reached is quite high and almost equal to the number of core your machine has. + +Compared to the previous example we have to setup some more things in the python script we will use for the batch processing. + +Let's first import the needed modules.:: + + import openpiv.tools + import openpiv.scaling + import openpiv.process + +We then define a python function which will be excecuted for each image pair. In this function we can specify any operation to execute on each single image pair, but here, for clarity we will setup a basic analysis, without a validation/replacement step. + +Here is an example of valid python function::: + + def func( args ): + """A function to process each image pair.""" + + # this line is REQUIRED for multiprocessing to work + # always use it in your custom function + + file_a, file_b, counter = args + + + ##################### + # Here goes you code + ##################### + + # read images into numpy arrays + frame_a = openpiv.tools.imread( file_a ) + frame_b = openpiv.tools.imread( file_b ) + + # process image pair with extended search area piv algorithm. + u, v = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=32, overlap=16, dt=0.02, search_area_size=64 ) + + # get window centers coordinates + x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=32, overlap=16 ) + + # save to a file + openpiv.tools.save(x, y, u, v, 'exp1_%03d.txt' % counter, fmt='%8.7f', delimiter='\t' ) + +The function we have specified *must* accept in input a single argument. This argument is a three element tuple, which you have to unpack inside the function body as we have done with:: + + file_a, file_b, counter = args + +The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into its three elements, you can use them to load the images and do the rest. + +The *simple* processing function we wrote is just half of the job. We still need to specify which image pairs to process and where they are located. Therefore, in the same script we add the following two lines of code.:: + + task = openpiv.tools.Multiprocesser( data_dir = '.', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' ) + task.run( func = func, n_cpus=8 ) + +where we have set datadir to ``.`` because the script and the images are in the same folder. The first line creates an instance of the :py:func:`openpiv.tools.Multiprocesser` class. This class is responsible of sharing the processing work to multiple processes, so that the analysis can be executed in parallell. To construct the class you have to pass it three arguments: + +* ``data_dir``: the directory where image files are located +* ``pattern_a`` and ``pattern_b``: the patterns for matching image files for frames `a` and `b`. + + +.. note:: + Variables ``pattern_a`` and ``pattern_b`` are shell globbing patterns. Let 's say we have thousands of files for frame `a` in a sequence like file0001-a.tif, file0002-a.tif, file0003-a.tif, file0004-a.tif, ..., and the same for frames `b` file0001-b.tif, file0002-b.tif, file0003-b.tif, file0004-b.tif. To match these files we would set ``pattern_a = file*-a.tif`` and ``pattern_b = file*-a.tif``. Basically, the `*` is a wildcard to match 0001, 0002, 0003, ... + + +The second line actually launches the batch process, using for each image pair the ``func`` function we have provided. Note that we have set the ``n_cpus`` option to be equal to ``8`` just because my machine has eight cores. You should not set ``n_cpus`` higher than the number of core your machine has, because you would not get any speed up. + + + + + + diff --git a/_static/ajax-loader.gif b/_static/ajax-loader.gif new file mode 100644 index 00000000..61faf8ca Binary files /dev/null and b/_static/ajax-loader.gif differ diff --git a/_static/basic.css b/_static/basic.css index 32630d54..43e8bafa 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -79,6 +79,14 @@ div.sphinxsidebar input { font-size: 1em; } +div.sphinxsidebar #searchbox input[type="text"] { + width: 170px; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + width: 30px; +} + img { border: 0; } @@ -236,7 +244,6 @@ img.align-center, .figure.align-center, object.align-center { } .align-center { - clear: both; text-align: center; } @@ -440,6 +447,11 @@ dl.glossary dt { font-style: oblique; } +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + /* -- code displays --------------------------------------------------------- */ pre { @@ -525,4 +537,4 @@ span.eqno { #top-link { display: none; } -} +} \ No newline at end of file diff --git a/_static/comment-bright.png b/_static/comment-bright.png new file mode 100644 index 00000000..551517b8 Binary files /dev/null and b/_static/comment-bright.png differ diff --git a/_static/comment-close.png b/_static/comment-close.png new file mode 100644 index 00000000..09b54be4 Binary files /dev/null and b/_static/comment-close.png differ diff --git a/_static/comment.png b/_static/comment.png new file mode 100644 index 00000000..92feb52b Binary files /dev/null and b/_static/comment.png differ diff --git a/_static/doctools.js b/_static/doctools.js index 8b9bd2c0..d4619fdf 100644 --- a/_static/doctools.js +++ b/_static/doctools.js @@ -2,7 +2,7 @@ * doctools.js * ~~~~~~~~~~~ * - * Sphinx JavaScript utilties for all documentation. + * Sphinx JavaScript utilities for all documentation. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. @@ -185,9 +185,9 @@ var Documentation = { body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); - $('') - .appendTo($('.sidebar .this-page-menu')); + $('') + .appendTo($('#searchbox')); } }, @@ -213,7 +213,7 @@ var Documentation = { * helper function to hide the search marks again */ hideSearchWords : function() { - $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); + $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); }, diff --git a/_static/down-pressed.png b/_static/down-pressed.png new file mode 100644 index 00000000..6f7ad782 Binary files /dev/null and b/_static/down-pressed.png differ diff --git a/_static/down.png b/_static/down.png new file mode 100644 index 00000000..3003a887 Binary files /dev/null and b/_static/down.png differ diff --git a/_static/pygments.css b/_static/pygments.css index 1a14f2ae..d79caa15 100644 --- a/_static/pygments.css +++ b/_static/pygments.css @@ -13,11 +13,11 @@ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ -.highlight .go { color: #303030 } /* Generic.Output */ +.highlight .go { color: #333333 } /* Generic.Output */ .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ diff --git a/_static/searchtools.js b/_static/searchtools.js index dae92b5e..663be4c9 100644 --- a/_static/searchtools.js +++ b/_static/searchtools.js @@ -1,6 +1,6 @@ /* - * searchtools.js - * ~~~~~~~~~~~~~~ + * searchtools.js_t + * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilties for the full-text search. * @@ -36,10 +36,11 @@ jQuery.makeSearchSummary = function(text, keywords, hlwords) { return rv; } + /** * Porter Stemmer */ -var PorterStemmer = function() { +var Stemmer = function() { var step2list = { ational: 'ate', @@ -300,20 +301,20 @@ var Search = { }, query : function(query) { - var stopwords = ['and', 'then', 'into', 'it', 'as', 'are', 'in', - 'if', 'for', 'no', 'there', 'their', 'was', 'is', - 'be', 'to', 'that', 'but', 'they', 'not', 'such', - 'with', 'by', 'a', 'on', 'these', 'of', 'will', - 'this', 'near', 'the', 'or', 'at']; - - // stem the searchterms and add them to the correct list - var stemmer = new PorterStemmer(); + var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"]; + + // Stem the searchterms and add them to the correct list + var stemmer = new Stemmer(); var searchterms = []; var excluded = []; var hlterms = []; var tmp = query.split(/\s+/); - var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null; + var objectterms = []; for (var i = 0; i < tmp.length; i++) { + if (tmp[i] != "") { + objectterms.push(tmp[i].toLowerCase()); + } + if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) || tmp[i] == "") { // skip this "word" @@ -344,9 +345,6 @@ var Search = { var filenames = this._index.filenames; var titles = this._index.titles; var terms = this._index.terms; - var objects = this._index.objects; - var objtypes = this._index.objtypes; - var objnames = this._index.objnames; var fileMap = {}; var files = null; // different result priorities @@ -357,40 +355,19 @@ var Search = { $('#search-progress').empty(); // lookup as object - if (object != null) { - for (var prefix in objects) { - for (var name in objects[prefix]) { - var fullname = (prefix ? prefix + '.' : '') + name; - if (fullname.toLowerCase().indexOf(object) > -1) { - match = objects[prefix][name]; - descr = objnames[match[1]] + _(', in ') + titles[match[0]]; - // XXX the generated anchors are not generally correct - // XXX there may be custom prefixes - result = [filenames[match[0]], fullname, '#'+fullname, descr]; - switch (match[2]) { - case 1: objectResults.push(result); break; - case 0: importantResults.push(result); break; - case 2: unimportantResults.push(result); break; - } - } - } - } + for (var i = 0; i < objectterms.length; i++) { + var others = [].concat(objectterms.slice(0,i), + objectterms.slice(i+1, objectterms.length)) + var results = this.performObjectSearch(objectterms[i], others); + // Assume first word is most likely to be the object, + // other words more likely to be in description. + // Therefore put matches for earlier words first. + // (Results are eventually used in reverse order). + objectResults = results[0].concat(objectResults); + importantResults = results[1].concat(importantResults); + unimportantResults = results[2].concat(unimportantResults); } - // sort results descending - objectResults.sort(function(a, b) { - return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); - }); - - importantResults.sort(function(a, b) { - return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); - }); - - unimportantResults.sort(function(a, b) { - return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); - }); - - // perform the search on the required terms for (var i = 0; i < searchterms.length; i++) { var word = searchterms[i]; @@ -489,7 +466,7 @@ var Search = { listItem.slideDown(5, function() { displayNextItem(); }); - }); + }, "text"); } else { // no source available, just display title Search.output.append(listItem); @@ -510,9 +487,74 @@ var Search = { } } displayNextItem(); + }, + + performObjectSearch : function(object, otherterms) { + var filenames = this._index.filenames; + var objects = this._index.objects; + var objnames = this._index.objnames; + var titles = this._index.titles; + + var importantResults = []; + var objectResults = []; + var unimportantResults = []; + + for (var prefix in objects) { + for (var name in objects[prefix]) { + var fullname = (prefix ? prefix + '.' : '') + name; + if (fullname.toLowerCase().indexOf(object) > -1) { + var match = objects[prefix][name]; + var objname = objnames[match[1]][2]; + var title = titles[match[0]]; + // If more than one term searched for, we require other words to be + // found in the name/title/description + if (otherterms.length > 0) { + var haystack = (prefix + ' ' + name + ' ' + + objname + ' ' + title).toLowerCase(); + var allfound = true; + for (var i = 0; i < otherterms.length; i++) { + if (haystack.indexOf(otherterms[i]) == -1) { + allfound = false; + break; + } + } + if (!allfound) { + continue; + } + } + var descr = objname + _(', in ') + title; + anchor = match[3]; + if (anchor == '') + anchor = fullname; + else if (anchor == '-') + anchor = objnames[match[1]][1] + '-' + fullname; + result = [filenames[match[0]], fullname, '#'+anchor, descr]; + switch (match[2]) { + case 1: objectResults.push(result); break; + case 0: importantResults.push(result); break; + case 2: unimportantResults.push(result); break; + } + } + } + } + + // sort results descending + objectResults.sort(function(a, b) { + return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); + }); + + importantResults.sort(function(a, b) { + return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); + }); + + unimportantResults.sort(function(a, b) { + return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); + }); + + return [importantResults, objectResults, unimportantResults] } } $(document).ready(function() { Search.init(); -}); +}); \ No newline at end of file diff --git a/_static/sidebar.js b/_static/sidebar.js index e9ef491c..a45e1926 100644 --- a/_static/sidebar.js +++ b/_static/sidebar.js @@ -29,6 +29,9 @@ $(function() { var sidebar = $('.sphinxsidebar'); var sidebarwrapper = $('.sphinxsidebarwrapper'); + // for some reason, the document has no sidebar; do not run into errors + if (!sidebar.length) return; + // original margin-left of the bodywrapper and width of the sidebar // with the sidebar expanded var bw_margin_expanded = bodywrapper.css('margin-left'); diff --git a/_static/underscore.js b/_static/underscore.js index 9146e086..5d899143 100644 --- a/_static/underscore.js +++ b/_static/underscore.js @@ -1,3 +1,10 @@ +// Underscore.js 0.5.5 +// (c) 2009 Jeremy Ashkenas, DocumentCloud Inc. +// Underscore is freely distributable under the terms of the MIT license. +// Portions of Underscore are inspired by or borrowed from Prototype.js, +// Oliver Steele's Functional, and John Resig's Micro-Templating. +// For all details and documentation: +// http://documentcloud.github.com/underscore/ (function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e 0) { + var start = document.cookie.indexOf('sortBy='); + if (start != -1) { + start = start + 7; + var end = document.cookie.indexOf(";", start); + if (end == -1) { + end = document.cookie.length; + by = unescape(document.cookie.substring(start, end)); + } + } + } + setComparator(); + } + + /** + * Show a comment div. + */ + function show(id) { + $('#ao' + id).hide(); + $('#ah' + id).show(); + var context = $.extend({id: id}, opts); + var popup = $(renderTemplate(popupTemplate, context)).hide(); + popup.find('textarea[name="proposal"]').hide(); + popup.find('a.by' + by).addClass('sel'); + var form = popup.find('#cf' + id); + form.submit(function(event) { + event.preventDefault(); + addComment(form); + }); + $('#s' + id).after(popup); + popup.slideDown('fast', function() { + getComments(id); + }); + } + + /** + * Hide a comment div. + */ + function hide(id) { + $('#ah' + id).hide(); + $('#ao' + id).show(); + var div = $('#sc' + id); + div.slideUp('fast', function() { + div.remove(); + }); + } + + /** + * Perform an ajax request to get comments for a node + * and insert the comments into the comments tree. + */ + function getComments(id) { + $.ajax({ + type: 'GET', + url: opts.getCommentsURL, + data: {node: id}, + success: function(data, textStatus, request) { + var ul = $('#cl' + id); + var speed = 100; + $('#cf' + id) + .find('textarea[name="proposal"]') + .data('source', data.source); + + if (data.comments.length === 0) { + ul.html('
  • No comments yet.
  • '); + ul.data('empty', true); + } else { + // If there are comments, sort them and put them in the list. + var comments = sortComments(data.comments); + speed = data.comments.length * 100; + appendComments(comments, ul); + ul.data('empty', false); + } + $('#cn' + id).slideUp(speed + 200); + ul.slideDown(speed); + }, + error: function(request, textStatus, error) { + showError('Oops, there was a problem retrieving the comments.'); + }, + dataType: 'json' + }); + } + + /** + * Add a comment via ajax and insert the comment into the comment tree. + */ + function addComment(form) { + var node_id = form.find('input[name="node"]').val(); + var parent_id = form.find('input[name="parent"]').val(); + var text = form.find('textarea[name="comment"]').val(); + var proposal = form.find('textarea[name="proposal"]').val(); + + if (text == '') { + showError('Please enter a comment.'); + return; + } + + // Disable the form that is being submitted. + form.find('textarea,input').attr('disabled', 'disabled'); + + // Send the comment to the server. + $.ajax({ + type: "POST", + url: opts.addCommentURL, + dataType: 'json', + data: { + node: node_id, + parent: parent_id, + text: text, + proposal: proposal + }, + success: function(data, textStatus, error) { + // Reset the form. + if (node_id) { + hideProposeChange(node_id); + } + form.find('textarea') + .val('') + .add(form.find('input')) + .removeAttr('disabled'); + var ul = $('#cl' + (node_id || parent_id)); + if (ul.data('empty')) { + $(ul).empty(); + ul.data('empty', false); + } + insertComment(data.comment); + var ao = $('#ao' + node_id); + ao.find('img').attr({'src': opts.commentBrightImage}); + if (node_id) { + // if this was a "root" comment, remove the commenting box + // (the user can get it back by reopening the comment popup) + $('#ca' + node_id).slideUp(); + } + }, + error: function(request, textStatus, error) { + form.find('textarea,input').removeAttr('disabled'); + showError('Oops, there was a problem adding the comment.'); + } + }); + } + + /** + * Recursively append comments to the main comment list and children + * lists, creating the comment tree. + */ + function appendComments(comments, ul) { + $.each(comments, function() { + var div = createCommentDiv(this); + ul.append($(document.createElement('li')).html(div)); + appendComments(this.children, div.find('ul.comment-children')); + // To avoid stagnating data, don't store the comments children in data. + this.children = null; + div.data('comment', this); + }); + } + + /** + * After adding a new comment, it must be inserted in the correct + * location in the comment tree. + */ + function insertComment(comment) { + var div = createCommentDiv(comment); + + // To avoid stagnating data, don't store the comments children in data. + comment.children = null; + div.data('comment', comment); + + var ul = $('#cl' + (comment.node || comment.parent)); + var siblings = getChildren(ul); + + var li = $(document.createElement('li')); + li.hide(); + + // Determine where in the parents children list to insert this comment. + for(i=0; i < siblings.length; i++) { + if (comp(comment, siblings[i]) <= 0) { + $('#cd' + siblings[i].id) + .parent() + .before(li.html(div)); + li.slideDown('fast'); + return; + } + } + + // If we get here, this comment rates lower than all the others, + // or it is the only comment in the list. + ul.append(li.html(div)); + li.slideDown('fast'); + } + + function acceptComment(id) { + $.ajax({ + type: 'POST', + url: opts.acceptCommentURL, + data: {id: id}, + success: function(data, textStatus, request) { + $('#cm' + id).fadeOut('fast'); + $('#cd' + id).removeClass('moderate'); + }, + error: function(request, textStatus, error) { + showError('Oops, there was a problem accepting the comment.'); + } + }); + } + + function deleteComment(id) { + $.ajax({ + type: 'POST', + url: opts.deleteCommentURL, + data: {id: id}, + success: function(data, textStatus, request) { + var div = $('#cd' + id); + if (data == 'delete') { + // Moderator mode: remove the comment and all children immediately + div.slideUp('fast', function() { + div.remove(); + }); + return; + } + // User mode: only mark the comment as deleted + div + .find('span.user-id:first') + .text('[deleted]').end() + .find('div.comment-text:first') + .text('[deleted]').end() + .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id + + ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id) + .remove(); + var comment = div.data('comment'); + comment.username = '[deleted]'; + comment.text = '[deleted]'; + div.data('comment', comment); + }, + error: function(request, textStatus, error) { + showError('Oops, there was a problem deleting the comment.'); + } + }); + } + + function showProposal(id) { + $('#sp' + id).hide(); + $('#hp' + id).show(); + $('#pr' + id).slideDown('fast'); + } + + function hideProposal(id) { + $('#hp' + id).hide(); + $('#sp' + id).show(); + $('#pr' + id).slideUp('fast'); + } + + function showProposeChange(id) { + $('#pc' + id).hide(); + $('#hc' + id).show(); + var textarea = $('#pt' + id); + textarea.val(textarea.data('source')); + $.fn.autogrow.resize(textarea[0]); + textarea.slideDown('fast'); + } + + function hideProposeChange(id) { + $('#hc' + id).hide(); + $('#pc' + id).show(); + var textarea = $('#pt' + id); + textarea.val('').removeAttr('disabled'); + textarea.slideUp('fast'); + } + + function toggleCommentMarkupBox(id) { + $('#mb' + id).toggle(); + } + + /** Handle when the user clicks on a sort by link. */ + function handleReSort(link) { + var classes = link.attr('class').split(/\s+/); + for (var i=0; iThank you! Your comment will show up ' + + 'once it is has been approved by a moderator.'); + } + // Prettify the comment rating. + comment.pretty_rating = comment.rating + ' point' + + (comment.rating == 1 ? '' : 's'); + // Make a class (for displaying not yet moderated comments differently) + comment.css_class = comment.displayed ? '' : ' moderate'; + // Create a div for this comment. + var context = $.extend({}, opts, comment); + var div = $(renderTemplate(commentTemplate, context)); + + // If the user has voted on this comment, highlight the correct arrow. + if (comment.vote) { + var direction = (comment.vote == 1) ? 'u' : 'd'; + div.find('#' + direction + 'v' + comment.id).hide(); + div.find('#' + direction + 'u' + comment.id).show(); + } + + if (opts.moderator || comment.text != '[deleted]') { + div.find('a.reply').show(); + if (comment.proposal_diff) + div.find('#sp' + comment.id).show(); + if (opts.moderator && !comment.displayed) + div.find('#cm' + comment.id).show(); + if (opts.moderator || (opts.username == comment.username)) + div.find('#dc' + comment.id).show(); + } + return div; + } + + /** + * A simple template renderer. Placeholders such as <%id%> are replaced + * by context['id'] with items being escaped. Placeholders such as <#id#> + * are not escaped. + */ + function renderTemplate(template, context) { + var esc = $(document.createElement('div')); + + function handle(ph, escape) { + var cur = context; + $.each(ph.split('.'), function() { + cur = cur[this]; + }); + return escape ? esc.text(cur || "").html() : cur; + } + + return template.replace(/<([%#])([\w\.]*)\1>/g, function() { + return handle(arguments[2], arguments[1] == '%' ? true : false); + }); + } + + /** Flash an error message briefly. */ + function showError(message) { + $(document.createElement('div')).attr({'class': 'popup-error'}) + .append($(document.createElement('div')) + .attr({'class': 'error-message'}).text(message)) + .appendTo('body') + .fadeIn("slow") + .delay(2000) + .fadeOut("slow"); + } + + /** Add a link the user uses to open the comments popup. */ + $.fn.comment = function() { + return this.each(function() { + var id = $(this).attr('id').substring(1); + var count = COMMENT_METADATA[id]; + var title = count + ' comment' + (count == 1 ? '' : 's'); + var image = count > 0 ? opts.commentBrightImage : opts.commentImage; + var addcls = count == 0 ? ' nocomment' : ''; + $(this) + .append( + $(document.createElement('a')).attr({ + href: '#', + 'class': 'sphinx-comment-open' + addcls, + id: 'ao' + id + }) + .append($(document.createElement('img')).attr({ + src: image, + alt: 'comment', + title: title + })) + .click(function(event) { + event.preventDefault(); + show($(this).attr('id').substring(2)); + }) + ) + .append( + $(document.createElement('a')).attr({ + href: '#', + 'class': 'sphinx-comment-close hidden', + id: 'ah' + id + }) + .append($(document.createElement('img')).attr({ + src: opts.closeCommentImage, + alt: 'close', + title: 'close' + })) + .click(function(event) { + event.preventDefault(); + hide($(this).attr('id').substring(2)); + }) + ); + }); + }; + + var opts = { + processVoteURL: '/_process_vote', + addCommentURL: '/_add_comment', + getCommentsURL: '/_get_comments', + acceptCommentURL: '/_accept_comment', + deleteCommentURL: '/_delete_comment', + commentImage: '/static/_static/comment.png', + closeCommentImage: '/static/_static/comment-close.png', + loadingImage: '/static/_static/ajax-loader.gif', + commentBrightImage: '/static/_static/comment-bright.png', + upArrow: '/static/_static/up.png', + downArrow: '/static/_static/down.png', + upArrowPressed: '/static/_static/up-pressed.png', + downArrowPressed: '/static/_static/down-pressed.png', + voting: false, + moderator: false + }; + + if (typeof COMMENT_OPTIONS != "undefined") { + opts = jQuery.extend(opts, COMMENT_OPTIONS); + } + + var popupTemplate = '\ +
    \ +

    \ + Sort by:\ + best rated\ + newest\ + oldest\ +

    \ +
    Comments
    \ +
    \ + loading comments...
    \ +
      \ +
      \ +

      Add a comment\ + (markup):

      \ +
      \ + reStructured text markup: *emph*, **strong**, \ + ``code``, \ + code blocks: :: and an indented block after blank line
      \ +
      \ + \ +

      \ + \ + Propose a change ▹\ + \ + \ + Propose a change ▿\ + \ +

      \ + \ + \ + \ + \ +
      \ +
      \ +
      '; + + var commentTemplate = '\ +
      \ +
      \ +
      \ + \ + \ + \ + \ + \ + \ +
      \ +
      \ + \ + \ + \ + \ + \ + \ +
      \ +
      \ +
      \ +

      \ + <%username%>\ + <%pretty_rating%>\ + <%time.delta%>\ +

      \ +
      <#text#>
      \ +

      \ + \ + reply ▿\ + proposal ▹\ + proposal ▿\ + \ + \ +

      \ +
      \
      +<#proposal_diff#>\
      +        
      \ +
        \ +
        \ +
        \ +
        \ + '; + + var replyTemplate = '\ +
      • \ +
        \ +
        \ + \ + \ + \ + \ + \ +
        \ +
        \ +
      • '; + + $(document).ready(function() { + init(); + }); +})(jQuery); + +$(document).ready(function() { + // add comment anchors for all paragraphs that are commentable + $('.sphinx-has-comment').comment(); + + // highlight search words in search results + $("div.context").each(function() { + var params = $.getQueryParameters(); + var terms = (params.q) ? params.q[0].split(/\s+/) : []; + var result = $(this); + $.each(terms, function() { + result.highlightText(this.toLowerCase(), 'highlighted'); + }); + }); + + // directly open comment window if requested + var anchor = document.location.hash; + if (anchor.substring(0, 9) == '#comment-') { + $('#ao' + anchor.substring(9)).click(); + document.location.hash = '#s' + anchor.substring(9); + } +}); diff --git a/api_reference.html b/api_reference.html new file mode 100644 index 00000000..4ae8d95b --- /dev/null +++ b/api_reference.html @@ -0,0 +1,159 @@ + + + + + + + + + + API reference — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        API reference

        +

        This is a complete api reference to the openpiv python module.

        +
        +

        The openpiv.preprocess module

        +

        This module contains a pure python implementation of the basic +cross-correlation algorithm for PIV image processing.

        +
        +
        +

        The openpiv.tools module

        +

        The openpiv.tools module is a collection of utilities and tools.

        +
        +
        +

        The openpiv.pyprocess module

        +

        This module contains a pure python implementation of the basic +cross-correlation algorithm for PIV image processing.

        +
        +
        +

        The openpiv.process module

        +

        This module is dedicated to advanced algorithms for PIV image analysis.

        +
        +
        +

        The openpiv.lib module

        +

        A module for various utilities and helper functions

        +
        +
        +

        The openpiv.filters module

        +

        The openpiv.filters module contains some filtering/smoothing routines.

        +
        +
        +

        The openpiv.validation module

        +

        A module for spurious vector detection.

        +
        +
        +

        The openpiv.scaling module

        +

        Scaling utilities

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Download OpenPIV Example

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/developers.html b/developers.html new file mode 100644 index 00000000..f4dce4d4 --- /dev/null +++ b/developers.html @@ -0,0 +1,180 @@ + + + + + + + + + + Information for developers and contributors — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Information for developers and contributors

        +

        OpenPiv need developers to improve further. Your support, code and contribution is very welcome and +we are grateful you can provide some. Please send us an email to openpiv-develop@lists.sourceforge.net +to get started, or for any kind of information.

        +

        We use git for development version control, and we have a main repository on github.

        +
        +

        Development workflow

        +

        This is absolutely not a comprehensive guide of git development, and it is only an indication of our workflow.

        +
          +
        1. Download and install git. Instruction can be found here.

          +
        2. +
        3. Set up a github account.

          +
        4. +
        5. Clone OpenPiv repository using:

          +
          git clone http://github.com/alexlib/openpiv-python.git
          +
          +
        6. +
        7. create a branch new_feature where you implement your new feature.

          +
        8. +
        9. Fix, change, implement, document code, ...

          +
        10. +
        11. From time to time fetch and merge your master branch with that of the main repository.

          +
        12. +
        13. Be sure that everything is ok and works in your branch.

          +
        14. +
        15. Merge your master branch with your new_feature branch.

          +
        16. +
        17. Be sure that everything is now ok and works in you master branch.

          +
        18. +
        19. Send a pull request.

          +
        20. +
        21. Create another branch for a new feature.

          +
        22. +
        +
        +
        +

        Which language can i use?

        +

        As a general rule, we use Python where it does not make any difference with code speed. In those situations where Python speed is +the bottleneck, we have some possibilities, depending on your skills and background. If something has to be written from scratch +use the first language from the following which you are confortable with: cython, c, c++, fortran. If you have existing, debugged, tested code that +you would like to share, then no problem. We accept it, whichever language may be written in!

        +
        +
        +

        Things OpenPiv currently needs, (in order of importance)

        +
          +
        • The implementation of advanced processing algorithms
        • +
        • Good documentations
        • +
        • Flow field filtering and validation functions
        • +
        • Cython wrappers for c/c++ codes.
        • +
        • a good graphical user interface
        • +
        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Installation instruction

        +

        Next topic

        +

        Tutorial

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/downloads_page.html b/downloads_page.html new file mode 100644 index 00000000..bd49810b --- /dev/null +++ b/downloads_page.html @@ -0,0 +1,133 @@ + + + + + + + + + + Download OpenPIV Example — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Download OpenPIV Example

        +
        +

        Tutorial files

        +

        These are zip files containing sample images and python scripts for analysing them with OpenPIV. These files are included in the source code if cloned from the Git.

        +

        Part 1: how to process an image pair. source code and sample images

        +

        Part 2: how to process in batch a list of image pairs. source code and sample images

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Tutorial

        +

        Next topic

        +

        API reference

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/faq.html b/faq.html new file mode 100644 index 00000000..3ded678a --- /dev/null +++ b/faq.html @@ -0,0 +1,173 @@ + + + + + + + + + + Frequently Asked Questions — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Frequently Asked Questions

        +
        +

        OpenPIV - what is it for?

        +

        OpenPIV is an initiative of scientists to develop a software, algorithms and methods for the state-of-the-art experimental tool of Particle Image Velocimetry (PIV) which are free, open source, and easy to operate. +OpenPIV is the successor of the well known URAPIV software - it is faster, more friendly and much more flexible. +OpenPIV is provided using Matlab, Python or 32bit Windows executable (based on C++ and Qt source).

        +
        +
        +

        How to cite this work

        +

        Taylor, Z.J.; Gurka, R.; Kopp, G.A.; Liberzon, A.; , “Long-Duration Time-Resolved PIV to Study Unsteady Aerodynamics,” Instrumentation and Measurement, IEEE Transactions on , vol.59, no.12, pp.3262-3269, Dec. 2010 +doi: 10.1109/TIM.2010.2047149 +URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5464317&isnumber=5609237

        +
        +
        +

        How to contribute ?

        +

        Python or Matlab versions:

        +
          +
        1. Open Github account
        2. +
        3. Visit our Git repositories through https://github.com/openpiv
        4. +
        5. Fork Matlab, Python or C++ repository
        6. +
        7. Fix, commit, push to your repository and send us a pull request.
        8. +
        9. Register on openpiv-develop mailing list through http://sf.net/projects/openpiv
        10. +
        +
        +
        +

        How to download the C++/Qt version

        +

        Visit http://www.openpiv.net for the direct links to various versions

        +
        +
        +

        Getting started tutorials

        +

        See the screencast http://www.youtube.com/watch?v=63o-UpKgxF0 of our Matlab version.

        +

        Python and C++ versions video tutorials are in preparation.

        +
        +
        +

        Support and documentation

        +

        How to get support? Where to ask questions?

        +
          +
        1. Sourceforge.net forums https://sourceforge.net/projects/openpiv/support[[BR]]
        2. +
        3. e-mail to openpiv2008@gmail.com
        4. +
        5. Open a feature request or bug issue on Github.
        6. +
        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Introduction

        +

        Next topic

        +

        Installation instruction

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html index 9156cf97..13b9d190 100644 --- a/genindex.html +++ b/genindex.html @@ -1,19 +1,24 @@ + + + - Index — OpenPiv v1 documentation + Index — OpenPIV 0.0.1 documentation + + - + + @@ -41,11 +50,52 @@

        Navigation

        @@ -59,7 +109,7 @@

        Index

        \ No newline at end of file diff --git a/np-modindex.html b/gui_doc.html similarity index 53% rename from np-modindex.html rename to gui_doc.html index beab1e4b..44a242b6 100644 --- a/np-modindex.html +++ b/gui_doc.html @@ -3,17 +3,20 @@ + - Python Module Index — OpenPiv v1 documentation + The OpenPIV graphical user interface — OpenPIV 0.0.1 documentation + + - - - - + + + @@ -49,49 +51,10 @@

        Navigation

        - -

        Python Module Index

        - -
        - o -
        - - - - - - - - - - - - - - - - - - - - - - -
         
        - o
        - openpiv -
            - openpiv.filters -
            - openpiv.pyprocess -
            - openpiv.scaling -
            - openpiv.tools -
            - openpiv.validation -
        +
        +

        The OpenPIV graphical user interface

        +

        Under construction ...

        +
        @@ -99,10 +62,18 @@

        Python Module Index

        +

        Previous topic

        +

        API reference

        +

        This Page

        + \ No newline at end of file diff --git a/index.html b/index.html index b0885c0b..634ef6d4 100644 --- a/index.html +++ b/index.html @@ -3,17 +3,20 @@ + - OpenPiv: a python package for PIV image analysis. — OpenPiv v1 documentation + OpenPIV: a python package for PIV image analysis. — OpenPIV 0.0.1 documentation + + - - + + + @@ -45,23 +52,41 @@

        Navigation

        -

        OpenPiv: a python package for PIV image analysis.

        -

        OpenPiv is a effort of scientists to deliver a tool for the analysis of PIV images +

        OpenPIV: a python package for PIV image analysis.

        +

        OpenPIV is a effort of scientists to deliver a tool for the analysis of PIV images using state-of-the-art algorithms. Openpiv is released under the GPL Licence, which means that the source code is freely available for users to study, copy, modify and improve. Because of its permissive licence, you are welcome to download and try -OpenPiv for whatever need you may have. Furthermore, you are encouraged to contribute -to OpenPiv, with code, suggestions and critics.

        -

        OpenPiv exists in three forms: Matlab, C++ and Python. This is the home page of the Python implementation.

        +OpenPIV for whatever need you may have. Furthermore, you are encouraged to contribute +to OpenPIV, with code, suggestions and critics.

        +

        OpenPIV exists in three forms: Matlab, C++ and Python. This is the home page of the Python implementation.

        @@ -83,7 +108,7 @@

        Indices and tables

        Table Of Contents

        \ No newline at end of file diff --git a/installation_instruction.html b/installation_instruction.html new file mode 100644 index 00000000..cdeea4bd --- /dev/null +++ b/installation_instruction.html @@ -0,0 +1,196 @@ + + + + + + + + + + Installation instruction — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Installation instruction

        +
        +

        Dependencies

        +

        OpenPIV would not have been possible if other great open source projects did not +exist. We make extensive use of code and tools that other people have created, so +you should install them before you can use OpenPIV.

        +

        The dependencies are:

        + +

        On all platforms, the binary Enthought Python Distribution (EPD) is recommended. +Visit http://www.enthought.com

        +
        +

        How to install the dependencies on Linux

        +

        On a Linux platform installing these dependencies should be trick. Often, if not always, +python is installed by default, while the other dependencies should appear in your package +manager.

        +
        +
        +

        How to install the dependencies on Windows

        +

        On Windows all these dependencies, as well as several other useful packages, can be installed +using the Python(x,y) distribution, available at http://www.pythonxy.com/. Note: Install it in Custom Directories, +without spaces in the directory names (i.e. Program Files are prohibited), e.g. C:Pythonxy

        +
        +
        +

        How to install the dependencies on a Mac

        +

        The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com. However, if you use EPD Free distribution, you need to install Cython from http://www.cython.org

        +
        +
        +
        +

        Get OpenPIV source code!

        +

        At this moment the only way to get OpenPIV’s source code is using git. +Git Git is a distributed revision control system and +our code is hosted at GitHub.

        +
        +

        Bleeding edge development version

        +

        If you are interested in the source code you are welcome to browse out git repository +stored at https://github.com/alexlib/openpiv-python. If you want to download the source code +on your machine, for testing, you need to set up git on your computer. Please look at +http://help.github.com/ which provide extensive help for how to set up git.

        +

        To follow the development of OpenPIV, clone our repository with the command:

        +
        git clone http://github.com/alexlib/openpiv-python.git
        +
        +

        and update from time to time. You can also download a tarball containing everything.

        +

        Then add the path where the OpenPIV source are to the PYTHONPATH environment variable, so +that OpenPIV module can be imported and used in your programs. Remeber to build the extension +with

        +
        python setup.py build
        +
        +
        +
        +
        +

        Having problems?

        +

        If you encountered some issues, found difficult to install OpenPIV following these instructions +please drop us an email to openpiv-develop@lists.sourceforge.net , so that we can help you and +improve this page!

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Introduction

        +

        Next topic

        +

        Information for developers and contributors

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/introduction.html b/introduction.html new file mode 100644 index 00000000..329f6988 --- /dev/null +++ b/introduction.html @@ -0,0 +1,141 @@ + + + + + + + + + + Introduction — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Introduction

        +
        +

        Why this project?

        +

        Particle Image Velocimetry is the state-of-the-art measurement technique and it’s not so much magic behind the analysis of images that create velocity vector maps. Not so much magic is also in converting those velocity maps into very useful information for scientists, doctors and engineers. We started PIV at the times when the only available software was commercial, closed-source (who knew the open source then) and extremely buggy. We had to write our own algorithms to analyse our PIV data. We believe in open science, open engineering and open source. We believe in sharing and we believe in collaboration. Please, join us, if you share the same vision.

        +
        +
        +

        How this project has started?

        +

        This project started in 1998 by then graduate students, Roi Gurka and Alex Liberzon, under supervision of Dr. Uri Shavit at the Technion, Haifa. At that time, the project was called (for the obvious reasons) URAPIV. The original software was written in Matlab (probably version 4 or 5) and released as an open source as a Matlab toolbox.

        +
        +
        +

        Where this project is going?

        +

        Our plans are to create a crowd minded open source alternative to the commercial source-closed projects that promise high quality and high reproducibility of the scientific and industrial PIV-based measurements and analysis.

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        OpenPIV: a python package for PIV image analysis.

        +

        Next topic

        +

        OpenPIV

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv index 85c72c7c..e1daccce 100644 Binary files a/objects.inv and b/objects.inv differ diff --git a/py-modindex.html b/py-modindex.html index 70684123..c99f76b8 100644 --- a/py-modindex.html +++ b/py-modindex.html @@ -3,17 +3,20 @@ + - Python Module Index — OpenPiv v1 documentation + Python Module Index — OpenPIV 0.0.1 documentation + + - + + @@ -37,10 +41,7 @@

        Navigation

      • modules |
      • -
      • - modules |
      • -
      • OpenPiv v1 documentation »
      • +
      • OpenPIV 0.0.1 documentation »
      • @@ -69,27 +70,42 @@

        Python Module Index

            - openpiv.filters + openpiv.filters     - openpiv.pyprocess + openpiv.lib     - openpiv.scaling + openpiv.preprocess     - openpiv.tools + openpiv.process     - openpiv.validation + openpiv.pyprocess + + + +     + openpiv.scaling + + + +     + openpiv.tools + + + +     + openpiv.validation @@ -102,7 +118,7 @@

        Python Module Index

        \ No newline at end of file diff --git a/search.html b/search.html index b7421996..fa2743ed 100644 --- a/search.html +++ b/search.html @@ -3,17 +3,20 @@ + - Search — OpenPiv v1 documentation + Search — OpenPIV 0.0.1 documentation + + + - + @@ -37,7 +41,10 @@

        Navigation

      • index
      • -
      • OpenPiv v1 documentation »
      • +
      • + modules |
      • +
      • OpenPIV 0.0.1 documentation »
      • @@ -85,12 +92,15 @@

        Navigation

      • index
      • -
      • OpenPiv v1 documentation »
      • +
      • + modules |
      • +
      • OpenPIV 0.0.1 documentation »
      • \ No newline at end of file diff --git a/searchindex.js b/searchindex.js index c64e7300..2a869541 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{},terms:{all:[7,18],code:[7,8,18,20],edg:7,scratch:20,focus:18,correl:18,per:18,follow:[7,18,20],cython:20,depend:[7,20],effort:8,send:20,program:7,matlab:8,under:8,sourc:[7,8,18],whichev:20,util:18,veri:20,bottleneck:20,brows:7,did:7,list:[7,18,20],"try":8,vector:18,becasu:18,pleas:[7,20],batch:18,second:18,pass:18,download:[7,8,20],further:20,index:8,appear:7,compar:18,sig2noise_v:21,workflow:20,uniform:[18,21,6],current:[18,20],version:[7,20],"new":20,net:[7,20],can:[7,18,20],gener:20,remeb:7,here:[18,20],let:18,pattern_a:18,path:7,modifi:8,sinc:18,valu:18,search:8,host:7,studi:8,commonli:18,calibr:18,appli:18,modul:[7,8,18,21],filenam:18,api:[8,18,21],instal:[7,8,18,20],txt:18,unit:18,from:[7,18,20],would:[7,20],visit:7,two:18,recommend:7,paramet:18,more:18,peopl:7,hundr:18,exp1_:18,indic:[8,20],unpack:18,must:18,account:20,graphic:[20,12],setup:[7,18],work:[18,20],whatev:8,find_second_peak:[22,21],fetch:20,def:18,control:[7,20],new_featur:20,sig2noise_lim:18,process:[18,21,20],share:20,accept:[18,20],high:18,critic:8,want:[7,18],tarbal:7,pyprocess:[17,18,4,1,21,2,3,22,15,24,23,11,5,16],ratio:18,delai:18,alwai:[7,18],multipl:18,anoth:20,write:18,how:[7,18],extended_search_area_piv:[18,21],pure:18,imread:[18,10,21],updat:7,outlier:18,clone:[7,20],after:18,befor:[7,18],mac:7,mai:[8,20],data_dir:18,data:18,parallel:18,github:[7,18,20],counter:18,signal_noise_ratio:24,exp1_001:18,element:18,issu:7,inform:[8,20],environ:7,order:20,help:7,get_field_shap:[1,21],becaus:8,meter:18,scientist:8,file_a:18,file_b:18,fix:20,platform:[7,18],window:[7,18],comprehens:20,main:20,pixel:18,them:[7,18],good:20,python:[7,8,18,21,20],half:18,now:20,introduct:13,multiprocess:18,name:18,drop:7,window_s:18,each:18,debug:20,found:[7,20],difficult:7,mean:8,gaussian:[0,21],our:[7,18,20],out:7,variabl:7,accomplish:18,goe:18,open:7,content:8,advanc:20,situat:20,differ:20,standard:18,pythonxi:7,releas:8,bleed:7,millimit:18,find_first_peak:[15,21],veloc:18,filter:[0,21,20,14],thing:[18,20],first:[18,20],moving_window_arrai:[21,11],normalize_intens:[23,21],arrai:18,number:18,instruct:[7,8,18,20],done:18,construct:18,facil:18,size:18,gpl:8,avail:[7,8],given:18,script:18,fmt:18,system:7,wrapper:20,master:20,licenc:8,conveni:18,"final":18,store:7,option:18,tool:[7,8,18,19,9,21,10],copi:8,mostli:18,than:18,kind:20,provid:[7,18,20],project:7,posit:18,analysi:[8,18],comput:[7,18],argument:18,packag:[7,8],complet:[18,21],have:[7,8,18,20],deliv:8,need:[7,8,18,20],purepython:18,scaling_factor:18,excecut:18,note:18,also:[7,18],build:7,which:[7,8,18,20],demean:17,singl:18,sure:20,distribut:[7,18],openpi:18,previou:18,reach:18,most:18,gasagna:[7,20],eight:18,millimet:18,pair:18,everyth:[7,20],don:18,later:18,flow:[18,20],doe:20,show:18,permiss:8,find:18,absolut:20,onli:[7,18,20],locat:18,nois:18,state:8,should:[7,18],plate:18,contribut:[8,20],variou:18,get:[7,18,20],find_subpixel_peak_posit:[3,21],requir:18,stuff:18,contain:[7,18],where:[7,18,20],set:[7,18,20],art:8,frame:18,see:18,"2image_":18,arg:18,confort:20,enthought:7,pattern:18,someth:20,written:[18,20],between:18,"import":[7,18,20],experi:18,email:[7,20],"03d":18,extens:7,job:18,image_s:18,last:18,delimit:18,equal:18,"_gaussian_kernel":[21,14],tutori:[8,18],freeli:8,com:[7,20],load:18,search_area_s:18,linux:7,respect:18,guid:20,quit:18,numpi:[7,18],three:[8,18],been:[7,18],interest:7,basic:18,imag:[8,18],great:7,ani:[18,20],coordin:18,bmp:18,func:18,those:20,"case":18,look:7,sourceforg:[7,20],easier:18,trick:7,defin:18,"while":7,previuo:18,helper:18,almost:18,tabl:8,scipi:7,revis:7,ascii:18,sever:[7,18],develop:[7,8,20],welcom:[7,8,20],suggest:8,make:[7,20],cross:18,same:18,binari:7,instanc:18,document:20,higher:18,http:[7,20],interrog:18,capabl:18,moment:7,user:[8,18,20,12],global_v:21,improv:[7,8,20],implement:[8,18,20],lower:18,task:18,center:18,well:7,openpiv:[0,1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24],exampl:18,command:[7,18],thi:[7,8,18,21,20],epd:7,dimension:18,just:18,rest:18,shape:18,skill:20,speed:[18,20],languag:20,fortran:20,add:7,other:7,input:18,save:[21,18,19],match:18,branch:20,read:18,background:20,bit:7,you:[7,8,18,20],like:20,signal:18,frame_a:18,frame_b:18,output:18,page:[7,8],encount:7,www:7,often:[7,18],some:[7,18,20],sampl:18,home:[8,18],scale:[18,21,6],pattern_b:18,overlap:18,launch:18,refer:[8,18,21],machin:[7,18],core:18,encourag:8,run:18,power:18,step:18,repositori:[7,18,20],actual:18,manag:7,get_coordin:[18,21,16],find_pixel_peak_posit:[21,2],pythonpath:7,alexlib:7,contributor:[8,20],chang:20,your:[7,18,20],correlate_window:[21,4],merg:20,git:[7,20],wai:[7,18],support:20,custom:18,embarassingli:18,start:20,interfac:[20,12],"function":[18,20],form:8,offer:18,tupl:18,grate:20,line:18,pull:20,algorithm:[8,18,20],possibl:[7,20],"default":7,displai:[9,21],limit:18,problem:[7,18,20],featur:[18,20],creat:[7,18,20],request:20,exist:[7,8,20],file:18,n_cpu:18,check:18,piv:[8,5,18,21],detail:18,field:[18,20],valid:[21,20],rememb:18,test:[7,20],tif:18,"class":18,consid:18,furthermor:8,directori:18,exp1_001_a:18,rule:20,exp1_001_b:18,time:[7,18,20]},objtypes:{},titles:["openpiv.filters.gaussian","openpiv.pyprocess.get_field_shape","openpiv.pyprocess.find_pixel_peak_position","openpiv.pyprocess.find_subpixel_peak_position","openpiv.pyprocess.correlate_windows","openpiv.pyprocess.piv","openpiv.scaling.uniform","Installation instruction","OpenPiv: a python package for PIV image analysis.","openpiv.tools.display","openpiv.tools.imread","openpiv.pyprocess.moving_window_array","The OpenPiv graphical user interface","Introduction","openpiv.filters._gaussian_kernel","openpiv.pyprocess.find_first_peak","openpiv.pyprocess.get_coordinates","openpiv.pyprocess.demean","Tutorial","openpiv.tools.save","Information for developers and contributors","API reference","openpiv.pyprocess.find_second_peak","openpiv.pyprocess.normalize_intensity","openpiv.pyprocess.signal_noise_ratio"],objnames:{},filenames:["src/generated/openpiv.filters.gaussian","src/generated/openpiv.pyprocess.get_field_shape","src/generated/openpiv.pyprocess.find_pixel_peak_position","src/generated/openpiv.pyprocess.find_subpixel_peak_position","src/generated/openpiv.pyprocess.correlate_windows","src/generated/openpiv.pyprocess.piv","src/generated/openpiv.scaling.uniform","src/installation_instruction","index","src/generated/openpiv.tools.display","src/generated/openpiv.tools.imread","src/generated/openpiv.pyprocess.moving_window_array","src/gui_doc","src/introduction","src/generated/openpiv.filters._gaussian_kernel","src/generated/openpiv.pyprocess.find_first_peak","src/generated/openpiv.pyprocess.get_coordinates","src/generated/openpiv.pyprocess.demean","src/tutorial","src/generated/openpiv.tools.save","src/developers","src/api_reference","src/generated/openpiv.pyprocess.find_second_peak","src/generated/openpiv.pyprocess.normalize_intensity","src/generated/openpiv.pyprocess.signal_noise_ratio"]}) \ No newline at end of file +Search.setIndex({objects:{openpiv:{lib:[1,0,1,""],process:[1,0,1,""],scaling:[1,0,1,""],filters:[1,0,1,""],preprocess:[1,0,1,""],pyprocess:[1,0,1,""],validation:[1,0,1,""],tools:[1,0,1,""]}},terms:{roi:3,all:[5,8],code:[0,7,5,8,6],edg:5,scratch:7,global:[],v_threshold:[],correl:[1,8],per:8,follow:[7,5,8],moving_window_arrai:[],row:[],cython:[7,5],depend:[7,5,8],unpack:8,intermedi:[],friendli:4,send:[4,7],deviat:[],matlab:[3,0,4],under:[3,0,8,2],preprocess:1,centroid:[],save:8,everyth:[7,5],shavit:3,sourc:[0,3,4,5,6,8],string:[],fals:[],none:[],focus:8,util:[1,8],mechan:[],veri:[3,7],confort:7,bottleneck:7,brows:5,magic:3,level:[],did:5,list:[4,7,5,8,6],sig2noise_method:8,iter:8,"try":0,vector:[3,1,8],larg:[],small:8,prepar:4,dimens:[],smaller:[],subpixel:[],direct:4,batch:[6,8],dowload:8,second:8,video:4,acquist:[],pass:8,download:[0,4,5,6,7,8],further:7,supervis:3,what:4,peak2mean:[],sub:[],correlationfunct:[],sig2noise_v:8,neg:[],pyplot:[],advanc:[1,7,8],abl:8,calcul:[],uniform:8,current:[7,8],version:[3,4,7,5],"new":[7,8],net:[4,7,5],method:[4,8],whatev:0,elimin:[],themselv:[],variat:[],gener:7,remeb:5,here:[7,8],bodi:8,pattern_b:8,pattern_a:8,locat:8,along:8,modifi:0,sinc:8,valu:8,n_iter:8,search:[0,8],forum:4,larger:[],technolog:[],step:8,fetch:7,behav:8,extrem:3,studi:[0,4,8],n_window:[],repositori:[4,7,5,8],dtype:8,modul:[0,1,5,8],ask:[0,4],api:[0,1,8],instal:[0,7,5,8],txt:8,unit:8,plot:8,from:[7,5,8,6],zip:6,doubl:[],visit:[4,5],two:8,vol:4,datadir:8,program:5,call:3,recommend:5,type:8,until:[],more:[4,8],wrapper:7,arnumb:4,corr_max2:[],peopl:5,hundr:8,corr_max1:[],uint8:[],exp1_:8,visual:8,exce:8,indic:[0,7],known:4,effort:0,must:8,account:[4,7],graphic:[0,7,8,2],join:3,analys:[3,6,8],setup:[5,8],work:[4,7,8],can:[7,5,8],find_second_peak:[],dec:4,veloc:[3,8],def:8,control:[7,5],new_featur:7,quiver:8,want:[5,8],process:[1,7,6,8],share:[3,7,8],accept:[7,8],high:[3,8],critic:0,annurev:[],tarbal:[5,8],pyprocess:1,ieeexplor:4,cardin:[],windows_a:[],whichev:7,concept:[],filter:[1,7,8],multipl:8,variou:[1,4,8],thing:[7,8],anoth:7,classifi:[],write:3,how:[3,4,5,8,6],extended_search_area_piv:8,"__init__":[],pure:1,local_median_v:[],simpl:8,updat:5,delai:8,alwai:[5,8],clone:[7,5,8,6],after:8,befor:5,mac:5,plane:[],mai:[0,7,8],develop:[0,4,7,5],data:[3,8],parallel:8,averag:[],github:[4,7,5],third:8,read:8,counter:8,correspond:8,exp1_001:8,element:8,issu:[4,5],inform:[3,0,7,8],environ:[5,8],allow:[],boolen:[],volum:[],order:[7,8],origin:3,help:[5,8],routin:1,over:[],fft:[],get_field_shap:[],becaus:[0,8],meter:8,aerodynam:4,graduat:3,scientist:[3,0,4],through:4,replace_nan:[],still:8,file_a:8,toolbox:3,dynam:[],file_b:8,fix:[4,7],platform:[5,8],window:[4,5,8],pythonpath:5,comprehens:7,mail:4,main:7,easier:8,fil:[],them:[5,8,6],good:7,"return":8,greater:[],thei:8,python:[0,7,4,5,6,1,8],misc:[],initi:4,promis:3,half:8,now:[7,8],introduct:[3,0],window_a:[],u_min:[],multiprocess:8,window_b:[],alex:3,name:[5,8],trac:[],inpaint:8,drop:5,separ:[],window_s:8,screencast:4,mode:8,each:8,debug:7,found:[7,5],higher:8,urapiv:[3,4],mean:0,prohibit:5,weight:[],map:3,replac:8,gaussian:[],contributor:[0,7],sig2nois:8,greyscal:[],liberzon:[3,4],our:[3,4,7,5],neighbourhood:[],out:5,variabl:[5,8],shown:8,accomplish:8,space:5,goe:8,miss:8,outlier:8,content:0,print:[],formula:[],insid:8,workflow:7,pleas:[3,7,5,8],situat:7,given:8,free:[4,5],standard:[],reason:3,base:[3,4],believ:3,pythonxi:5,releas:[3,0],org:[4,5],bleed:5,field_shap:[],find_first_peak:[],could:[],motion:[],stride:[],length:[],vision:3,outsid:[],adrian:[],support:[4,7],frequent:[0,4],first:[7,8],oper:[4,8],softwar:[3,4],rang:[],student:3,obviou:3,normalize_intens:[],arrai:8,clariti:8,qualiti:3,number:8,acquisit:[],instruct:[0,7,5,8],done:8,least:[],facil:8,size:8,gpl:0,avail:[3,0,5,8],differ:7,convent:[],script:[6,8],fmt:8,system:[5,8],messag:[],master:7,v_min:[],tol:[],similarli:8,licenc:0,conveni:8,cite:4,store:5,shell:8,consol:8,option:8,cope:8,tool:[1,0,4,5,8],copi:0,specifi:8,part:6,mostli:8,savetxt:[],than:8,kernel_s:8,kind:7,scheme:8,corr_method:[],provid:[4,7,5,8],remov:[],zero:8,"final":8,project:[3,4,5],str:[],posit:8,grei:8,seri:8,"function":[1,7,8],sai:8,comput:[5,8],januari:[],nffty:[],nfftx:[],mind:3,ani:[7,8],packag:[0,5],width:[],complet:[1,8],have:[0,7,5,8],deliv:0,need:[0,7,5,8],dedic:1,unsteadi:4,scaling_factor:8,date:[],techniqu:3,lib:1,localmean:8,v_max:[],also:[3,5,8],without:[5,8],build:5,which:[0,4,7,5,8],singl:8,sure:7,distribut:[5,8],index:0,glob:8,who:3,reach:8,kean:[],detect:1,eight:8,plan:3,millimet:8,pair:[6,8],"class":8,appear:[5,8],doi:4,technion:3,compar:8,url:4,doc:8,clear:[],later:8,request:[4,7],uri:3,doe:[7,8],wildcard:8,pattern:8,axi:[],someth:7,show:8,text:[],max_it:[],"3x3":[],permiss:0,threshold:8,find:8,absolut:7,onli:[3,7,5],buggi:3,ratio:8,nois:8,transact:4,written:[3,7],should:[5,8],display_vector_field:[],experiment:4,factor:[],folder:8,local:[],contribut:[0,4,7],patter:[],get:[4,7,5,8],watch:4,fluid:[],cannot:8,find_subpixel_peak_posit:[],"import":[7,5,8],increas:8,u_threshold:[],youtub:4,requir:8,experi:8,possibl:[7,5],median:[],"public":[],launch:8,kopp:4,common:8,contain:[1,5,8,6],where:[3,4,7,5,8],valid:[1,7,8],wrote:8,wiki:[],kernel:8,set:[7,5,8],art:[3,0,4],"float":[],frame:8,see:[4,8],"2image_":8,result:8,respons:8,imread:8,close:[3,8],charact:[],particl:[3,4],gmail:4,flexibl:4,enthought:5,correctli:8,ieee:4,review:[],state:[3,0,4],between:8,progress:8,paramet:8,approach:[],email:[7,5],attribut:8,altern:3,kei:[],sincinterp:[],flow:[7,8],"03d":8,extens:5,job:8,matplotlib:[],ipython:8,addit:[],both:[],image_s:8,last:8,delimit:8,float64:[],howev:5,annual:[],equal:8,"_gaussian_kernel":[],subpixel_method:[],tutori:[0,4,6,8],let:8,com:[4,7,5],load:8,search_area_s:8,openpiv2008:4,point:[],color:[],"20start":[],height:[],featur:[4,7,8],path:5,respect:8,guid:7,assum:8,"63o":4,quit:8,arg:8,creat:[3,7,5,8],rgb:[],fortran:7,stamp:4,numpi:[5,8],three:[0,8],been:[5,8],compon:8,spread:[],treat:[],interest:5,basic:[1,8],imag:[0,3,4,6,1,8],exp1_0000:[],convert:3,argument:8,neighbour:[],coordin:8,bmp:8,understand:[],func:8,repres:[],peak2peak:8,present:8,"case":8,multi:[],therefor:8,look:[5,8],sourceforg:[4,7,5],durat:4,trick:5,defin:8,"while":5,observ:8,loop:[],due:[],helper:[1,8],almost:8,tabl:0,submatrix:[],scipi:5,limit:[],revis:5,ascii:8,sever:[5,8],scienc:3,data_dir:8,welcom:[0,7,5],open:[3,4,5],doctor:3,perform:[],suggest:0,make:[7,5],format:[],cross:[1,8],same:[3,8],binari:5,instanc:8,largest:[],document:[4,7],multicor:[],difficult:5,global_std:[],http:[4,7,5],industri:3,interrog:8,capabl:8,moment:5,user:[0,7,2],global_v:[],freeli:0,engin:3,implement:[1,0,7,8],squar:[],task:8,center:8,well:[4,5,8],object:[],excecut:8,openpiv:[0,1,2,4,6,5,7,8],exampl:[0,6,8],command:[5,8],expens:[],thi:[0,1,3,4,5,7,8],interpol:[],replace_outli:8,epd:5,multiprocessingvfacil:8,dimension:8,construct:[2,8],just:8,nan:8,pylab:8,obtain:8,rest:8,collabor:3,shape:8,gurka:[3,4],behind:3,skill:7,"20pypiv":[],speed:[7,8],languag:7,note:[5,8],easi:[4,8],field:[7,8],had:3,mask:8,instrument:4,add:[5,8],uint16:[],theorem:[],input:8,successor:4,app:[],match:8,int32:8,around:[],heigth:8,handl:[],know:8,background:7,bit:[5,8],you:[3,0,7,5,8],loss:8,like:[7,8],filenam:8,signal:8,altough:8,resolv:4,evalutaion:8,frame_a:8,collect:1,"boolean":8,necessari:8,region:[],continuo:[],dynamic_mask:[],jsp:4,page:[0,5,8],encount:5,alexlib:[7,5],often:[5,8],crowd:3,linux:5,some:[1,7,5,8],previou:8,sampl:[6,8],integ:8,home:0,matshow:8,pixel:8,scale:[1,8],"32bit":4,normal:[],overlap:8,frame_b:8,image_:[],file0002:8,file0003:8,file0001:8,reproduc:3,file0004:8,refer:[0,1,8],machin:[5,8],core:8,encourag:0,knew:3,run:8,power:8,inspect:8,host:5,great:5,corr:[],output:8,figur:8,appli:8,about:8,actual:8,would:[7,5,8],column:[],field_001:[],www:[4,5],manag:5,cmap:8,get_coordin:8,estim:[],commerci:3,commit:4,approxim:[],predictor:8,repair:[],velocimetri:[3,4],own:[3,8],regist:4,resampl:[],std_threshold:[],dataset:[],upkgxf0:4,isnumb:4,chang:7,your:[4,7,5,8],correlate_window:[],merg:7,git:[4,7,5,8,6],fill:[],wai:[5,8],area:8,execut:[4,8],question:[0,4],"long":4,custom:[5,8],embarassingli:8,start:[3,4,7],adjac:8,much:[3,4,8],interfac:[0,7,2],includ:6,fraction:[],analysi:[3,0,1,8],form:0,offer:8,tupl:8,link:4,measur:[3,4],spuriou:1,branch:7,grate:7,haifa:3,line:8,infor:[],"true":[],bug:4,extend:8,pull:[4,7],algorithm:[0,1,3,4,7,8],consist:[],displac:8,"default":5,smooth:[1,8],displai:[],below:8,those:[3,7,8],sum:[],problem:[7,5,8],similar:[],puls:[],flatten:[],classif:8,taylor:4,evalu:[],"int":[],certain:8,u_max:[],pix:[],exist:[0,7,5],file:[5,8,6],"369x511":8,improv:[0,7,5],n_cpu:8,piv:[3,0,4,8,1],probabl:3,parabol:[],when:[3,8],detail:8,invalid:8,tim:4,other:5,bool:[],futur:[],rememb:8,spatial:[],test:[7,5],tif:8,thousand:8,nice:[],fork:4,intend:8,sequenc:8,why:3,ndarrai:[],subp_peak_posit:[],slice:[],peak:8,faster:4,furthermor:[0,8],scientif:3,directori:[5,8],submatrxi:[],exp1_001_a:8,rule:7,exp1_001_b:8,ignor:[],time:[3,4,7,5,8],push:4,"20with":[]},objtypes:{"0":"py:module"},titles:["OpenPIV: a python package for PIV image analysis.","API reference","The OpenPIV graphical user interface","Introduction","Frequently Asked Questions","Installation instruction","Download OpenPIV Example","Information for developers and contributors","Tutorial"],objnames:{"0":["py","module","Python module"]},filenames:["index","api_reference","gui_doc","introduction","faq","installation_instruction","downloads_page","developers","tutorial"]}) \ No newline at end of file diff --git a/src/api_reference.html b/src/api_reference.html index f8d154dd..c93fe679 100644 --- a/src/api_reference.html +++ b/src/api_reference.html @@ -3,17 +3,20 @@ + - API reference — OpenPiv v1 documentation + API reference — OpenPIV 0.0.1 documentation + + - - + + + @@ -47,128 +54,39 @@

        Navigation

        API reference

        This is a complete api reference to the openpiv python module.

        -
        -

        The openpiv.tools module

        - ---- - - - - - - - - - - - -
        imread
        save
        display
        +
        +

        The openpiv.preprocess module

        +

        This module contains a pure python implementation of the basic +cross-correlation algorithm for PIV image processing.

        +
        +
        +

        The openpiv.tools module

        +

        The openpiv.tools module is a collection of utilities and tools.

        -
        -

        The openpiv.pyprocess module

        - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        normalize_intensity
        correlate_windows
        get_coordinates
        get_field_shape
        moving_window_array
        find_first_peak
        find_second_peak
        find_pixel_peak_position
        find_subpixel_peak_position
        piv
        +
        +

        The openpiv.pyprocess module

        +

        This module contains a pure python implementation of the basic +cross-correlation algorithm for PIV image processing.

        -
        -

        The openpiv.process module

        - ---- - - - - - -
        extended_search_area_piv
        +
        +

        The openpiv.process module

        +

        This module is dedicated to advanced algorithms for PIV image analysis.

        -
        -

        The openpiv.filters module

        - ---- - - - - - - - - -
        gaussian
        _gaussian_kernel
        +
        +

        The openpiv.lib module

        +

        A module for various utilities and helper functions

        -
        -

        The openpiv.validation module

        - ---- - - - - - - - - -
        global_val
        sig2noise_val
        +
        +

        The openpiv.filters module

        +

        The openpiv.filters module contains some filtering/smoothing routines.

        -
        -

        The openpiv.scaling module

        - ---- - - - - - -
        uniform
        +
        +

        The openpiv.validation module

        +

        A module for spurious vector detection.

        +
        +
        +

        The openpiv.scaling module

        +

        Scaling utilities

        @@ -181,31 +99,21 @@

        The openpiv.scalingTable Of Contents

        Previous topic

        -

        Tutorial

        +

        Download OpenPIV Example

        This Page

        \ No newline at end of file diff --git a/src/developers.html b/src/developers.html index ae451d1c..06dd8de6 100644 --- a/src/developers.html +++ b/src/developers.html @@ -3,17 +3,20 @@ + - Information for developers and contributors — OpenPiv v1 documentation + Information for developers and contributors — OpenPIV 0.0.1 documentation + + - + + @@ -33,13 +37,16 @@

        Navigation

      • index
      • +
      • + modules |
      • next |
      • previous |
      • -
      • OpenPiv v1 documentation »
      • +
      • OpenPIV 0.0.1 documentation »
      • @@ -63,7 +70,7 @@

        Development workflow

        Set up a github account.

      • Clone OpenPiv repository using:

        -
        git clone http://github.com/gasagna/OpenPiv.git
        +
        git clone http://github.com/alexlib/openpiv-python.git
      • create a branch new_feature where you implement your new feature.

        @@ -133,7 +140,7 @@

        This Page

      • index
      • +
      • + modules |
      • next |
      • previous |
      • -
      • OpenPiv v1 documentation »
      • +
      • OpenPIV 0.0.1 documentation »
      • \ No newline at end of file diff --git a/src/downloads_page.html b/src/downloads_page.html new file mode 100644 index 00000000..7e51e4b4 --- /dev/null +++ b/src/downloads_page.html @@ -0,0 +1,133 @@ + + + + + + + + + + Download OpenPIV Example — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Download OpenPIV Example

        +
        +

        Tutorial files

        +

        These are zip files containing sample images and python scripts for analysing them with OpenPIV. These files are included in the source code if cloned from the Git.

        +

        Part 1: how to process an image pair. source code and sample images

        +

        Part 2: how to process in batch a list of image pairs. source code and sample images

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Tutorial

        +

        Next topic

        +

        API reference

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.filters._gaussian_kernel.html b/src/generated/openpiv.filters._gaussian_kernel.html index 0d1bc275..1a3e9ecb 100644 --- a/src/generated/openpiv.filters._gaussian_kernel.html +++ b/src/generated/openpiv.filters._gaussian_kernel.html @@ -3,17 +3,20 @@ + - openpiv.filters._gaussian_kernel — OpenPiv v1 documentation + openpiv.filters._gaussian_kernel — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,24 @@

        Navigation

        openpiv.filters._gaussian_kernel

        +
        +
        +openpiv.filters._gaussian_kernel(size)
        +

        A normalized 2D Gaussian kernel array

        +
        +
        size : int
        +
        the half width of the kernel. Kernel +has shape 2*size+1
        +
        +
        >>> from openpiv.filters import _gaussian_kernel
        +>>> _gaussian_kernel(1)
        +array([[ 0.04491922,  0.12210311,  0.04491922],
        +   [ 0.12210311,  0.33191066,  0.12210311],
        +   [ 0.04491922,  0.12210311,  0.04491922]])
        +
        +
        +
        +
        @@ -58,7 +83,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.filters.gaussian.html b/src/generated/openpiv.filters.gaussian.html index b549a99d..313a4428 100644 --- a/src/generated/openpiv.filters.gaussian.html +++ b/src/generated/openpiv.filters.gaussian.html @@ -3,17 +3,20 @@ + - openpiv.filters.gaussian — OpenPiv v1 documentation + openpiv.filters.gaussian — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,27 @@

        Navigation

        openpiv.filters.gaussian

        +
        +
        +openpiv.filters.gaussian(u, v, size)
        +

        Smooths the velocity field with a Gaussian kernel.

        +
        +
        u : 2d np.ndarray
        +
        the u velocity component field
        +
        v : 2d np.ndarray
        +
        the v velocity component field
        +
        size : int
        +
        the half width of the kernel. Kernel +has shape 2*size+1
        +
        +
        +
        uf : 2d np.ndarray
        +
        the smoothed u velocity component field
        +
        vf : 2d np.ndarray
        +
        the smoothed v velocity component field
        +
        +
        +
        @@ -58,7 +86,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.filters.replace_outliers.html b/src/generated/openpiv.filters.replace_outliers.html new file mode 100644 index 00000000..8ca2dd92 --- /dev/null +++ b/src/generated/openpiv.filters.replace_outliers.html @@ -0,0 +1,136 @@ + + + + + + + + + + openpiv.filters.replace_outliers — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.filters.replace_outliers

        +
        +
        +openpiv.filters.replace_outliers(u, v, method='localmean', max_iter=5, tol=0.001, kernel_size=1)
        +

        Replace invalid vectors in an velocity field using an iterative image inpainting algorithm.

        +

        The algorithm is the following:

        +
          +
        1. For each element in the arrays of the u and v components, replace it by a weighted average +of the neighbouring elements which are not invalid themselves. The weights depends +of the method type. If method=localmean weight are equal to 1/( (2*kernel_size+1)**2 -1 )
        2. +
        3. Several iterations are needed if there are adjacent invalid elements. +If this is the case, inforation is “spread” from the edges of the missing +regions iteratively, until the variation is below a certain threshold.
        4. +
        +
        +
        u : 2d np.ndarray
        +
        the u velocity component field
        +
        v : 2d np.ndarray
        +
        the v velocity component field
        +
        max_iter : int
        +
        the number of iterations
        +
        +

        fil +kernel_size : int

        +
        +
        the size of the kernel, default is 1
        +
        +
        method : str
        +
        the type of kernel used for repairing missing vectors
        +
        +
        +
        uf : 2d np.ndarray
        +
        the smoothed u velocity component field, where invalid vectors have been replaced
        +
        vf : 2d np.ndarray
        +
        the smoothed v velocity component field, where invalid vectors have been replaced
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.lib.replace_nans.html b/src/generated/openpiv.lib.replace_nans.html new file mode 100644 index 00000000..c57976c6 --- /dev/null +++ b/src/generated/openpiv.lib.replace_nans.html @@ -0,0 +1,129 @@ + + + + + + + + + + openpiv.lib.replace_nans — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.lib.replace_nans

        +
        +
        +openpiv.lib.replace_nans()
        +

        Replace NaN elements in an array using an iterative image inpainting algorithm.

        +

        The algorithm is the following:

        +
          +
        1. For each element in the input array, replace it by a weighted average +of the neighbouring elements which are not NaN themselves. The weights depends +of the method type. If method=localmean weight are equal to 1/( (2*kernel_size+1)**2 -1 )
        2. +
        3. Several iterations are needed if there are adjacent NaN elements. +If this is the case, information is “spread” from the edges of the missing +regions iteratively, until the variation is below a certain threshold.
        4. +
        +
        +
        array : 2d np.ndarray
        +
        an array containing NaN elements that have to be replaced
        +
        max_iter : int
        +
        the number of iterations
        +
        kernel_size : int
        +
        the size of the kernel, default is 1
        +
        method : str
        +
        the method used to replace invalid values. Valid options are +localmean.
        +
        +
        +
        filled : 2d np.ndarray
        +
        a copy of the input array, where NaN elements have been replaced.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.lib.sincinterp.html b/src/generated/openpiv.lib.sincinterp.html new file mode 100644 index 00000000..3210939e --- /dev/null +++ b/src/generated/openpiv.lib.sincinterp.html @@ -0,0 +1,129 @@ + + + + + + + + + + openpiv.lib.sincinterp — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.lib.sincinterp

        +
        +
        +openpiv.lib.sincinterp()
        +

        Re-sample an image at intermediate positions between pixels.

        +

        This function uses a cardinal interpolation formula which limits +the loss of information in the resampling process. It uses a limited +number of neighbouring pixels.

        +

        The new image \(im^+\) at fractional locations \(x\) and \(y\) is computed as:

        +
        +\[im^+(x,y) = \sum_{i=-\mathtt{kernel\_size}}^{i=\mathtt{kernel\_size}} \sum_{j=-\mathtt{kernel\_size}}^{j=\mathtt{kernel\_size}} \mathtt{image}(i,j) sin[\pi(i-\mathtt{x})] sin[\pi(j-\mathtt{y})] / \pi(i-\mathtt{x}) / \pi(j-\mathtt{y}) \]
        +
        +
        image : np.ndarray, dtype np.int32
        +
        the image array.
        +
        x : two dimensions np.ndarray of floats
        +
        an array containing fractional pixel row +positions at which to interpolate the image
        +
        y : two dimensions np.ndarray of floats
        +
        an array containing fractional pixel column +positions at which to interpolate the image
        +
        kernel_size : int
        +
        interpolation is performed over a (2*kernel_size+1)*(2*kernel_size+1) +submatrix in the neighbourhood of each interpolation point.
        +
        +
        +
        im : np.ndarray, dtype np.float64
        +
        the interpolated value of image at the points specified +by x and y
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.demean.html b/src/generated/openpiv.preprocess.dynamic_masking.html similarity index 58% rename from src/generated/openpiv.pyprocess.demean.html rename to src/generated/openpiv.preprocess.dynamic_masking.html index 2c47dfeb..414b34d8 100644 --- a/src/generated/openpiv.pyprocess.demean.html +++ b/src/generated/openpiv.preprocess.dynamic_masking.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.demean — OpenPiv v1 documentation + openpiv.preprocess.dynamic_masking — OpenPIV 0.0.1 documentation + + - + + @@ -40,8 +47,19 @@

        Navigation

        -
        -

        openpiv.pyprocess.demean

        +
        +

        openpiv.preprocess.dynamic_masking

        +
        +
        +openpiv.preprocess.dynamic_masking(image)
        +

        Dynamically masks out the objects in the PIV images

        +
        +
        image: image
        +
        a two dimensional array of uint16, uint8 or similar type
        +
        +

        image : 2d np.ndarray of floats

        +
        +
        @@ -52,13 +70,13 @@

        openpiv.pyprocess.demean

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.signal_noise_ratio.html b/src/generated/openpiv.process.CorrelationFunction.html similarity index 54% rename from src/generated/openpiv.pyprocess.signal_noise_ratio.html rename to src/generated/openpiv.process.CorrelationFunction.html index 0a7f3052..b54ea69a 100644 --- a/src/generated/openpiv.pyprocess.signal_noise_ratio.html +++ b/src/generated/openpiv.process.CorrelationFunction.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.signal_noise_ratio — OpenPiv v1 documentation + openpiv.process.CorrelationFunction — OpenPIV 0.0.1 documentation + + - + + @@ -40,8 +47,24 @@

        Navigation

        -
        -

        openpiv.pyprocess.signal_noise_ratio

        +
        +

        openpiv.process.CorrelationFunction

        +
        +
        +class openpiv.process.CorrelationFunction
        +
        +
        +__init__()
        +

        A class representing a cross correlation function.

        +
        +
        corr : 2d np.ndarray
        +
        the correlation function array
        +
        +
        + +

        Methods

        +
        +
        @@ -52,13 +75,13 @@

        openpiv.pyprocess.signal_noise_ratio

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.process.correlate_windows.html b/src/generated/openpiv.process.correlate_windows.html new file mode 100644 index 00000000..d4f15ba8 --- /dev/null +++ b/src/generated/openpiv.process.correlate_windows.html @@ -0,0 +1,126 @@ + + + + + + + + + + openpiv.process.correlate_windows — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.process.correlate_windows

        +
        +
        +openpiv.process.correlate_windows()
        +

        Compute correlation function between two interrogation windows.

        +

        The correlation function can be computed by using the correlation +theorem to speed up the computation.

        +
        +
        window_a : 2d np.ndarray
        +
        a two dimensions array for the first interrogation window.
        +
        window_b : 2d np.ndarray
        +
        a two dimensions array for the second interrogation window.
        +
        corr_method : string
        +
        one of the two methods currently implemented: ‘fft’ or ‘direct’. +Default is ‘fft’, which is much faster.
        +
        nfftx : int
        +
        the size of the 2D FFT in x-direction, +[default: 2 x windows_a.shape[0] is recommended].
        +
        nffty : int
        +
        the size of the 2D FFT in y-direction, +[default: 2 x windows_a.shape[1] is recommended].
        +
        +
        +
        corr : 2d np.ndarray
        +
        a two dimensions array for the correlation function.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.process.extended_search_area_piv.html b/src/generated/openpiv.process.extended_search_area_piv.html new file mode 100644 index 00000000..f13d948a --- /dev/null +++ b/src/generated/openpiv.process.extended_search_area_piv.html @@ -0,0 +1,163 @@ + + + + + + + + + + openpiv.process.extended_search_area_piv — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.process.extended_search_area_piv

        +
        +
        +openpiv.process.extended_search_area_piv()
        +

        The implementation of the one-step direct correlation with different +size of the interrogation window and the search area. The increased +size of the search areas cope with the problem of loss of pairs due +to in-plane motion, allowing for a smaller interrogation window size, +without increasing the number of outlier vectors.

        +

        See:

        +

        Particle-Imaging Techniques for Experimental Fluid Mechanics

        +

        Annual Review of Fluid Mechanics +Vol. 23: 261-304 (Volume publication date January 1991) +DOI: 10.1146/annurev.fl.23.010191.001401

        +
        +
        frame_a : 2d np.ndarray, dtype=np.int32
        +
        an two dimensions array of integers containing grey levels of +the first frame.
        +
        frame_b : 2d np.ndarray, dtype=np.int32
        +
        an two dimensions array of integers containing grey levels of +the second frame.
        +
        window_size : int
        +
        the size of the (square) interrogation window.
        +
        overlap : int
        +
        the number of pixels by which two adjacent windows overlap.
        +
        dt : float
        +
        the time delay separating the two frames.
        +
        search_area_size : int
        +
        the size of the (square) interrogation window from the second frame
        +
        subpixel_method : string
        +
        one of the following methods to estimate subpixel location of the peak: +‘centroid’ [replaces default if correlation map is negative], +‘gaussian’ [default if correlation map is positive], +‘parabolic’.
        +
        sig2noise_method : string
        +
        defines the method of signal-to-noise-ratio measure, +(‘peak2peak’ or ‘peak2mean’. If None, no measure is performed.)
        +
        width : int
        +
        the half size of the region around the first +correlation peak to ignore for finding the second +peak. [default: 2]. Only used if sig2noise_method==peak2peak.
        +
        nfftx : int
        +
        the size of the 2D FFT in x-direction, +[default: 2 x windows_a.shape[0] is recommended]
        +
        nffty : int
        +
        the size of the 2D FFT in y-direction, +[default: 2 x windows_a.shape[1] is recommended]
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +in pixels/seconds.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +in pixels/seconds.
        +
        sig2noise : 2d np.ndarray, optional
        +
        a two dimensional array containing the signal to noise ratio +from the cross correlation function. This array is returned if +sig2noise_method is not None.
        +
        +
        >>> u, v = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=16, overlap=8, search_area_size=48, dt=0.1)
        +
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.process.get_coordinates.html b/src/generated/openpiv.process.get_coordinates.html new file mode 100644 index 00000000..fe1da1d0 --- /dev/null +++ b/src/generated/openpiv.process.get_coordinates.html @@ -0,0 +1,124 @@ + + + + + + + + + + openpiv.process.get_coordinates — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.process.get_coordinates

        +
        +
        +openpiv.process.get_coordinates()
        +

        Compute the x, y coordinates of the centers of the interrogation windows.

        +
        +
        image_size: two elements tuple
        +
        a two dimensional tuple for the pixel size of the image +first element is number of rows, second element is +the number of columns.
        +
        window_size: int
        +
        the size of the interrogation windows.
        +
        overlap: int
        +
        the number of pixel by which two adjacent interrogation +windows overlap.
        +
        +
        +
        x : 2d np.ndarray
        +
        a two dimensional array containing the x coordinates of the +interrogation window centers, in pixels.
        +
        y : 2d np.ndarray
        +
        a two dimensional array containing the y coordinates of the +interrogation window centers, in pixels.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.process.get_field_shape.html b/src/generated/openpiv.process.get_field_shape.html new file mode 100644 index 00000000..f0ac074f --- /dev/null +++ b/src/generated/openpiv.process.get_field_shape.html @@ -0,0 +1,123 @@ + + + + + + + + + + openpiv.process.get_field_shape — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.process.get_field_shape

        +
        +
        +openpiv.process.get_field_shape()
        +

        Compute the shape of the resulting flow field.

        +

        Given the image size, the interrogation window size and +the overlap size, it is possible to calculate the number +of rows and columns of the resulting flow field.

        +
        +
        image_size: two elements tuple
        +
        a two dimensional tuple for the pixel size of the image +first element is number of rows, second element is +the number of columns.
        +
        window_size: int
        +
        the size of the interrogation window.
        +
        overlap: int
        +
        the number of pixel by which two adjacent interrogation +windows overlap.
        +
        +
        +
        field_shape : two elements tuple
        +
        the shape of the resulting flow field
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.find_pixel_peak_position.html b/src/generated/openpiv.process.normalize_intensity.html similarity index 55% rename from src/generated/openpiv.pyprocess.find_pixel_peak_position.html rename to src/generated/openpiv.process.normalize_intensity.html index 84fc0b56..2785d1f4 100644 --- a/src/generated/openpiv.pyprocess.find_pixel_peak_position.html +++ b/src/generated/openpiv.process.normalize_intensity.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.find_pixel_peak_position — OpenPiv v1 documentation + openpiv.process.normalize_intensity — OpenPIV 0.0.1 documentation + + - + + @@ -40,8 +47,22 @@

        Navigation

        -
        -

        openpiv.pyprocess.find_pixel_peak_position

        +
        +

        openpiv.process.normalize_intensity

        +
        +
        +openpiv.process.normalize_intensity()
        +

        Normalize interrogation window by removing the mean value.

        +
        +
        window : 2d np.ndarray
        +
        the interrogation window array
        +
        +
        +
        window : 2d np.ndarray
        +
        the interrogation window array, with mean value equal to zero.
        +
        +
        +
        @@ -52,13 +73,13 @@

        openpiv.pyprocess.find_pixel_peak_position

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.correlate_windows.html b/src/generated/openpiv.pyprocess.correlate_windows.html index bdefc5f1..1ee98bda 100644 --- a/src/generated/openpiv.pyprocess.correlate_windows.html +++ b/src/generated/openpiv.pyprocess.correlate_windows.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.correlate_windows — OpenPiv v1 documentation + openpiv.pyprocess.correlate_windows — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,33 @@

        Navigation

        openpiv.pyprocess.correlate_windows

        +
        +
        +openpiv.pyprocess.correlate_windows(window_a, window_b, corr_method='fft', nfftx=None, nffty=None)
        +

        Compute correlation function between two interrogation windows.

        +

        The correlation function can be computed by using the correlation +theorem to speed up the computation.

        +
        +
        window_a : 2d np.ndarray
        +
        a two dimensions array for the first interrogation window.
        +
        window_b : 2d np.ndarray
        +
        a two dimensions array for the second interrogation window.
        +
        corr_method : string
        +
        one of the two methods currently implemented: ‘fft’ or ‘direct’. +Default is ‘fft’, which is much faster.
        +
        nfftx : int
        +
        the size of the 2D FFT in x-direction, +[default: 2 x windows_a.shape[0] is recommended].
        +
        nffty : int
        +
        the size of the 2D FFT in y-direction, +[default: 2 x windows_a.shape[1] is recommended].
        +
        +
        +
        corr : 2d np.ndarray
        +
        a two dimensions array for the correlation function.
        +
        +
        +
        @@ -58,7 +92,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.find_first_peak.html b/src/generated/openpiv.pyprocess.find_first_peak.html index c8535113..f2a6bc4b 100644 --- a/src/generated/openpiv.pyprocess.find_first_peak.html +++ b/src/generated/openpiv.pyprocess.find_first_peak.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.find_first_peak — OpenPiv v1 documentation + openpiv.pyprocess.find_first_peak — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,24 @@

        Navigation

        openpiv.pyprocess.find_first_peak

        +
        +
        +openpiv.pyprocess.find_first_peak(corr)
        +

        Find row and column indices of the first correlation peak.

        +
        +
        corr : np.ndarray
        +
        the correlation map
        +
        +
        +
        i : int
        +
        the row index of the correlation peak
        +
        j : int
        +
        the column index of the correlation peak
        +
        corr_max1 : int
        +
        the value of the correlation peak
        +
        +
        +
        @@ -58,7 +83,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.find_second_peak.html b/src/generated/openpiv.pyprocess.find_second_peak.html index e8cda160..a42aa094 100644 --- a/src/generated/openpiv.pyprocess.find_second_peak.html +++ b/src/generated/openpiv.pyprocess.find_second_peak.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.find_second_peak — OpenPiv v1 documentation + openpiv.pyprocess.find_second_peak — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,32 @@

        Navigation

        openpiv.pyprocess.find_second_peak

        +
        +
        +openpiv.pyprocess.find_second_peak(corr, i=None, j=None, width=2)
        +

        Find the value of the second largest peak.

        +

        The second largest peak is the height of the peak in +the region outside a 3x3 submatrxi around the first +correlation peak.

        +
        +
        corr: np.ndarray
        +
        the correlation map.
        +
        i,j : ints
        +
        row and column location of the first peak.
        +
        width : int
        +
        the half size of the region around the first correlation +peak to ignore for finding the second peak.
        +
        +
        +
        i : int
        +
        the row index of the second correlation peak.
        +
        j : int
        +
        the column index of the second correlation peak.
        +
        corr_max2 : int
        +
        the value of the second correlation peak.
        +
        +
        +
        @@ -58,7 +91,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.find_subpixel_peak_position.html b/src/generated/openpiv.pyprocess.find_subpixel_peak_position.html index 56b23259..156db3cb 100644 --- a/src/generated/openpiv.pyprocess.find_subpixel_peak_position.html +++ b/src/generated/openpiv.pyprocess.find_subpixel_peak_position.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.find_subpixel_peak_position — OpenPiv v1 documentation + openpiv.pyprocess.find_subpixel_peak_position — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,30 @@

        Navigation

        openpiv.pyprocess.find_subpixel_peak_position

        +
        +
        +openpiv.pyprocess.find_subpixel_peak_position(corr, subpixel_method='gaussian')
        +

        Find subpixel approximation of the correlation peak.

        +

        This function returns a subpixels approximation of the correlation +peak by using one of the several methods available. If requested, +the function also returns the signal to noise ratio level evaluated +from the correlation map.

        +
        +
        corr : np.ndarray
        +
        the correlation map.
        +
        subpixel_method : string
        +
        one of the following methods to estimate subpixel location of the peak: +‘centroid’ [replaces default if correlation map is negative], +‘gaussian’ [default if correlation map is positive], +‘parabolic’.
        +
        +
        +
        subp_peak_position : two elements tuple
        +
        the fractional row and column indices for the sub-pixel +approximation of the correlation peak.
        +
        +
        +
        @@ -58,7 +89,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.get_coordinates.html b/src/generated/openpiv.pyprocess.get_coordinates.html index 31c66b83..af51574f 100644 --- a/src/generated/openpiv.pyprocess.get_coordinates.html +++ b/src/generated/openpiv.pyprocess.get_coordinates.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.get_coordinates — OpenPiv v1 documentation + openpiv.pyprocess.get_coordinates — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,31 @@

        Navigation

        openpiv.pyprocess.get_coordinates

        +
        +
        +openpiv.pyprocess.get_coordinates(image_size, window_size, overlap)
        +

        Compute the x, y coordinates of the centers of the interrogation windows.

        +
        +
        image_size: two elements tuple
        +
        a two dimensional tuple for the pixel size of the image +first element is number of rows, second element is +the number of columns.
        +
        window_size: int
        +
        the size of the interrogation windows.
        +
        overlap: int
        +
        the number of pixel by which two adjacent interrogation +windows overlap.
        +
        +
        +
        x : 2d np.ndarray
        +
        a two dimensional array containing the x coordinates of the +interrogation window centers, in pixels.
        +
        y : 2d np.ndarray
        +
        a two dimensional array containing the y coordinates of the +interrogation window centers, in pixels.
        +
        +
        +
        @@ -58,7 +90,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.get_field_shape.html b/src/generated/openpiv.pyprocess.get_field_shape.html index 045ed5fc..e0e3752e 100644 --- a/src/generated/openpiv.pyprocess.get_field_shape.html +++ b/src/generated/openpiv.pyprocess.get_field_shape.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.get_field_shape — OpenPiv v1 documentation + openpiv.pyprocess.get_field_shape — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,30 @@

        Navigation

        openpiv.pyprocess.get_field_shape

        +
        +
        +openpiv.pyprocess.get_field_shape(image_size, window_size, overlap)
        +

        Compute the shape of the resulting flow field.

        +

        Given the image size, the interrogation window size and +the overlap size, it is possible to calculate the number +of rows and columns of the resulting flow field.

        +
        +
        image_size: two elements tuple
        +
        a two dimensional tuple for the pixel size of the image +first element is number of rows, second element is +the number of columns.
        +
        window_size: int
        +
        the size of the interrogation window.
        +
        overlap: int
        +
        the number of pixel by which two adjacent interrogation +windows overlap.
        +
        +
        +
        field_shape : two elements tuple
        +
        the shape of the resulting flow field
        +
        +
        +
        @@ -58,7 +89,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.moving_window_array.html b/src/generated/openpiv.pyprocess.moving_window_array.html index d0fa7c5a..bb4fea92 100644 --- a/src/generated/openpiv.pyprocess.moving_window_array.html +++ b/src/generated/openpiv.pyprocess.moving_window_array.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.moving_window_array — OpenPiv v1 documentation + openpiv.pyprocess.moving_window_array — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,18 @@

        Navigation

        openpiv.pyprocess.moving_window_array

        +
        +
        +openpiv.pyprocess.moving_window_array(array, window_size, overlap)
        +

        This is a nice numpy trick. The concept of numpy strides should be +clear to understand this code.

        +

        Basically, we have a 2d array and we want to perform cross-correlation +over the interrogation windows. An approach could be to loop over the array +but loops are expensive in python. So we create from the array a new array +with three dimension, of size (n_windows, window_size, window_size), in which +each slice, (along the first axis) is an interrogation window.

        +
        +
        @@ -58,7 +77,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.normalize_intensity.html b/src/generated/openpiv.pyprocess.normalize_intensity.html index e9aaad9c..eb25ee9b 100644 --- a/src/generated/openpiv.pyprocess.normalize_intensity.html +++ b/src/generated/openpiv.pyprocess.normalize_intensity.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.normalize_intensity — OpenPiv v1 documentation + openpiv.pyprocess.normalize_intensity — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,20 @@

        Navigation

        openpiv.pyprocess.normalize_intensity

        +
        +
        +openpiv.pyprocess.normalize_intensity(window)
        +

        Normalize interrogation window by removing the mean value.

        +
        +
        window : 2d np.ndarray
        +
        the interrogation window array
        +
        +
        +
        window : 2d np.ndarray
        +
        the interrogation window array, with mean value equal to zero.
        +
        +
        +
        @@ -58,7 +79,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.pyprocess.piv.html b/src/generated/openpiv.pyprocess.piv.html index b5ad27e7..ddac6308 100644 --- a/src/generated/openpiv.pyprocess.piv.html +++ b/src/generated/openpiv.pyprocess.piv.html @@ -3,17 +3,20 @@ + - openpiv.pyprocess.piv — OpenPiv v1 documentation + openpiv.pyprocess.piv — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,62 @@

        Navigation

        openpiv.pyprocess.piv

        +
        +
        +openpiv.pyprocess.piv(frame_a, frame_b, window_size=64, overlap=32, dt=1.0, corr_method='fft', subpixel_method='gaussian', sig2noise_method=None, nfftx=None, nffty=None, width=2)
        +

        Standard PIV cross-correlation algorithm.

        +

        This is a pure python implementation of the standard PIV cross-correlation +algorithm. It is a zero order displacement predictor, and no iterative process +is performed.

        +
        +
        frame_a : 2d np.ndarray
        +
        an two dimensions array of integers containing grey levels of +the first frame.
        +
        frame_b : 2d np.ndarray
        +
        an two dimensions array of integers containing grey levels of +the second frame.
        +
        window_size : int
        +
        the size of the (square) interrogation window, [default: 32 pix].
        +
        overlap : int
        +
        the number of pixels by which two adjacent windows overlap +[default: 16 pix].
        +
        dt : float
        +
        the time delay separating the two frames [default: 1.0].
        +
        corr_method : string
        +
        one of the two methods implemented: ‘fft’ or ‘direct’, +[default: ‘fft’].
        +
        subpixel_method : string
        +
        one of the following methods to estimate subpixel location of the peak: +‘centroid’ [replaces default if correlation map is negative], +‘gaussian’ [default if correlation map is positive], +‘parabolic’.
        +
        sig2noise_method : string
        +
        defines the method of signal-to-noise-ratio measure, +(‘peak2peak’ or ‘peak2mean’. If None, no measure is performed.)
        +
        nfftx : int
        +
        the size of the 2D FFT in x-direction, +[default: 2 x windows_a.shape[0] is recommended]
        +
        nffty : int
        +
        the size of the 2D FFT in y-direction, +[default: 2 x windows_a.shape[1] is recommended]
        +
        width : int
        +
        the half size of the region around the first +correlation peak to ignore for finding the second +peak. [default: 2]. Only used if sig2noise_method==peak2peak.
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +in pixels/seconds.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +in pixels/seconds.
        +
        sig2noise : 2d np.ndarray, ( optional: only if sig2noise_method is not None )
        +
        a two dimensional array the signal to noise ratio for each +window pair.
        +
        +
        +
        @@ -58,7 +121,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.scaling.uniform.html b/src/generated/openpiv.scaling.uniform.html index 099766c4..613f383a 100644 --- a/src/generated/openpiv.scaling.uniform.html +++ b/src/generated/openpiv.scaling.uniform.html @@ -3,17 +3,20 @@ + - openpiv.scaling.uniform — OpenPiv v1 documentation + openpiv.scaling.uniform — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,24 @@

        Navigation

        openpiv.scaling.uniform

        +
        +
        +openpiv.scaling.uniform(x, y, u, v, scaling_factor)
        +

        Apply an uniform scaling

        +

        x : 2d np.ndarray

        +

        y : 2d np.ndarray

        +

        u : 2d np.ndarray

        +

        v : 2d np.ndarray

        +
        +
        scaling_factor : float
        +
        the image scaling factor in pixels per meter
        +
        +

        x : 2d np.ndarray

        +

        y : 2d np.ndarray

        +

        u : 2d np.ndarray

        +

        v : 2d np.ndarray

        +
        +
        @@ -58,7 +83,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.tools.Multiprocesser.html b/src/generated/openpiv.tools.Multiprocesser.html new file mode 100644 index 00000000..235ceb21 --- /dev/null +++ b/src/generated/openpiv.tools.Multiprocesser.html @@ -0,0 +1,131 @@ + + + + + + + + + + openpiv.tools.Multiprocesser — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.tools.Multiprocesser

        +
        +
        +class openpiv.tools.Multiprocesser(data_dir, pattern_a, pattern_b)
        +
        +
        +__init__(data_dir, pattern_a, pattern_b)
        +

        A class to handle and process large sets of images.

        +

        This class is responsible of loading image datasets +and processing them. It has parallelization facilities +to speed up the computation on multicore machines.

        +

        It currently support only image pair obtained from +conventional double pulse piv acquisition. Support +for continuos time resolved piv acquistion is in the +future.

        +
        +
        data_dir : str
        +
        the path where image files are located
        +
        pattern_a : str
        +
        a shell glob patter to match the first +frames.
        +
        pattern_b : str
        +
        a shell glob patter to match the second +frames.
        +
        +
        >>> multi = openpiv.tools.Multiprocesser( '/home/user/images', 'image_*_a.bmp', 'image_*_b.bmp')
        +
        +
        +
        + +

        Methods

        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.tools.display.html b/src/generated/openpiv.tools.display.html index 5d6449ae..bc668ed8 100644 --- a/src/generated/openpiv.tools.display.html +++ b/src/generated/openpiv.tools.display.html @@ -3,17 +3,20 @@ + - openpiv.tools.display — OpenPiv v1 documentation + openpiv.tools.display — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,16 @@

        Navigation

        openpiv.tools.display

        +
        +
        +openpiv.tools.display(message)
        +

        Display a message to standard output.

        +
        +
        message : string
        +
        a message to be printed
        +
        +
        +
        @@ -58,7 +75,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.tools.display_vector_field.html b/src/generated/openpiv.tools.display_vector_field.html new file mode 100644 index 00000000..a9d81146 --- /dev/null +++ b/src/generated/openpiv.tools.display_vector_field.html @@ -0,0 +1,116 @@ + + + + + + + + + + openpiv.tools.display_vector_field — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.tools.display_vector_field

        +
        +
        +openpiv.tools.display_vector_field(filename, **kw)
        +

        Displays quiver plot of the data stored in the file

        +
        +
        filename : string
        +
        the absolute path of the text file
        +
        Key arguments : (additional parameters, optional)
        +
        scale: [None | float] +width: [None | float]
        +
        +

        matplotlib.pyplot.quiver

        +
        >>> openpiv.tools.display_vector_field('./exp1_0000.txt',scale=100, width=0.0025) 
        +
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.tools.imread.html b/src/generated/openpiv.tools.imread.html index 5a2b461a..bc44564a 100644 --- a/src/generated/openpiv.tools.imread.html +++ b/src/generated/openpiv.tools.imread.html @@ -3,17 +3,20 @@ + - openpiv.tools.imread — OpenPiv v1 documentation + openpiv.tools.imread — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,28 @@

        Navigation

        openpiv.tools.imread

        +
        +
        +openpiv.tools.imread(filename, flatten=0)
        +

        Read an image file into a numpy array +using scipy.misc.imread

        +
        +
        filename : string
        +
        the absolute path of the image file
        +
        flatten : bool
        +
        True if the image is RGB color or False (default) if greyscale
        +
        +
        +
        frame : np.ndarray
        +
        a numpy array with grey levels
        +
        +
        >>> image = openpiv.tools.imread( 'image.bmp' )
        +>>> print image.shape 
        +    (1280, 1024)
        +
        +
        +
        +
        @@ -58,7 +87,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.tools.save.html b/src/generated/openpiv.tools.save.html index c616126f..58d224d2 100644 --- a/src/generated/openpiv.tools.save.html +++ b/src/generated/openpiv.tools.save.html @@ -3,17 +3,20 @@ + - openpiv.tools.save — OpenPiv v1 documentation + openpiv.tools.save — OpenPIV 0.0.1 documentation + + - + + @@ -42,6 +49,39 @@

        Navigation

        openpiv.tools.save

        +
        +
        +openpiv.tools.save(x, y, u, v, mask, filename, fmt='%8.4f', delimiter='\t')
        +

        Save flow field to an ascii file.

        +
        +
        x : 2d np.ndarray
        +
        a two dimensional array containing the x coordinates of the +interrogation window centers, in pixels.
        +
        y : 2d np.ndarray
        +
        a two dimensional array containing the y coordinates of the +interrogation window centers, in pixels.
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity components, +in pixels/seconds.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity components, +in pixels/seconds.
        +
        mask : 2d np.ndarray
        +
        a two dimensional boolen array where elements corresponding to +invalid vectors are True.
        +
        filename : string
        +
        the path of the file where to save the flow field
        +
        fmt : string
        +
        a format string. See documentation of numpy.savetxt +for more details.
        +
        delimiter : string
        +
        character separating columns
        +
        +
        >>> openpiv.tools.save( x, y, u, v, 'field_001.txt', fmt='%6.3f', delimiter='       ')
        +
        +
        +
        +
        @@ -58,7 +98,7 @@

        This Page

        \ No newline at end of file diff --git a/src/generated/openpiv.validation.global_std.html b/src/generated/openpiv.validation.global_std.html new file mode 100644 index 00000000..7e8145cd --- /dev/null +++ b/src/generated/openpiv.validation.global_std.html @@ -0,0 +1,128 @@ + + + + + + + + + + openpiv.validation.global_std — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.validation.global_std

        +
        +
        +openpiv.validation.global_std(u, v, std_threshold=3)
        +

        Eliminate spurious vectors with a global threshold defined by the standard deviation

        +

        This validation method tests for the spatial consistency of the data +and outliers vector are replaced with NaN (Not a Number) if at least +one of the two velocity components is out of a specified global range.

        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component.
        +
        std_threshold: float
        +
        If the length of the vector (actually the sum of squared components) is +larger than std_threshold times standard deviation of the flow field, +then the vector is treated as an outlier. [default = 3]
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +where spurious vectors have been replaced by NaN.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +where spurious vectors have been replaced by NaN.
        +
        mask : boolean 2d np.ndarray
        +
        a boolean array. True elements corresponds to outliers.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.validation.global_val.html b/src/generated/openpiv.validation.global_val.html new file mode 100644 index 00000000..1431023c --- /dev/null +++ b/src/generated/openpiv.validation.global_val.html @@ -0,0 +1,130 @@ + + + + + + + + + + openpiv.validation.global_val — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.validation.global_val

        +
        +
        +openpiv.validation.global_val(u, v, u_thresholds, v_thresholds)
        +

        Eliminate spurious vectors with a global threshold.

        +

        This validation method tests for the spatial consistency of the data +and outliers vector are replaced with Nan (Not a Number) if at +least one of the two velocity components is out of a specified global range.

        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component.
        +
        u_thresholds: two elements tuple
        +
        u_thresholds = (u_min, u_max). If u<u_min or u>u_max +the vector is treated as an outlier.
        +
        v_thresholds: two elements tuple
        +
        v_thresholds = (v_min, v_max). If v<v_min or v>v_max +the vector is treated as an outlier.
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +where spurious vectors have been replaced by NaN.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +where spurious vectors have been replaced by NaN.
        +
        mask : boolean 2d np.ndarray
        +
        a boolean array. True elements corresponds to outliers.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.validation.local_median_val.html b/src/generated/openpiv.validation.local_median_val.html new file mode 100644 index 00000000..2d5a5a55 --- /dev/null +++ b/src/generated/openpiv.validation.local_median_val.html @@ -0,0 +1,129 @@ + + + + + + + + + + openpiv.validation.local_median_val — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.validation.local_median_val

        +
        +
        +openpiv.validation.local_median_val(u, v, u_threshold, v_threshold, size=1)
        +

        Eliminate spurious vectors with a local median threshold.

        +

        This validation method tests for the spatial consistency of the data. +Vectors are classified as outliers and replaced with Nan (Not a Number) if +the absolute difference with the local median is greater than a user +specified threshold. The median is computed for both velocity components.

        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component.
        +
        u_threshold : float
        +
        the threshold value for component u
        +
        v_threshold : float
        +
        the threshold value for component v
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +where spurious vectors have been replaced by NaN.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +where spurious vectors have been replaced by NaN.
        +
        mask : boolean 2d np.ndarray
        +
        a boolean array. True elements corresponds to outliers.
        +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/generated/openpiv.validation.sig2noise_val.html b/src/generated/openpiv.validation.sig2noise_val.html new file mode 100644 index 00000000..a418fc75 --- /dev/null +++ b/src/generated/openpiv.validation.sig2noise_val.html @@ -0,0 +1,134 @@ + + + + + + + + + + openpiv.validation.sig2noise_val — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        openpiv.validation.sig2noise_val

        +
        +
        +openpiv.validation.sig2noise_val(u, v, sig2noise, threshold=1.3)
        +

        Eliminate spurious vectors from cross-correlation signal to noise ratio.

        +

        Replace spurious vectors with zero if signal to noise ratio +is below a specified threshold.

        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component.
        +
        sig2noise : 2d np.ndarray
        +
        a two dimensional array containing the value of the signal to +noise ratio from cross-correlation function.
        +
        threshold: float
        +
        the signal to noise ratio threshold value.
        +
        +
        +
        u : 2d np.ndarray
        +
        a two dimensional array containing the u velocity component, +where spurious vectors have been replaced by NaN.
        +
        v : 2d np.ndarray
        +
        a two dimensional array containing the v velocity component, +where spurious vectors have been replaced by NaN.
        +
        mask : boolean 2d np.ndarray
        +
        a boolean array. True elements corresponds to outliers.
        +
        +
          +
          1. +
          2. Keane and R. J. Adrian, Measurement Science & Technology,1990, 1, 1202-1215.
          3. +
          +
        1. +
        +
        + +
        + + +
        +
        +
        +
        +
        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file diff --git a/src/gui_doc.html b/src/gui_doc.html index e852803a..0a61c34d 100644 --- a/src/gui_doc.html +++ b/src/gui_doc.html @@ -3,17 +3,20 @@ + - The OpenPiv graphical user interface — OpenPiv v1 documentation + The OpenPIV graphical user interface — OpenPIV 0.0.1 documentation + + - + + @@ -41,7 +48,7 @@

        Navigation

        -

        The OpenPiv graphical user interface

        +

        The OpenPIV graphical user interface

        @@ -58,7 +65,7 @@

        This Page

        \ No newline at end of file diff --git a/src/installation_instruction.html b/src/installation_instruction.html index 98d65ce8..2aef5e37 100644 --- a/src/installation_instruction.html +++ b/src/installation_instruction.html @@ -3,17 +3,20 @@ + - Installation instruction — OpenPiv v1 documentation + Installation instruction — OpenPIV 0.0.1 documentation + + - + + - + @@ -51,15 +58,16 @@

        Navigation

        Installation instruction

        -

        Dependencies

        -

        OpenPiv would not have been possible if other great open source projects did not +

        Dependencies

        +

        OpenPIV would not have been possible if other great open source projects did not exist. We make extensive use of code and tools that other people have created, so -you should install them before you can use OpenPiv.

        +you should install them before you can use OpenPIV.

        The dependencies are:

        On all platforms, the binary Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com

        @@ -72,30 +80,31 @@

        How to install the dependencies on Linux

        How to install the dependencies on Windows

        On Windows all these dependencies, as well as several other useful packages, can be installed -using the Python(x,y) distribution, available at http://www.pythonxy.com/

        +using the Python(x,y) distribution, available at http://www.pythonxy.com/. Note: Install it in Custom Directories, +without spaces in the directory names (i.e. Program Files are prohibited), e.g. C:Pythonxy

        How to install the dependencies on a Mac

        -

        The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com

        +

        The binary (32 or 64 bit) Enthought Python Distribution (EPD) is recommended. Visit http://www.enthought.com. However, if you use EPD Free distribution, you need to install Cython from http://www.cython.org

        -

        Get Openpiv source code!

        -

        At this moment the only way to get OpenPiv’s source code is using git. +

        Get OpenPIV source code!

        +

        At this moment the only way to get OpenPIV’s source code is using git. Git Git is a distributed revision control system and our code is hosted at GitHub.

        Bleeding edge development version

        If you are interested in the source code you are welcome to browse out git repository -stored at https://github.com/gasagna/OpenPiv. If you want to download the source code +stored at https://github.com/alexlib/openpiv-python. If you want to download the source code on your machine, for testing, you need to set up git on your computer. Please look at http://help.github.com/ which provide extensive help for how to set up git.

        -

        To follow the development of OpenPiv, clone our repository with the command:

        +

        To follow the development of OpenPIV, clone our repository with the command:

        git clone http://github.com/alexlib/openpiv-python.git

        and update from time to time. You can also download a tarball containing everything.

        -

        Then add the path where the OpenPiv source are to the PYTHONPATH environment variable, so -that OpenPiv module can be imported and used in your programs. Remeber to build the extension +

        Then add the path where the OpenPIV source are to the PYTHONPATH environment variable, so +that OpenPIV module can be imported and used in your programs. Remeber to build the extension with

        python setup.py build
        @@ -103,7 +112,7 @@

        Bleeding edge development version

        Having problems?

        -

        If you encountered some issues, found difficult to install OpenPiv following these instructions +

        If you encountered some issues, found difficult to install OpenPIV following these instructions please drop us an email to openpiv-develop@lists.sourceforge.net , so that we can help you and improve this page!

        @@ -124,7 +133,7 @@

        Table Of Contents

      • How to install the dependencies on a Mac
      • -
      • Get Openpiv source code!
      • \ No newline at end of file diff --git a/src/introduction.html b/src/introduction.html index 89073c3c..3da1f880 100644 --- a/src/introduction.html +++ b/src/introduction.html @@ -3,17 +3,20 @@ + - Introduction — OpenPiv v1 documentation + Introduction — OpenPIV 0.0.1 documentation + + - + + @@ -58,7 +65,7 @@

        This Page

        \ No newline at end of file diff --git a/src/tutorial.html b/src/tutorial.html index e4299712..2c778424 100644 --- a/src/tutorial.html +++ b/src/tutorial.html @@ -3,17 +3,20 @@ + - Tutorial — OpenPiv v1 documentation + Tutorial — OpenPIV 0.0.1 documentation + + - - + + + @@ -34,12 +38,15 @@

        Navigation

        index
      • - modules |
      • +
      • + next |
      • previous |
      • -
      • OpenPiv v1 documentation »
      • +
      • OpenPIV 0.0.1 documentation »
      • @@ -50,61 +57,97 @@

        Navigation

        Tutorial

        -

        This tutorial focuses on the use of the openpiv python module for scripting. This tutorial only shows some of the most commonly used features of -OpenPiv. Check the complete API reference at API reference

        -

        First step is to install OpenPiv. For installation details -on various platforms see Installation instruction.

        -

        This tutorial uses some of the example data provided with the source distribution -of OpenPiv that you can find in our GitHub repository.

        +

        This is a series of examples and tutorials which focuses on showing features and capabilities of OpenPIV, so that after reading you should be able to set up scripts for your own analyses. If you are looking for a complete reference to the OpenPiv api, please look at API reference. It is assumed that you have Openpiv installed on your system along with a working python environment as well as the necessary OpenPiv dependencies. For installation details on various platforms see Installation instruction.

        +

        In this tutorial we are going to use some example data provided with the source distribution of OpenPIV. Altough it is not necessary, you may find helpful to actually run the code examples as the tutorial progresses. If you downloaded a tarball file, you should find these examples under the directory openpiv/docs/examples. Similarly if you cloned the git repository. If you cannot find them, dowload example images as well as the python source code from the downloads page.

        First example: how to process an image pair

        -

        Here is a complete working example showing how to process an image pair.

        +

        The first example shows how to process a single image pair. This is a common task and may be useful if you are studying how does a certain algorithm behaves. We assume that the current working directory is where the two image of the first example are located. Here is the code:

        import openpiv.tools
        -import openpiv.pyprocess
        +import openpiv.process
         import openpiv.scaling
         
         frame_a  = openpiv.tools.imread( 'exp1_001_a.bmp' )
         frame_b  = openpiv.tools.imread( 'exp1_001_b.bmp' )
         
        -u, v = openpiv.pyprocess.piv( frame_a, frame_b, window_size=48, overlap=32, dt=0.02, sig2noise_lim=1.5 )
        -x, y = openpiv.pyprocess.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 )
        -x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 1236.6 )
        +u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' )
        +
        +x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 )
        +
        +u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 )
        +
        +u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2)
         
        -openpiv.tools.save(x, y, u, v, 'exp1_001.txt')
        +x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 )
        +
        +openpiv.tools.save(x, y, u, v, 'exp1_001.txt' )
         
        +

        This code can be executed as a script, or you can type each command in an Ipython console with pylab mode set, so that you can visualize result as they are available. I will follow the second option and i will present the results of each command.

        We first import some of the openpiv modules.:

        import openpiv.tools
        -import openpiv.pyprocess
        +import openpiv.process
         import openpiv.scaling
         
        -

        Module openpiv.tools contains mostly contains utilities and tools, such as file I/O and multiprocessing -facilities. Module openpi.pyprocess contains a pure Python implementation of the PIV cross-correlation -algorithm and several helper functions. Last, module openpiv.scaling contains function for field scaling -and plate calibration stuff.

        +

        Module openpiv.tools contains mostly contains utilities and tools, such as file I/O and multiprocessingvfacilities. Module openpiv.process contains advanced algorithms for PIV analysis and several helper functions. Last, module openpiv.scaling contains functions for field scaling.

        We then load the two image files into numpy arrays:

        frame_a  = openpiv.tools.imread( 'exp1_001_a.bmp' )
         frame_b  = openpiv.tools.imread( 'exp1_001_b.bmp' )
         
        -

        In this example we use the pure python implementation to get the velocity field from the image pair.:

        -
        u, v = openpiv.pyprocess.piv( frame_a, frame_b, window_size=48, overlap=32, dt=0.02, sig2noise_lim=1.5 )
        +

        Inspecting the attributes of one of the two images we can see that:

        +
        frame_a.shape
        +(369, 511)
        +
        +frame_a.dtype
        +dtype('int32')
        +
        +
        +

        image has a size of 369x511 pixels and are contained in 32 bit integer arrays. Using pylab graphical capabilities it is easy to visualize one of the two frames::

        +
        matshow ( frame_a, cmap=cm.Greys _r )
        +
        +

        which results in this figure.

        +../_images/image1.png +

        In this example we are going to use the function openpiv.process.extended_search_area_piv() to process the image pair.:

        +
        u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' )
         
        -

        The function openpiv.pyprocess.piv() is a python implementation of the standard cross-correlation -algorithm. We also provide some options to the function, namely the window_size, i.e. the size of the -interrogation windows, the overlap between the windows in pixels and the time delay in seconds dt between -the two image frames. sig2noise_lim is the lower limit for the signal to noise ratio accepted before a vector is considered -an outlier.

        -

        We then compute the coordinates of the centers of the interrogation windows using openpiv.pyprocess.get_coordinates().:

        -
        x, y = openpiv.pyprocess.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 )
        +

        This method is a zero order displacement predictor cross-correlation algorithm, which cope with the problem of loss of pairs when the interrogation window is small, by increasing the search area on the second image. We also provide some options to the function, namely the window_size, i.e. the size of the interrogation window on frame_a, the overlap in pixels between adjacent windows, the time delay in seconds dt between the two image frames an te size in pixels of the extended search area on frame_b. sig2noise_method specifies which method to use for the evalutaion of the signal/noise ratio. The function also returns a third array, sig2noise which contains the signal to noise ratio obtained from each cross-correlation function, intended as the ratio between the heigth of the first and second peaks.

        +

        We then compute the coordinates of the centers of the interrogation windows using openpiv.process.get_coordinates().:

        +
        x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 )
         
        -

        Note that we have provided some the same options we have given in the previuos command.

        -

        Then we apply an uniform scaling with the function openpiv.scaling.uniform() providing the scaling_factor value, in pixels per meters -if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively.

        -
        x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 1236.6 )
        +

        Note that we have provided some the same options we have given in the previous command to the processing function.

        +

        We can now plot the vector plot on a new figure to inspect the result of the analysis, using:

        +
        close()
        +quiver( x, y, u, v )
        +
        +
        +

        and we obtain:

        +../_images/image2.png +

        Several outliers vectors can be observed as a result of the small interrogation window size and we need to apply a validation scheme. Since we have information about the signal to noise ratio of the cross-correlation function we can apply a well know filtering scheme, classifing a vector as an outlier if its signal to noise ratio exceeds a certain threshold. To accomplish this task we use the function:

        +
        u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 )
        +
        +
        +

        with a threshold value set to 1.3. This function actually sets to NaN all those vector for which the signal to noise ratio is below 1.3. Therefore, the +arrays u and v contains some np.nan elements. Furthermore, we get in output a third variable mask, which is a boolean array where elements corresponding to invalid vectors have been replace by Nan. The result of the filtering is shown in the following image, which we obtain with the two commands:

        +
        figure()
        +quiver( x, y, u, v )
        +
        +
        +../_images/image3.png +

        The final step is to replace the missing vector. This is done which the function openpiv.filters.replace_outliers(), which implements an iterative image inpainting algorithm with a specified kernel. We pass to this function the two velocity components arrays, a method type localmean, the number of passes and the size of the kernel.:

        +
        u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2 )
        +
        +
        +

        The flow field now appears much more smooth and the outlier vectors have been correctly replaced.

        +
        figure()
        +quiver( x, y, u, v )
        +
        +
        +../_images/image4.png +

        The last step is to apply an uniform scaling to the flow field to get dimensional units. We use the function openpiv.scaling.uniform() providing the scaling_factor value, in pixels per meters if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively.

        +
        x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 )
         

        Finally we save the data to an ascii file, for later processing, using::

        @@ -114,29 +157,20 @@

        First example: how to process an image pair

        Second example: how to process in batch a list of image pairs.

        -

        It if often the case, where several hundreds of image pairs have been sampled -in an experiment and have to be processed. For these tasks it is easier to -launch the analysis in batch and process all the image pairs -with the same processing parameters. OpenPiv, with its powerful python -scripting capabilities, provides a convenient way to -accomplish this task and offers multiprocessing facilities for machines -which have multiple cores, to speed up the computation. Since the analysis -is an embarassingly parallel problem, the speed up that can be reached -is quite high and almost equal to the number of core your machine has.

        -

        Compared to the previous example we have to setup some more things in the python -script we will use for the batch processing.

        +

        It if often the case, where several hundreds of image pairs have been sampled in an experiment and have to be processed. For these tasks it is easier to launch the analysis in batch and process all the image pairs with the same processing parameters. OpenPiv, with its powerful python scripting capabilities, provides a convenient way to accomplish this task and offers multiprocessing facilities for machines which have multiple cores, to speed up the computation. Since the analysis is an embarassingly parallel problem, the speed up that can be reached is quite high and almost equal to the number of core your machine has.

        +

        Compared to the previous example we have to setup some more things in the python script we will use for the batch processing.

        Let’s first import the needed modules.:

        import openpiv.tools
         import openpiv.scaling
        -import openpiv.pyprocess
        +import openpiv.process
         
        -

        We then define a python function which will be excecuted for each image pair. -Here it is::

        +

        We then define a python function which will be excecuted for each image pair. In this function we can specify any operation to execute on each single image pair, but here, for clarity we will setup a basic analysis, without a validation/replacement step.

        +

        Here is an example of valid python function::

        -

        The function we have written must accept in input a single argument. This argument is a three element tuple, which -you have to unpack in the function as we have done with:

        +

        The function we have specified must accept in input a single argument. This argument is a three element tuple, which you have to unpack inside the function body as we have done with:

        file_a, file_b, counter = args
         
        -

        The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair -we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into -its three elements, you can use them to load the images and do the rest.

        -

        This is just half of the job. In the same script we are going to write the following two lines of code.:

        -
        task = openpiv.tools.Multiprocesser( data_dir = '/home/User/images', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' )
        +

        The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into its three elements, you can use them to load the images and do the rest.

        +

        The simple processing function we wrote is just half of the job. We still need to specify which image pairs to process and where they are located. Therefore, in the same script we add the following two lines of code.:

        +
        task = openpiv.tools.Multiprocesser( data_dir = '.', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' )
         task.run( func = func, n_cpus=8 )
         
        -

        The first line creates an instance of the Openpiv.tools.Multiprocesser() class. To construct the class -you have to pass three arguments:

        +

        where we have set datadir to . because the script and the images are in the same folder. The first line creates an instance of the openpiv.tools.Multiprocesser() class. This class is responsible of sharing the processing work to multiple processes, so that the analysis can be executed in parallell. To construct the class you have to pass it three arguments:

        • data_dir: the directory where image files are located
        • pattern_a and pattern_b: the patterns for matching image files for frames a and b.
        -

        The second line actually launch the batch process, using for each image pair the func function we have provided. Note that we have set the n_cpus option -to be equal to 8 becasue my machine has eight core. You should not set n_cpus higher than the number of -core your machine has, becasue you don’t get any speed up.

        +
        +

        Note

        +

        Variables pattern_a and pattern_b are shell globbing patterns. Let ‘s say we have thousands of files for frame a in a sequence like file0001-a.tif, file0002-a.tif, file0003-a.tif, file0004-a.tif, ..., and the same for frames b file0001-b.tif, file0002-b.tif, file0003-b.tif, file0004-b.tif. To match these files we would set pattern_a = file*-a.tif and pattern_b = file*-a.tif. Basically, the * is a wildcard to match 0001, 0002, 0003, ...

        +
        +

        The second line actually launches the batch process, using for each image pair the func function we have provided. Note that we have set the n_cpus option to be equal to 8 just because my machine has eight cores. You should not set n_cpus higher than the number of core your machine has, because you would not get any speed up.

        @@ -207,8 +236,8 @@

        Previous topic

        Information for developers and contributors

        Next topic

        -

        API reference

        +

        Download OpenPIV Example

        This Page

        \ No newline at end of file diff --git a/tutorial.html b/tutorial.html new file mode 100644 index 00000000..a241cebc --- /dev/null +++ b/tutorial.html @@ -0,0 +1,286 @@ + + + + + + + + + + Tutorial — OpenPIV 0.0.1 documentation + + + + + + + + + + + + + + + + +
        +
        +
        +
        + +
        +

        Tutorial

        +

        This is a series of examples and tutorials which focuses on showing features and capabilities of OpenPIV, so that after reading you should be able to set up scripts for your own analyses. If you are looking for a complete reference to the OpenPiv api, please look at API reference. It is assumed that you have Openpiv installed on your system along with a working python environment as well as the necessary OpenPiv dependencies. For installation details on various platforms see Installation instruction.

        +

        In this tutorial we are going to use some example data provided with the source distribution of OpenPIV. Altough it is not necessary, you may find helpful to actually run the code examples as the tutorial progresses. If you downloaded a tarball file, you should find these examples under the directory openpiv/docs/examples. Similarly if you cloned the git repository. If you cannot find them, dowload example images as well as the python source code from the downloads page.

        +
        +

        First example: how to process an image pair

        +

        The first example shows how to process a single image pair. This is a common task and may be useful if you are studying how does a certain algorithm behaves. We assume that the current working directory is where the two image of the first example are located. Here is the code:

        +
        import openpiv.tools
        +import openpiv.process
        +import openpiv.scaling
        +
        +frame_a  = openpiv.tools.imread( 'exp1_001_a.bmp' )
        +frame_b  = openpiv.tools.imread( 'exp1_001_b.bmp' )
        +
        +u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' )
        +
        +x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 )
        +
        +u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 )
        +
        +u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2)
        +
        +x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 )
        +
        +openpiv.tools.save(x, y, u, v, 'exp1_001.txt' )
        +
        +
        +

        This code can be executed as a script, or you can type each command in an Ipython console with pylab mode set, so that you can visualize result as they are available. I will follow the second option and i will present the results of each command.

        +

        We first import some of the openpiv modules.:

        +
        import openpiv.tools
        +import openpiv.process
        +import openpiv.scaling
        +
        +
        +

        Module openpiv.tools contains mostly contains utilities and tools, such as file I/O and multiprocessingvfacilities. Module openpiv.process contains advanced algorithms for PIV analysis and several helper functions. Last, module openpiv.scaling contains functions for field scaling.

        +

        We then load the two image files into numpy arrays:

        +
        frame_a  = openpiv.tools.imread( 'exp1_001_a.bmp' )
        +frame_b  = openpiv.tools.imread( 'exp1_001_b.bmp' )
        +
        +
        +

        Inspecting the attributes of one of the two images we can see that:

        +
        frame_a.shape
        +(369, 511)
        +
        +frame_a.dtype
        +dtype('int32')
        +
        +
        +

        image has a size of 369x511 pixels and are contained in 32 bit integer arrays. Using pylab graphical capabilities it is easy to visualize one of the two frames::

        +
        matshow ( frame_a, cmap=cm.Greys _r )
        +
        +

        which results in this figure.

        +_images/image1.png +

        In this example we are going to use the function openpiv.process.extended_search_area_piv() to process the image pair.:

        +
        u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' )
        +
        +
        +

        This method is a zero order displacement predictor cross-correlation algorithm, which cope with the problem of loss of pairs when the interrogation window is small, by increasing the search area on the second image. We also provide some options to the function, namely the window_size, i.e. the size of the interrogation window on frame_a, the overlap in pixels between adjacent windows, the time delay in seconds dt between the two image frames an te size in pixels of the extended search area on frame_b. sig2noise_method specifies which method to use for the evalutaion of the signal/noise ratio. The function also returns a third array, sig2noise which contains the signal to noise ratio obtained from each cross-correlation function, intended as the ratio between the heigth of the first and second peaks.

        +

        We then compute the coordinates of the centers of the interrogation windows using openpiv.process.get_coordinates().:

        +
        x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=48, overlap=32 )
        +
        +
        +

        Note that we have provided some the same options we have given in the previous command to the processing function.

        +

        We can now plot the vector plot on a new figure to inspect the result of the analysis, using:

        +
        close()
        +quiver( x, y, u, v )
        +
        +
        +

        and we obtain:

        +_images/image2.png +

        Several outliers vectors can be observed as a result of the small interrogation window size and we need to apply a validation scheme. Since we have information about the signal to noise ratio of the cross-correlation function we can apply a well know filtering scheme, classifing a vector as an outlier if its signal to noise ratio exceeds a certain threshold. To accomplish this task we use the function:

        +
        u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 )
        +
        +
        +

        with a threshold value set to 1.3. This function actually sets to NaN all those vector for which the signal to noise ratio is below 1.3. Therefore, the +arrays u and v contains some np.nan elements. Furthermore, we get in output a third variable mask, which is a boolean array where elements corresponding to invalid vectors have been replace by Nan. The result of the filtering is shown in the following image, which we obtain with the two commands:

        +
        figure()
        +quiver( x, y, u, v )
        +
        +
        +_images/image3.png +

        The final step is to replace the missing vector. This is done which the function openpiv.filters.replace_outliers(), which implements an iterative image inpainting algorithm with a specified kernel. We pass to this function the two velocity components arrays, a method type localmean, the number of passes and the size of the kernel.:

        +
        u, v = openpiv.filters.replace_outliers( u, v, method='localmean', n_iter=10, kernel_size=2 )
        +
        +
        +

        The flow field now appears much more smooth and the outlier vectors have been correctly replaced.

        +
        figure()
        +quiver( x, y, u, v )
        +
        +
        +_images/image4.png +

        The last step is to apply an uniform scaling to the flow field to get dimensional units. We use the function openpiv.scaling.uniform() providing the scaling_factor value, in pixels per meters if we want position and velocities in meters and meters/seconds or in pixels per millimeters if we want positions and velocities in millimeters and millimeters/seconds, respectively.

        +
        x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 )
        +
        +
        +

        Finally we save the data to an ascii file, for later processing, using::

        +
        openpiv.tools.save(x, y, u, v, 'exp1_001.txt')
        +
        +
        +
        +
        +

        Second example: how to process in batch a list of image pairs.

        +

        It if often the case, where several hundreds of image pairs have been sampled in an experiment and have to be processed. For these tasks it is easier to launch the analysis in batch and process all the image pairs with the same processing parameters. OpenPiv, with its powerful python scripting capabilities, provides a convenient way to accomplish this task and offers multiprocessing facilities for machines which have multiple cores, to speed up the computation. Since the analysis is an embarassingly parallel problem, the speed up that can be reached is quite high and almost equal to the number of core your machine has.

        +

        Compared to the previous example we have to setup some more things in the python script we will use for the batch processing.

        +

        Let’s first import the needed modules.:

        +
        import openpiv.tools
        +import openpiv.scaling
        +import openpiv.process
        +
        +
        +

        We then define a python function which will be excecuted for each image pair. In this function we can specify any operation to execute on each single image pair, but here, for clarity we will setup a basic analysis, without a validation/replacement step.

        +

        Here is an example of valid python function::

        +
        def func( args ):
        +    """A function to process each image pair."""
        +
        +    # this line is REQUIRED for multiprocessing to work
        +    # always use it in your custom function
        +
        +    file_a, file_b, counter = args
        +
        +
        +    #####################
        +    # Here goes you code
        +    #####################
        +
        +    # read images into numpy arrays
        +    frame_a  = openpiv.tools.imread( file_a )
        +    frame_b  = openpiv.tools.imread( file_b )
        +
        +    # process image pair with extended search area piv algorithm.
        +    u, v = openpiv.process.extended_search_area_piv( frame_a, frame_b, window_size=32, overlap=16, dt=0.02, search_area_size=64 )
        +
        +    # get window centers coordinates
        +    x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=32, overlap=16 )
        +
        +    # save to a file
        +    openpiv.tools.save(x, y, u, v, 'exp1_%03d.txt' % counter, fmt='%8.7f', delimiter='\t' )
        +
        +
        +

        The function we have specified must accept in input a single argument. This argument is a three element tuple, which you have to unpack inside the function body as we have done with:

        +
        file_a, file_b, counter = args
        +
        +
        +

        The tuple contains the two filenames of the image pair and a counter, which is needed to remember which image pair we are currently processing, (basically just for the output filename). After that you have unpacked the tuple into its three elements, you can use them to load the images and do the rest.

        +

        The simple processing function we wrote is just half of the job. We still need to specify which image pairs to process and where they are located. Therefore, in the same script we add the following two lines of code.:

        +
        task = openpiv.tools.Multiprocesser( data_dir = '.', pattern_a='2image_*0.tif', pattern_b='2image_*1.tif' )
        +task.run( func = func, n_cpus=8 )
        +
        +
        +

        where we have set datadir to . because the script and the images are in the same folder. The first line creates an instance of the openpiv.tools.Multiprocesser() class. This class is responsible of sharing the processing work to multiple processes, so that the analysis can be executed in parallell. To construct the class you have to pass it three arguments:

        +
          +
        • data_dir: the directory where image files are located
        • +
        • pattern_a and pattern_b: the patterns for matching image files for frames a and b.
        • +
        +
        +

        Note

        +

        Variables pattern_a and pattern_b are shell globbing patterns. Let ‘s say we have thousands of files for frame a in a sequence like file0001-a.tif, file0002-a.tif, file0003-a.tif, file0004-a.tif, ..., and the same for frames b file0001-b.tif, file0002-b.tif, file0003-b.tif, file0004-b.tif. To match these files we would set pattern_a = file*-a.tif and pattern_b = file*-a.tif. Basically, the * is a wildcard to match 0001, 0002, 0003, ...

        +
        +

        The second line actually launches the batch process, using for each image pair the func function we have provided. Note that we have set the n_cpus option to be equal to 8 just because my machine has eight cores. You should not set n_cpus higher than the number of core your machine has, because you would not get any speed up.

        +
        +
        + + +
        +
        +
        +
        +
        +

        Table Of Contents

        + + +

        Previous topic

        +

        Information for developers and contributors

        +

        Next topic

        +

        Download OpenPIV Example

        +

        This Page

        + + + +
        +
        +
        +
        + + + + \ No newline at end of file