<no title> — Normalization 0 documentation

{
  “cells”: [
    {

      “cell_type”: “markdown”, “metadata”: {}, “source”: [

      > “# Tutorial normalization with fewer ob than sample”

      ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “Package to normalize data using Open Beam (OB) and, optionally Dark Field (DF).n”, “n”, “The program allows you to select a background region to allow data to be normalized by OB that do not have the same acquisition time. n”, “Cropping the image is also possible using the crop methodn”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “This notebook will illustrate the use of the NeuNorm library by going through a typical normalization”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Set up system”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: null, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “import osn”, “import sysn”, “import numpy as npn”, “import matplotlib.pyplot as pltn”, “import matplotlib.patches as patchesn”, “from matplotlib import gridspecn”, “%matplotlib notebook”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “Add NeuNorm to python path”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 2, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “root_folder = os.path.dirname(os.getcwd())n”, “sys.path.append(root_folder)n”, “import NeuNorm as neunormn”, “from NeuNorm.normalization import Normalizationn”, “from NeuNorm.roi import ROI”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “collapsed”: true, “run_control”: {

    > > > “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Data Folders”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “Sample data path”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 3, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “path_im = ‘../data/sample’n”, “assert os.path.exists(path_im)”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “Open Beam files”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 4, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “path_ob = ‘../data/ob/’n”, “ob1 = path_ob + ‘0001.tif’n”, “ob2 = path_ob + ‘0002.tif’n”, “assert os.path.exists(ob1)n”, “assert os.path.exists(ob2)”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Loading Data “

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 5, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “o_norm = Normalization()n”, “o_norm.load(folder=path_im)n”, “o_norm.load(file=[ob1, ob2], data_type=’ob’)”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Normalization of the data “

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “We will use a normalization ROI.n”, “``\n", " x0 = 3\n", " y0 = 5\n", " width = 20\n", " height = 40\n", "``”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 6, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [

    > > {
    > >   “data”: {
    > >     “text/plain”: [

    > >       “True”

    > >     ]

    > >   }, “execution_count”: 6, “metadata”: {}, “output_type”: “execute_result”

    > > }

    > ], “source”: [

    > > “norm_roi = ROI(x0=3, y0=5, width=20, height=40)n”, “o_norm.normalization(roi=norm_roi)”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Recovering the normalized data”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 7, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: [

    > > “normalized_data = o_norm.data[‘normalized’]”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 8, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [

    > > {
    > >   “data”: {
    > >     “text/plain”: [

    > >       “(15, 100, 100)”

    > >     ]

    > >   }, “execution_count”: 8, “metadata”: {}, “output_type”: “execute_result”

    > > }

    > ], “source”: [

    > > “np.shape(normalized_data)”

    > ]

    }, {

    > “cell_type”: “markdown”, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “source”: [

    > > “## Crop “

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: 9, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [

    > > {
    > >   “data”: {
    > >     “text/plain”: [

    > >       “(15, 3, 3)”

    > >     ]

    > >   }, “execution_count”: 9, “metadata”: {}, “output_type”: “execute_result”

    > > }

    > ], “source”: [

    > > “roi_to_keep = ROI(x0=0, y0=0, width=2, height=2)n”, “o_norm.crop(roi=roi_to_keep)n”, “n”, “norm_crop = o_norm.data[‘normalized’]n”, “np.shape(norm_crop)”

    > ]

    }, {

    > “cell_type”: “code”, “execution_count”: null, “metadata”: {

    > > “run_control”: {

    > >   “frozen”: false, “read_only”: false

    > > }

    > }, “outputs”: [], “source”: []

    }

  ], “metadata”: {

  > “anaconda-cloud”: {}, “kernelspec”: {

  > > “display_name”: “Python [default]”, “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.5.3”

  > }, “toc”: {

  > > “colors”: {

  > >   “hover_highlight”: “#DAA520”, “running_highlight”: “#FF0000”, “selected_highlight”: “#FFD700”

  > > }, “moveMenuLeft”: true, “nav_menu”: {

  > > > “height”: “156px”, “width”: “252px”

  > > }, “navigate_menu”: true, “number_sections”: true, “sideBar”: true, “threshold”: 4.0, “toc_cell”: false, “toc_section_display”: “block”, “toc_window_display”: false

  > }

  }, “nbformat”: 4, “nbformat_minor”: 1

}