Created
April 19, 2013 02:28
-
-
Save jbwhit/5417681 to your computer and use it in GitHub Desktop.
example of how to use python's numpy to read and write files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "2013-04-19-proper-numpy" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import numpy as np\n", | |
"import pylab as pl" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"def GaussFunction(wavelength_array, amplitude, centroid, sigma, *args, **kwargs):\n", | |
" return amplitude * np.exp(-0.5 * ((wavelength_array - centroid) / sigma)**2)\n" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"begin_wavelength = 5300.0\n", | |
"end_wavelength = 5340.0\n", | |
"pixel_size = 0.02 # Angstroms\n", | |
"wavelength = np.arange(begin_wavelength, end_wavelength, pixel_size)\n" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"centroid_1 = 5324.3\n", | |
"amplitude_1 = 2.4\n", | |
"sigma_1 = 3.5\n", | |
"flux = GaussFunction(wavelength, amplitude_1, centroid_1, sigma_1)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"\n", | |
"pl.plot(wavelength, flux)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"[<matplotlib.lines.Line2D at 0x107e12990>]" | |
] | |
}, | |
{ | |
"output_type": "display_data", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAD9CAYAAABdoNd6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYVHX+B/D3IEreIskLlYqKpIjiAAJeuIzm3exibMZm\n26r7e3jKSjOtTHfTct2tXR81t8x62q3VzC1cr3lPBwETRG3zfsEQLDWhvKEpl+/vj69DgjAww8x8\nz5zzfj3PPHEZZ957dnw78znnfI9JCCFARES65qM6ABERuR/LnojIAFj2REQGwLInIjIAlj0RkQGw\n7ImIDMBu2RcUFKB///4ICwuDxWLBsmXLbruP1WqFv78/IiIiEBERgdmzZ7stLBEROcfX3i8bNmyI\nefPmwWw2o7CwEDExMRg5ciSaN29e6X6JiYlYs2aNW4MSEZHz7L6zDwwMhNlsBgC0bNkSYWFhyMnJ\nue1+PC+LiEjb6jyzP3HiBA4ePIiYmJhKPzeZTNi5cyfMZjMmT56M3Nxcl4ckIqJ6EnVw6dIlERkZ\nKVatWlXt74qLi8WNGzfEhx9+KEaMGFHtYwDgjTfeeOPNiZsr1PooN27cEIMGDRLz5s2r9cHKy8tF\n69atxS+//HL7E7kosLu9/vrrqiPUiTfk9IaMQjCnqzGna7mqO+2OcYQQGD9+PLp3745JkyZVe59z\n585VzOzXrl2L8PBw+Pn52XtYIiLyMLtH42RmZmLp0qUIDw9HREQEAGDOnDnIz88HAKSkpCA1NRWL\nFi2Cr68vwsPDMXfuXPenJiIih9gt+7i4OJSXl9t9gAkTJmDChAkuDaWSxWJRHaFOvCGnN2QEmNPV\nmFObTEJ45rhJk8nEQzSJiBzkqu7kcglERAbAsiciMgCWPZEGHD0KjBsHtG0LtGgBxMcDS5YAtewy\nI6ozlj2RYh9+CMTFAZ07A2lpwIkTwCuvAP/4BzBkCFBUpDoh6QF30BIpNH8+sHAhsGEDcP/9lX9X\nWgpMmQK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GzatAn5+fmwWq3w8fGp\nmFF17doVy5cvR2FhIVauXHnbcfz14aqcZWVlFQvAXbp0CStXrsTw4cOV5bQR1cwVtbQ9a8qpte15\n4cIFjBgxAm+99Rb69OlT6bG0tD1ryunO7eloxry8PJSWlgIAvv32W1y/fh1dunQBoK1tWVNOrb02\nd+zYge+++w7fffcdJk2ahOnTp+PZZ58F4MT2dOZjyMmTJ0XPnj0rDlv66KOPhBByj3H37t1FdHS0\nmDp1qvjpp58q/sz8+fNFcHCwCA0NFTt27Kj4+cGDB0VERITo0KGDePXVV52J4/acV65cEVFRUSI8\nPFzExcWJt956S3nOoKAgERAQIJo1aybatWsnDh8+LITQ3va8NWfbtm3F4cOHRXFxsaa255tvvima\nNm1acajdrYfbaWl71pTTna9PRzMuWbJEhIWFCbPZLEaPHl3p8GUtbcuacmrx77rNzJkzxdy5cyu+\nd3R7euziJUREpA4vS0hEZAAseyIiA2DZExEZAMueiMgAWPZERAbAsiciMoD/BzxoDs9L/70aAAAA\nAElFTkSuQmCC\n" | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"np.savetxt('example1.ascii', (wavelength, flux))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"np.savetxt('example2.ascii', (wavelength, flux), fmt='%-7.2f')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"np.savetxt('example3.ascii', np.transpose((wavelength, flux)))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"wave1, flux1 = np.loadtxt('example1.ascii')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"wave3, flux3 = np.loadtxt('example3.ascii', unpack=True) # somewhat slower for huge files" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 10 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment