{ "cells": [ { "cell_type": "code", "execution_count": 64, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:57:27.475966Z", "start_time": "2018-05-29T11:57:27.467839Z" }, "collapsed": false }, "outputs": [], "source": [ "import re\n", "import os\n", "from glob import glob\n", "\n", "import pandas as pd\n", "import numpy as np\n", "\n", "from astropy.io import fits\n", "from astropy.table import Table\n", "from astropy import units as u, constants as const\n", "\n", "from starkit.gridkit.io.process import BaseProcessGrid\n", "from starkit.gridkit import load_grid\n", "from scipy import ndimage as nd\n", "from scipy.interpolate import interp1d\n" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:58:46.539236Z", "start_time": "2018-05-29T11:58:46.530411Z" }, "collapsed": true }, "outputs": [], "source": [ "moehler_bib = \"\"\"@ARTICLE{2014A&A...568A...9M,\n", " author = {{Moehler}, S. and {Modigliani}, A. and {Freudling}, W. and\n", " {Giammichele}, N. and {Gianninas}, A. and {Gonneau}, A. and\n", " {Kausch}, W. and {Lan{\\c{c}}on}, A. and {Noll}, S. and {Rauch},\n", " T. and {Vinther}, J.},\n", " title = \"{Flux calibration of medium-resolution spectra from 300 nm to 2500 nm:\n", " Model reference spectra and telluric correction}\",\n", " journal = {\\aap},\n", " keywords = {standards, techniques: spectroscopic, Astrophysics - Instrumentation and\n", " Methods for Astrophysics, Astrophysics - Solar and Stellar\n", " Astrophysics},\n", " year = 2014,\n", " month = Aug,\n", " volume = {568},\n", " eid = {A9},\n", " pages = {A9},\n", " doi = {10.1051/0004-6361/201423790},\n", " adsurl = {https://ui.adsabs.harvard.edu/#abs/2014A&A...568A...9M},\n", " adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n", "}\n", "\n", "\n", "\"\"\"\n", "moehler_telluric_meta = pd.Series([moehler_bib, ['airmass', 'pwv'], 'vacuum', 'Angstrom', '1'], \n", " index=[u'bibtex', u'parameters', u'wavelength_type', u'wavelength_unit', 'flux_unit'], )\n" ] }, { "cell_type": "code", "execution_count": 51, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:55:25.558435Z", "start_time": "2018-05-29T11:55:25.543662Z" }, "collapsed": false }, "outputs": [], "source": [ "class MoehlerTelluric(BaseProcessGrid):\n", " R_initial = 60000.\n", " R_initial_sampling=1\n", "\n", " def __init__(self, index, input_wavelength, meta, wavelength_start=0*u.angstrom, wavelength_stop=np.inf*u.angstrom,\n", " R=None, R_sampling=4):\n", " super(MoehlerTelluric, self).__init__(index, input_wavelength, meta, wavelength_start=wavelength_start,\n", " wavelength_stop=wavelength_stop, R=R, R_sampling=R_sampling)\n", " def load_flux(self, fname):\n", " return Table.read(fname)['trans']\n", " \n", " def interp_wavelength(self, flux):\n", " cut_flux = flux[self.start_idx:self.stop_idx]\n", " rescaled_R = 1 / np.sqrt((1/self.R)**2 - (1/self.R_initial)**2)\n", " sigma = ((self.R_initial / rescaled_R) * self.R_initial_sampling\n", " / (2 * np.sqrt(2 * np.log(2))))\n", "\n", " processed_flux = nd.gaussian_filter1d(cut_flux, sigma)\n", " output_flux = interp1d(self.cut_wavelength, processed_flux)(\n", " self.output_wavelength)\n", " return output_flux\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Generating Index for Telluric Data ####" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:16:45.910691Z", "start_time": "2018-05-29T11:16:45.905347Z" }, "collapsed": false }, "outputs": [], "source": [ "lbl_telluric_pattern = re.compile('LBL_A(\\d\\d)_s0_w(\\d\\d\\d).+?\\.fits')" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:55:54.817092Z", "start_time": "2018-05-29T11:55:54.798642Z" }, "collapsed": false }, "outputs": [], "source": [ "fname_list = np.sort(glob('LBL*.fits'))\n", "raw_index = pd.DataFrame(index=np.arange(len(fname_list)), columns=['airmass', 'pwv', 'filename'])\n", "for i, fname in enumerate(fname_list):\n", " airmass, pwv = lbl_telluric_pattern.match(os.path.basename(fname)).groups()\n", " airmass = float(airmass) / 10.\n", " pwv = float(pwv) / 10.\n", " raw_index.iloc[i] = (airmass, pwv, fname)" ] }, { "cell_type": "code", "execution_count": 55, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:55:55.633768Z", "start_time": "2018-05-29T11:55:55.600102Z" }, "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
airmasspwvfilename
010.5LBL_A10_s0_w005_R0060000_T.fits
111LBL_A10_s0_w010_R0060000_T.fits
211.5LBL_A10_s0_w015_R0060000_T.fits
312.5LBL_A10_s0_w025_R0060000_T.fits
413.5LBL_A10_s0_w035_R0060000_T.fits
515LBL_A10_s0_w050_R0060000_T.fits
617.5LBL_A10_s0_w075_R0060000_T.fits
7110LBL_A10_s0_w100_R0060000_T.fits
8120LBL_A10_s0_w200_R0060000_T.fits
91.50.5LBL_A15_s0_w005_R0060000_T.fits
101.51LBL_A15_s0_w010_R0060000_T.fits
111.51.5LBL_A15_s0_w015_R0060000_T.fits
121.52.5LBL_A15_s0_w025_R0060000_T.fits
131.53.5LBL_A15_s0_w035_R0060000_T.fits
141.55LBL_A15_s0_w050_R0060000_T.fits
151.57.5LBL_A15_s0_w075_R0060000_T.fits
161.510LBL_A15_s0_w100_R0060000_T.fits
171.520LBL_A15_s0_w200_R0060000_T.fits
1820.5LBL_A20_s0_w005_R0060000_T.fits
1921LBL_A20_s0_w010_R0060000_T.fits
2021.5LBL_A20_s0_w015_R0060000_T.fits
2122.5LBL_A20_s0_w025_R0060000_T.fits
2223.5LBL_A20_s0_w035_R0060000_T.fits
2325LBL_A20_s0_w050_R0060000_T.fits
2427.5LBL_A20_s0_w075_R0060000_T.fits
25210LBL_A20_s0_w100_R0060000_T.fits
26220LBL_A20_s0_w200_R0060000_T.fits
272.50.5LBL_A25_s0_w005_R0060000_T.fits
282.51LBL_A25_s0_w010_R0060000_T.fits
292.51.5LBL_A25_s0_w015_R0060000_T.fits
302.52.5LBL_A25_s0_w025_R0060000_T.fits
312.53.5LBL_A25_s0_w035_R0060000_T.fits
322.55LBL_A25_s0_w050_R0060000_T.fits
332.57.5LBL_A25_s0_w075_R0060000_T.fits
342.510LBL_A25_s0_w100_R0060000_T.fits
352.520LBL_A25_s0_w200_R0060000_T.fits
3630.5LBL_A30_s0_w005_R0060000_T.fits
3731LBL_A30_s0_w010_R0060000_T.fits
3831.5LBL_A30_s0_w015_R0060000_T.fits
3932.5LBL_A30_s0_w025_R0060000_T.fits
4033.5LBL_A30_s0_w035_R0060000_T.fits
4135LBL_A30_s0_w050_R0060000_T.fits
4237.5LBL_A30_s0_w075_R0060000_T.fits
43310LBL_A30_s0_w100_R0060000_T.fits
44320LBL_A30_s0_w200_R0060000_T.fits
\n", "
" ], "text/plain": [ " airmass pwv filename\n", "0 1 0.5 LBL_A10_s0_w005_R0060000_T.fits\n", "1 1 1 LBL_A10_s0_w010_R0060000_T.fits\n", "2 1 1.5 LBL_A10_s0_w015_R0060000_T.fits\n", "3 1 2.5 LBL_A10_s0_w025_R0060000_T.fits\n", "4 1 3.5 LBL_A10_s0_w035_R0060000_T.fits\n", "5 1 5 LBL_A10_s0_w050_R0060000_T.fits\n", "6 1 7.5 LBL_A10_s0_w075_R0060000_T.fits\n", "7 1 10 LBL_A10_s0_w100_R0060000_T.fits\n", "8 1 20 LBL_A10_s0_w200_R0060000_T.fits\n", "9 1.5 0.5 LBL_A15_s0_w005_R0060000_T.fits\n", "10 1.5 1 LBL_A15_s0_w010_R0060000_T.fits\n", "11 1.5 1.5 LBL_A15_s0_w015_R0060000_T.fits\n", "12 1.5 2.5 LBL_A15_s0_w025_R0060000_T.fits\n", "13 1.5 3.5 LBL_A15_s0_w035_R0060000_T.fits\n", "14 1.5 5 LBL_A15_s0_w050_R0060000_T.fits\n", "15 1.5 7.5 LBL_A15_s0_w075_R0060000_T.fits\n", "16 1.5 10 LBL_A15_s0_w100_R0060000_T.fits\n", "17 1.5 20 LBL_A15_s0_w200_R0060000_T.fits\n", "18 2 0.5 LBL_A20_s0_w005_R0060000_T.fits\n", "19 2 1 LBL_A20_s0_w010_R0060000_T.fits\n", "20 2 1.5 LBL_A20_s0_w015_R0060000_T.fits\n", "21 2 2.5 LBL_A20_s0_w025_R0060000_T.fits\n", "22 2 3.5 LBL_A20_s0_w035_R0060000_T.fits\n", "23 2 5 LBL_A20_s0_w050_R0060000_T.fits\n", "24 2 7.5 LBL_A20_s0_w075_R0060000_T.fits\n", "25 2 10 LBL_A20_s0_w100_R0060000_T.fits\n", "26 2 20 LBL_A20_s0_w200_R0060000_T.fits\n", "27 2.5 0.5 LBL_A25_s0_w005_R0060000_T.fits\n", "28 2.5 1 LBL_A25_s0_w010_R0060000_T.fits\n", "29 2.5 1.5 LBL_A25_s0_w015_R0060000_T.fits\n", "30 2.5 2.5 LBL_A25_s0_w025_R0060000_T.fits\n", "31 2.5 3.5 LBL_A25_s0_w035_R0060000_T.fits\n", "32 2.5 5 LBL_A25_s0_w050_R0060000_T.fits\n", "33 2.5 7.5 LBL_A25_s0_w075_R0060000_T.fits\n", "34 2.5 10 LBL_A25_s0_w100_R0060000_T.fits\n", "35 2.5 20 LBL_A25_s0_w200_R0060000_T.fits\n", "36 3 0.5 LBL_A30_s0_w005_R0060000_T.fits\n", "37 3 1 LBL_A30_s0_w010_R0060000_T.fits\n", "38 3 1.5 LBL_A30_s0_w015_R0060000_T.fits\n", "39 3 2.5 LBL_A30_s0_w025_R0060000_T.fits\n", "40 3 3.5 LBL_A30_s0_w035_R0060000_T.fits\n", "41 3 5 LBL_A30_s0_w050_R0060000_T.fits\n", "42 3 7.5 LBL_A30_s0_w075_R0060000_T.fits\n", "43 3 10 LBL_A30_s0_w100_R0060000_T.fits\n", "44 3 20 LBL_A30_s0_w200_R0060000_T.fits" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "raw_index" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:45:45.581239Z", "start_time": "2018-05-29T11:45:45.520632Z" }, "collapsed": false }, "outputs": [], "source": [ "wavelength = (Table.read(fname_list[0])['lam'] * u.micron).to(u.angstrom)" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:58:53.050727Z", "start_time": "2018-05-29T11:58:53.032650Z" }, "collapsed": false }, "outputs": [], "source": [ "moehler_telluric = MoehlerTelluric(raw_index, wavelength, moehler_telluric_meta, \n", " wavelength_start=3001*u.angstrom, \n", " wavelength_stop=25000*u.angstrom, R=50000,\n", " R_sampling=4)" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:58:56.106125Z", "start_time": "2018-05-29T11:58:53.792759Z" }, "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "45it [00:01, 26.35it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "done\n" ] } ], "source": [ "moehler_telluric.to_hdf('moehler_telluric.hdf')" ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:58:57.660319Z", "start_time": "2018-05-29T11:58:57.496639Z" }, "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "starkit.gridkit.base - INFO - Reading index\n", "starkit.gridkit.base - INFO - Discovered columns airmass, pwv\n", "starkit.gridkit.base - INFO - Reading Fluxes\n", "starkit.gridkit.base - INFO - Fluxes shape (45, 423987)\n", "starkit.gridkit.base - INFO - Initializing spec grid\n", "starkit.gridkit.base - INFO - Setting grid extent\n" ] } ], "source": [ "moehler_telluric_grid = load_grid('moehler_telluric.h5')" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "ExecuteTime": { "end_time": "2018-05-29T11:59:41.354220Z", "start_time": "2018-05-29T11:59:41.240815Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] }, { "data": { "application/javascript": [ "/* Put everything inside the global mpl namespace */\n", "window.mpl = {};\n", "\n", "mpl.get_websocket_type = function() {\n", " if (typeof(WebSocket) !== 'undefined') {\n", " return WebSocket;\n", " } else if (typeof(MozWebSocket) !== 'undefined') {\n", " return MozWebSocket;\n", " } else {\n", " alert('Your browser does not have WebSocket support.' +\n", " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", " 'Firefox 4 and 5 are also supported but you ' +\n", " 'have to enable WebSockets in about:config.');\n", " };\n", "}\n", "\n", "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", " this.id = figure_id;\n", "\n", " this.ws = websocket;\n", "\n", " this.supports_binary = (this.ws.binaryType != undefined);\n", "\n", " if (!this.supports_binary) {\n", " var warnings = document.getElementById(\"mpl-warnings\");\n", " if (warnings) {\n", " warnings.style.display = 'block';\n", " warnings.textContent = (\n", " \"This browser does not support binary websocket messages. \" +\n", " \"Performance may be slow.\");\n", " }\n", " }\n", "\n", " this.imageObj = new Image();\n", "\n", " this.context = undefined;\n", " this.message = undefined;\n", " this.canvas = undefined;\n", " this.rubberband_canvas = undefined;\n", " this.rubberband_context = undefined;\n", " this.format_dropdown = undefined;\n", "\n", " this.image_mode = 'full';\n", "\n", " this.root = $('
');\n", " this._root_extra_style(this.root)\n", " this.root.attr('style', 'display: inline-block');\n", "\n", " $(parent_element).append(this.root);\n", "\n", " this._init_header(this);\n", " this._init_canvas(this);\n", " this._init_toolbar(this);\n", "\n", " var fig = this;\n", "\n", " this.waiting = false;\n", "\n", " this.ws.onopen = function () {\n", " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", " fig.send_message(\"send_image_mode\", {});\n", " fig.send_message(\"refresh\", {});\n", " }\n", "\n", " this.imageObj.onload = function() {\n", " if (fig.image_mode == 'full') {\n", " // Full images could contain transparency (where diff images\n", " // almost always do), so we need to clear the canvas so that\n", " // there is no ghosting.\n", " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", " }\n", " fig.context.drawImage(fig.imageObj, 0, 0);\n", " };\n", "\n", " this.imageObj.onunload = function() {\n", " this.ws.close();\n", " }\n", "\n", " this.ws.onmessage = this._make_on_message_function(this);\n", "\n", " this.ondownload = ondownload;\n", "}\n", "\n", "mpl.figure.prototype._init_header = function() {\n", " var titlebar = $(\n", " '
');\n", " var titletext = $(\n", " '
');\n", " titlebar.append(titletext)\n", " this.root.append(titlebar);\n", " this.header = titletext[0];\n", "}\n", "\n", "\n", "\n", "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "\n", "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "mpl.figure.prototype._init_canvas = function() {\n", " var fig = this;\n", "\n", " var canvas_div = $('
');\n", "\n", " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", "\n", " function canvas_keyboard_event(event) {\n", " return fig.key_event(event, event['data']);\n", " }\n", "\n", " canvas_div.keydown('key_press', canvas_keyboard_event);\n", " canvas_div.keyup('key_release', canvas_keyboard_event);\n", " this.canvas_div = canvas_div\n", " this._canvas_extra_style(canvas_div)\n", " this.root.append(canvas_div);\n", "\n", " var canvas = $('');\n", " canvas.addClass('mpl-canvas');\n", " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", "\n", " this.canvas = canvas[0];\n", " this.context = canvas[0].getContext(\"2d\");\n", "\n", " var rubberband = $('');\n", " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", "\n", " var pass_mouse_events = true;\n", "\n", " canvas_div.resizable({\n", " start: function(event, ui) {\n", " pass_mouse_events = false;\n", " },\n", " resize: function(event, ui) {\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " stop: function(event, ui) {\n", " pass_mouse_events = true;\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " });\n", "\n", " function mouse_event_fn(event) {\n", " if (pass_mouse_events)\n", " return fig.mouse_event(event, event['data']);\n", " }\n", "\n", " rubberband.mousedown('button_press', mouse_event_fn);\n", " rubberband.mouseup('button_release', mouse_event_fn);\n", " // Throttle sequential mouse events to 1 every 20ms.\n", " rubberband.mousemove('motion_notify', mouse_event_fn);\n", "\n", " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", "\n", " canvas_div.on(\"wheel\", function (event) {\n", " event = event.originalEvent;\n", " event['data'] = 'scroll'\n", " if (event.deltaY < 0) {\n", " event.step = 1;\n", " } else {\n", " event.step = -1;\n", " }\n", " mouse_event_fn(event);\n", " });\n", "\n", " canvas_div.append(canvas);\n", " canvas_div.append(rubberband);\n", "\n", " this.rubberband = rubberband;\n", " this.rubberband_canvas = rubberband[0];\n", " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", " this.rubberband_context.strokeStyle = \"#000000\";\n", "\n", " this._resize_canvas = function(width, height) {\n", " // Keep the size of the canvas, canvas container, and rubber band\n", " // canvas in synch.\n", " canvas_div.css('width', width)\n", " canvas_div.css('height', height)\n", "\n", " canvas.attr('width', width);\n", " canvas.attr('height', height);\n", "\n", " rubberband.attr('width', width);\n", " rubberband.attr('height', height);\n", " }\n", "\n", " // Set the figure to an initial 600x600px, this will subsequently be updated\n", " // upon first draw.\n", " this._resize_canvas(600, 600);\n", "\n", " // Disable right mouse context menu.\n", " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", " return false;\n", " });\n", "\n", " function set_focus () {\n", " canvas.focus();\n", " canvas_div.focus();\n", " }\n", "\n", " window.setTimeout(set_focus, 100);\n", "}\n", "\n", "mpl.figure.prototype._init_toolbar = function() {\n", " var fig = this;\n", "\n", " var nav_element = $('
')\n", " nav_element.attr('style', 'width: 100%');\n", " this.root.append(nav_element);\n", "\n", " // Define a callback function for later on.\n", " function toolbar_event(event) {\n", " return fig.toolbar_button_onclick(event['data']);\n", " }\n", " function toolbar_mouse_event(event) {\n", " return fig.toolbar_button_onmouseover(event['data']);\n", " }\n", "\n", " for(var toolbar_ind in mpl.toolbar_items) {\n", " var name = mpl.toolbar_items[toolbar_ind][0];\n", " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", " var image = mpl.toolbar_items[toolbar_ind][2];\n", " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", "\n", " if (!name) {\n", " // put a spacer in here.\n", " continue;\n", " }\n", " var button = $('