{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PynamiX example notebook" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from pynamix import io, data, measure, color, plotting, exposure\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load example data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ims,logfile = data.pendulum() # load some example data\n", "# im, logfile = io.load_seq('path_to_data') # load your own data\n", "# save_as_tiffs('tt',ims,tmin=1000,tmax=1050,tstep=10) # save some of the SEQ file as tiffs in a folder `tt`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Apply an ROI" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ims, logfile = exposure.apply_ROI(ims, logfile, left=600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Find min and max threshold values" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w = plotting.hist_GUI(ims)\n", "display(w)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Apply threshold" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "masked_ims = exposure.clamp(ims,w.kwargs['vmin'],w.kwargs['vmax'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Calculate size and orientation fields" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "virino = color.virino()\n", "X,Y,orient, dzeta = measure.orientation_map(masked_ims,logfile,tmin=1,tmax=2)\n", "x,y,size = measure.average_size_map(masked_ims,logfile,tmin=1,tmax=2)\n", "\n", "plt.subplot(131)\n", "plt.imshow(masked_ims[0])\n", "plt.subplot(132)\n", "plt.pcolormesh(X,Y,orient[0],cmap=virino)\n", "plt.colorbar()\n", "plt.subplot(133)\n", "plt.pcolormesh(x,y,size[0])\n", "plt.colorbar()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load some PIVLab data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "x,y,u,v = io.load_PIVLab_txtfiles('/Volumes/LTS/DynamiX/PerpetualAvalanche/PerpetualAvalanche-3mm-4mm-80-20/PIV/',start=1000,end=1020,tstep=5)\n", "plt.quiver(x,y,u[0,:,:],v[0,:,:])\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.6" } }, "nbformat": 4, "nbformat_minor": 4 }