%23%20%2F%2F%2F%20script%0A%23%20requires-python%20%3D%20%22%3E%3D3.11%22%0A%23%20dependencies%20%3D%20%5B%0A%23%20%20%20%20%20%22marimo%22%2C%0A%23%20%20%20%20%20%22openpiv%3D%3D0.26.3%22%2C%0A%23%20%20%20%20%20%22numpy%22%2C%0A%23%20%20%20%20%20%22matplotlib%22%2C%0A%23%20%20%20%20%20%22scipy%22%2C%0A%23%20%20%20%20%20%22scikit-image%22%2C%0A%23%20%5D%0A%23%20%2F%2F%2F%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.25.2%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%2001%20%E2%80%94%20Introduction%20to%20PIV%0A%0A%20%20%20%20**Particle%20Image%20Velocimetry%20(PIV)**%20is%20an%20optical%2C%20non-intrusive%20technique%20to%20measure%20velocity%20fields%20in%20fluids%20(and%20other%20moving%20media).%0A%0A%20%20%20%20%23%23%20Core%20idea%0A%20%20%20%201.%20Seed%20the%20flow%20with%20small%20tracer%20particles%20that%20follow%20the%20motion.%0A%20%20%20%202.%20Illuminate%20a%20plane%2Fslice%20and%20take%20two%20images%20separated%20by%20a%20known%20time%20%24%5CDelta%20t%24.%0A%20%20%20%203.%20Divide%20images%20into%20small%20**interrogation%20windows**%20and%20find%20the%20displacement%20that%20best%20matches%20each%20window%20between%20frames%20(usually%20by%20cross-correlation).%0A%20%20%20%204.%20Velocity%20%3D%20displacement%20%2F%20%24%5CDelta%20t%24.%0A%0A%20%20%20%20%23%23%20What%20PIV%20assumes%0A%20%20%20%20-%20Particles%20follow%20the%20flow%20(good%20tracer%20behavior).%0A%20%20%20%20-%20Motion%20within%20a%20window%20is%20approximately%20uniform%20during%20%24%5CDelta%20t%24.%0A%20%20%20%20-%20Illumination%20and%20particle%20appearance%20are%20consistent%20between%20frames.%0A%20%20%20%20-%20Out-of-plane%20motion%20is%20limited%20(for%20planar%20PIV).%0A%0A%20%20%20%20%23%23%20Why%20it%20matters%0A%20%20%20%20PIV%20gives%20**spatial%20fields**%2C%20not%20just%20point%20measurements%20%E2%80%94%20you%20can%20see%20vortices%2C%20shear%20layers%2C%20wakes%2C%20jets%2C%20etc.%0A%0A%20%20%20%20%23%23%20See%20it%20in%20real%20examples%0A%20%20%20%20-%20**%5Btest1%5D(marimo_cases%2Ftest1.html)**%20(%5B.py%5D(marimo_cases%2Ftest1.py)%2C%20%5Bmolab%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2Fopenpiv%2Fopenpiv-python-examples%2Fblob%2Fmain%2Fmarimo_cases%2Ftest1.py))%20%E2%80%94%20simple%20experimental%20pair%3B%20a%20clean%20starting%20point.%0A%20%20%20%20-%20**%5Btest9%5D(marimo_cases%2Ftest9.html)**%20(%5B.py%5D(marimo_cases%2Ftest9.py)%2C%20%5Bmolab%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2Fopenpiv%2Fopenpiv-python-examples%2Fblob%2Fmain%2Fmarimo_cases%2Ftest9.py))%20%E2%80%94%20K%C3%A1rm%C3%A1n%20vortex%20street%20(%60karman_16Hz_*%60)%3B%20see%20periodic%20wake%20structures.%0A%20%20%20%20-%20**%5Bopenpiv_bridgepile_wake%5D(marimo_notebooks%2Fopenpiv_bridgepile_wake.html)**%20(%5B.py%5D(marimo_notebooks%2Fopenpiv_bridgepile_wake.py))%20%E2%80%94%20wake%20behind%20a%20bridge%20pile.%0A%20%20%20%20-%20**%5Bbacteria_in_a_circle%5D(marimo_notebooks%2Fbacteria_in_a_circle.html)**%20(%5B.py%5D(marimo_notebooks%2Fbacteria_in_a_circle.py))%20%2F%20**%5Btest17%5D(marimo_cases%2Ftest17.html)**%20%E2%80%94%20biological%20microscale%20motion.%0A%20%20%20%20-%20**%5Bactive_nematics%5D(marimo_notebooks%2Factive_nematics.html)**%20(%5B.py%5D(marimo_notebooks%2Factive_nematics.py))%20%2F%20**%5Btest18%5D(marimo_cases%2Ftest18.html)**%20%E2%80%94%20active%20matter%20flows.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%23%23%20Visual%20intuition%20with%20a%20synthetic%20example%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20from%20openpiv.tools%20import%20synimage%0A%20%20%20%20img_a%2C%20img_b%20%3D%20synimage.synimagegen(128%2C%20dt%3D0.1)%0A%20%20%20%20return%20img_a%2C%20img_b%0A%0A%0A%40app.cell%0Adef%20_(img_a%2C%20img_b)%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt1%0A%20%20%20%20fig1%2C%20ax1%20%3D%20plt1.subplots(1%2C%202%2C%20figsize%3D(8%2C%204))%0A%20%20%20%20ax1%5B0%5D.imshow(img_a%2C%20cmap%3D%22gray%22)%3B%20ax1%5B0%5D.set_title(%22Frame%20A%20(t)%22)%0A%20%20%20%20ax1%5B1%5D.imshow(img_b%2C%20cmap%3D%22gray%22)%3B%20ax1%5B1%5D.set_title(%22Frame%20B%20(t%2B%CE%94t)%22)%0A%20%20%20%20fig1%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Key%20parameters%20(preview)%0A%20%20%20%20-%20**Window%20size**%3A%20tradeoff%20between%20spatial%20resolution%20(small)%20and%20correlation%20robustness%20(large).%0A%20%20%20%20-%20**Overlap**%3A%20more%20vectors%2C%20but%20neighboring%20vectors%20share%20information.%0A%20%20%20%20-%20**%24%5CDelta%20t%24**%3A%20must%20produce%20measurable%20displacement%20(often%20~5%E2%80%9310%20pixels)%20without%20losing%20particles.%0A%20%20%20%20-%20**Search%20area**%3A%20must%20be%20large%20enough%20to%20capture%20the%20true%20displacement.%0A%0A%20%20%20%20Next%3A%20%5B02%20%E2%80%94%20Basic%20PIV%20workflow%5D(02_basic_piv.html)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
d17fdbb7dd3e33442b739560ef23099f