{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Your First Interferogram\n", "\n", "This tutorial will guide you through the basics of processing interferometer data with prysm. We will load a sample interferogram, mask the data, remove some low-order error, and compute basic specifications.\n", "\n", "First we make some basic imports," ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from prysm.interferogram import Interferogram\n", "from prysm.sample_data import sample_files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To load data, we will use a method of the `Interferogram` class, which takes a path to the data:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "path = sample_files('dat')\n", "path" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "interf = Interferogram.from_zygo_dat(path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first thing you might want to do is plot the data, which we can do with the `plot2d` method. There are many optional arguments to control the formatting, but the defaults are fine for now." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "interf.plot2d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The X and Y axes have units of mm, and z nm. We can see some data dropout, and our origin is in the lower right hand corner. Let's fix that and crop into the center 12 mm:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from prysm.geometry import circle\n", "\n", "interf.recenter()\n", "interf.mask(circle(12, interf.r))\n", "interf.plot2d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There's a lot of dead space around the data, so we'll crop that away to reduce the amount of data we have to process. The prominent interferogram routines are NaN aware so the blank space is not automatically an issue." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "interf.crop()\n", "interf.plot2d(interpolation='bilinear')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We changed the interpolation method to avoid some visual artifacts at the edges of the array. Notice that `crop` reset the centering of the data as a side effect. Now we'd like to remove a few low-order terms:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "interf.recenter()\n", "interf.remove_piston()\n", "interf.remove_tiptilt()\n", "interf.remove_power()\n", "interf.plot2d(interpolation='bilinear')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And finally we can evaluate some basic statistics," ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "interf.pv, interf.rms # units are nm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can convert these values to reciprocal waves:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w = interf.wavelength * 1e3 # wavelength is in microns\n", "w/interf.pv, interf.rms" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So, this area of this part is $\\lambda/8$ PV and $\\lambda/14$ RMS after rounding." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In summary, to do basic interferometer data processing:\n", " \n", "- load an interferogram from disk using `Interferogram.from_zygo_dat`\n", "- do any cropping and masking using functions from `prysm.geometry` or your own, based on the `x, y, r, t` attributes of the interferogram object and the `interf.mask` function.\n", "- Evaluate statistics by using the computed properties of your interferogram\n", "\n", "We will cover more topics in the [advanced](../how-tos/Advanced-Interferogram-Processing.ipynb) tutorial." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 4 }