{ "metadata": { "language": "Julia", "name": "", "signature": "sha256:d31101048e21351a88c5affc0d0da4d53bf01c2a62ba8107f185afbafaef7b86" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "using GainPatterns" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "angles = [0:359]\n", "gains = float(cosd(angles))\n", "gp = GainPattern(angles, gains)\n", "plot(gp)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "svg": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text": [ "PolarAxis(Plot[Linear(2x361 Array{Real,2}:\n", " 0.0 1.0 2.0 3.0 4.0 \u2026 358.0 359.0 0.0\n", " 2.0 1.99985 1.99939 1.99863 1.99756 1.99939 1.99985 2.0,\"none\",nothing,nothing,nothing)],nothing,nothing,\"{\\\\pgfmathparse{-1.0+\\\\tick} \\\\pgfmathprintnumber{\\\\pgfmathresult}}\")" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now say you want to make the minimum y (radial) value -2, and not -1. You can specify this:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "plot(gp, ymin=-2)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "svg": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text": [ "PolarAxis(Plot[Linear(2x361 Array{Real,2}:\n", " 0.0 1.0 2.0 3.0 4.0 \u2026 358.0 359.0 0.0\n", " 3.0 2.99985 2.99939 2.99863 2.99756 2.99939 2.99985 3.0,\"none\",nothing,nothing,nothing)],nothing,nothing,\"{\\\\pgfmathparse{-2.0+\\\\tick} \\\\pgfmathprintnumber{\\\\pgfmathresult}}\")" ] } ], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice how the plot is always closed? We only have values for angles 0 to 359, but there is a line between 359 and zero. That is because GainPatterns automatically draws a line between the last point and the first point, to make the gain pattern look continuous over all angles\n", "\n", "Sometimes, this behavior is undesirable. For example, maybe you get more than one revolution of data; maybe you start measuring gains at 45 degrees and loop all the way around to 47 degrees. It might be silly to draw a line connecting the last and first points in such a case. For these situations (or any time you'd like), you can set the optional argument `lastleg` to false when plotting." ] }, { "cell_type": "code", "collapsed": false, "input": [ "angles = [0:10:359]\n", "gains = float(cosd(angles))\n", "gp = GainPattern(angles, gains)\n", "plot(gp, lastleg=false)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "svg": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text": [ "PolarAxis(Plot[Linear(2x36 Array{Real,2}:\n", " 0.0 10.0 20.0 30.0 \u2026 330.0 340.0 350.0 \n", " 2.0 1.98481 1.93969 1.86603 1.86603 1.93969 1.98481,\"none\",nothing,nothing,nothing)],nothing,nothing,\"{\\\\pgfmathparse{-1.0+\\\\tick} \\\\pgfmathprintnumber{\\\\pgfmathresult}}\")" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }