Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates > by-pkgid > c044f82ec6193fba7e13c97913613b07 > files > 746

ipython-doc-2.3.0-2.3.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Module: lib.display &mdash; IPython 2.3.0 documentation</title>
    
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '2.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="IPython 2.3.0 documentation" href="../../index.html" />
    <link rel="up" title="The IPython API" href="../index.html" />
    <link rel="next" title="Module: lib.editorhooks" href="IPython.lib.editorhooks.html" />
    <link rel="prev" title="Module: lib.demo" href="IPython.lib.demo.html" /> 
  </head>
  <body>

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="http://ipython.org/"><img src="../../_static/logo.png" border="0" alt="IPython Documentation"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="IPython.lib.editorhooks.html" title="Module: lib.editorhooks"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="IPython.lib.demo.html" title="Module: lib.demo"
             accesskey="P">previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" accesskey="U">The IPython API</a> &raquo;</li> 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Module: <tt class="docutils literal"><span class="pre">lib.display</span></tt></a><ul>
<li><a class="reference internal" href="#classes">7 Classes</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="IPython.lib.demo.html"
                        title="previous chapter">Module: <tt class="docutils literal"><span class="pre">lib.demo</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="IPython.lib.editorhooks.html"
                        title="next chapter">Module: <tt class="docutils literal"><span class="pre">lib.editorhooks</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/api/generated/IPython.lib.display.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-IPython.lib.display">
<span id="module-lib-display"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">lib.display</span></tt><a class="headerlink" href="#module-IPython.lib.display" title="Permalink to this headline">¶</a></h1>
<p>Various display related classes.</p>
<p>Authors : MinRK, gregcaporaso, dannystaple</p>
<div class="section" id="classes">
<h2>7 Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="IPython.lib.display.Audio">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">Audio</tt><big>(</big><em>data=None</em>, <em>filename=None</em>, <em>url=None</em>, <em>embed=None</em>, <em>rate=None</em>, <em>autoplay=False</em><big>)</big><a class="headerlink" href="#IPython.lib.display.Audio" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="IPython.core.display.html#IPython.core.display.DisplayObject" title="IPython.core.display.DisplayObject"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.display.DisplayObject</span></tt></a></p>
<p>Create an audio object.</p>
<p>When this object is returned by an input cell or passed to the
display function, it will result in Audio controls being displayed
in the frontend (only works in the notebook).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>data</strong> : numpy array, list, unicode, str or bytes</p>
<blockquote>
<div><p>Can be a
* Numpy 1d array containing the desired waveform (mono)
* List of float or integer representing the waveform (mono)
* String containing the filename
* Bytestring containing raw PCM data or
* URL pointing to a file on the web.</p>
<p>If the array option is used the waveform will be normalized.</p>
<p>If a filename or url is used the format support will be browser 
dependent.</p>
</div></blockquote>
<p><strong>url</strong> : unicode</p>
<blockquote>
<div><p>A URL to download the data from.</p>
</div></blockquote>
<p><strong>filename</strong> : unicode</p>
<blockquote>
<div><p>Path to a local file to load the data from.</p>
</div></blockquote>
<p><strong>embed</strong> : boolean</p>
<blockquote>
<div><p>Should the image data be embedded using a data URI (True) or should
the original source be referenced. Set this to True if you want the 
audio to playable later with no internet connection in the notebook.</p>
<p>Default is <cite>True</cite>, unless the keyword argument <cite>url</cite> is set, then
default value is <cite>False</cite>.</p>
</div></blockquote>
<p><strong>rate</strong> : integer</p>
<blockquote>
<div><p>The sampling rate of the raw data.
Only required when data parameter is being used as an array</p>
</div></blockquote>
<p><strong>autoplay</strong> : bool</p>
<blockquote class="last">
<div><p>Set to True if the audio should immediately start playing.
Default is <cite>False</cite>.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre># Generate a sound
import numpy as np
framerate = 44100
t = np.linspace(0,5,framerate*5)
data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t))
Audio(data,rate=framerate)

Audio(&quot;http://www.nch.com.au/acm/8k16bitpcm.wav&quot;)  # From URL
Audio(url=&quot;http://www.w3schools.com/html/horse.ogg&quot;)

Audio(&#39;/path/to/sound.wav&#39;)  # From file
Audio(filename=&#39;/path/to/sound.ogg&#39;)

Audio(b&#39;RAW_WAV_DATA..)  # From bytes
Audio(data=b&#39;RAW_WAV_DATA..)
</pre></div>
</div>
<dl class="method">
<dt id="IPython.lib.display.Audio.__init__">
<tt class="descname">__init__</tt><big>(</big><em>data=None</em>, <em>filename=None</em>, <em>url=None</em>, <em>embed=None</em>, <em>rate=None</em>, <em>autoplay=False</em><big>)</big><a class="headerlink" href="#IPython.lib.display.Audio.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="IPython.lib.display.Audio.reload">
<tt class="descname">reload</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.display.Audio.reload" title="Permalink to this definition">¶</a></dt>
<dd><p>Reload the raw data from file or URL.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.IFrame">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">IFrame</tt><big>(</big><em>src</em>, <em>width</em>, <em>height</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.IFrame" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Generic class to embed an iframe in an IPython notebook</p>
<dl class="method">
<dt id="IPython.lib.display.IFrame.__init__">
<tt class="descname">__init__</tt><big>(</big><em>src</em>, <em>width</em>, <em>height</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.IFrame.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.YouTubeVideo">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">YouTubeVideo</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.YouTubeVideo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.display.IFrame" title="IPython.lib.display.IFrame"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.display.IFrame</span></tt></a></p>
<p>Class for embedding a YouTube Video in an IPython session, based on its video id.</p>
<p>e.g. to embed the video from <a class="reference external" href="https://www.youtube.com/watch?v=foo">https://www.youtube.com/watch?v=foo</a> , you would
do:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">vid</span> <span class="o">=</span> <span class="n">YouTubeVideo</span><span class="p">(</span><span class="s">&quot;foo&quot;</span><span class="p">)</span>
<span class="n">display</span><span class="p">(</span><span class="n">vid</span><span class="p">)</span>
</pre></div>
</div>
<p>To start from 30 seconds:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">vid</span> <span class="o">=</span> <span class="n">YouTubeVideo</span><span class="p">(</span><span class="s">&quot;abc&quot;</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="mi">30</span><span class="p">)</span>
<span class="n">display</span><span class="p">(</span><span class="n">vid</span><span class="p">)</span>
</pre></div>
</div>
<p>To calculate seconds from time as hours, minutes, seconds use
<a class="reference external" href="http://docs.python.org/2/library/datetime.html#datetime.timedelta" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">datetime.timedelta</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">start</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">timedelta</span><span class="p">(</span><span class="n">hours</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">minutes</span><span class="o">=</span><span class="mi">46</span><span class="p">,</span> <span class="n">seconds</span><span class="o">=</span><span class="mi">40</span><span class="p">)</span><span class="o">.</span><span class="n">total_seconds</span><span class="p">())</span>
</pre></div>
</div>
<p>Other parameters can be provided as documented at
<a class="reference external" href="https://developers.google.com/youtube/player_parameters#parameter-subheader">https://developers.google.com/youtube/player_parameters#parameter-subheader</a></p>
<dl class="method">
<dt id="IPython.lib.display.YouTubeVideo.__init__">
<tt class="descname">__init__</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.YouTubeVideo.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.VimeoVideo">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">VimeoVideo</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.VimeoVideo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.display.IFrame" title="IPython.lib.display.IFrame"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.display.IFrame</span></tt></a></p>
<p>Class for embedding a Vimeo video in an IPython session, based on its video id.</p>
<dl class="method">
<dt id="IPython.lib.display.VimeoVideo.__init__">
<tt class="descname">__init__</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.VimeoVideo.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.ScribdDocument">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">ScribdDocument</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.ScribdDocument" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.display.IFrame" title="IPython.lib.display.IFrame"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.display.IFrame</span></tt></a></p>
<p>Class for embedding a Scribd document in an IPython session</p>
<p>Use the start_page params to specify a starting point in the document
Use the view_mode params to specify display type one off scroll | slideshow | book</p>
<p>e.g to Display Wes&#8217; foundational paper about PANDAS in book mode from page 3</p>
<p>ScribdDocument(71048089, width=800, height=400, start_page=3, view_mode=&#8221;book&#8221;)</p>
<dl class="method">
<dt id="IPython.lib.display.ScribdDocument.__init__">
<tt class="descname">__init__</tt><big>(</big><em>id</em>, <em>width=400</em>, <em>height=300</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.lib.display.ScribdDocument.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.FileLink">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">FileLink</tt><big>(</big><em>path</em>, <em>url_prefix=''</em>, <em>result_html_prefix=''</em>, <em>result_html_suffix='&lt;br&gt;'</em><big>)</big><a class="headerlink" href="#IPython.lib.display.FileLink" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Class for embedding a local file link in an IPython session, based on path</p>
<p>e.g. to embed a link that was generated in the IPython notebook as my/data.txt</p>
<p>you would do:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">local_file</span> <span class="o">=</span> <span class="n">FileLink</span><span class="p">(</span><span class="s">&quot;my/data.txt&quot;</span><span class="p">)</span>
<span class="n">display</span><span class="p">(</span><span class="n">local_file</span><span class="p">)</span>
</pre></div>
</div>
<p>or in the HTML notebook, just:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">FileLink</span><span class="p">(</span><span class="s">&quot;my/data.txt&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="IPython.lib.display.FileLink.__init__">
<tt class="descname">__init__</tt><big>(</big><em>path</em>, <em>url_prefix=''</em>, <em>result_html_prefix=''</em>, <em>result_html_suffix='&lt;br&gt;'</em><big>)</big><a class="headerlink" href="#IPython.lib.display.FileLink.__init__" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>path</strong> : str</p>
<blockquote>
<div><p>path to the file or directory that should be formatted</p>
</div></blockquote>
<p><strong>directory_prefix</strong> : str</p>
<blockquote>
<div><p>prefix to be prepended to all files to form a working link [default:
&#8216;files&#8217;]</p>
</div></blockquote>
<p><strong>result_html_prefix</strong> : str</p>
<blockquote>
<div><p>text to append to beginning to link [default: none]</p>
</div></blockquote>
<p><strong>result_html_suffix</strong> : str</p>
<blockquote class="last">
<div><p>text to append at the end of link [default: &#8216;&lt;br&gt;&#8217;]</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.display.FileLinks">
<em class="property">class </em><tt class="descclassname">IPython.lib.display.</tt><tt class="descname">FileLinks</tt><big>(</big><em>path</em>, <em>url_prefix=''</em>, <em>included_suffixes=None</em>, <em>result_html_prefix=''</em>, <em>result_html_suffix='&lt;br&gt;'</em>, <em>notebook_display_formatter=None</em>, <em>terminal_display_formatter=None</em><big>)</big><a class="headerlink" href="#IPython.lib.display.FileLinks" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.display.FileLink" title="IPython.lib.display.FileLink"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.display.FileLink</span></tt></a></p>
<p>Class for embedding local file links in an IPython session, based on path</p>
<p>e.g. to embed links to files that were generated in the IPython notebook
under <tt class="docutils literal"><span class="pre">my/data</span></tt>, you would do:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">local_files</span> <span class="o">=</span> <span class="n">FileLinks</span><span class="p">(</span><span class="s">&quot;my/data&quot;</span><span class="p">)</span>
<span class="n">display</span><span class="p">(</span><span class="n">local_files</span><span class="p">)</span>
</pre></div>
</div>
<p>or in the HTML notebook, just:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">FileLinks</span><span class="p">(</span><span class="s">&quot;my/data&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="IPython.lib.display.FileLinks.__init__">
<tt class="descname">__init__</tt><big>(</big><em>path</em>, <em>url_prefix=''</em>, <em>included_suffixes=None</em>, <em>result_html_prefix=''</em>, <em>result_html_suffix='&lt;br&gt;'</em>, <em>notebook_display_formatter=None</em>, <em>terminal_display_formatter=None</em><big>)</big><a class="headerlink" href="#IPython.lib.display.FileLinks.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>See <a class="reference internal" href="#IPython.lib.display.FileLink" title="IPython.lib.display.FileLink"><tt class="xref py py-class docutils literal"><span class="pre">FileLink</span></tt></a> for the <tt class="docutils literal"><span class="pre">path</span></tt>, <tt class="docutils literal"><span class="pre">url_prefix</span></tt>,
<tt class="docutils literal"><span class="pre">result_html_prefix</span></tt> and <tt class="docutils literal"><span class="pre">result_html_suffix</span></tt> parameters.</p>
<dl class="docutils">
<dt>included_suffixes <span class="classifier-delimiter">:</span> <span class="classifier">list</span></dt>
<dd>Filename suffixes to include when formatting output [default: include
all files]</dd>
<dt>notebook_display_formatter <span class="classifier-delimiter">:</span> <span class="classifier">function</span></dt>
<dd>Used to format links for display in the notebook. See discussion of
formatter functions below.</dd>
<dt>terminal_display_formatter <span class="classifier-delimiter">:</span> <span class="classifier">function</span></dt>
<dd>Used to format links for display in the terminal. See discussion of
formatter functions below.</dd>
</dl>
<p>Formatter functions must be of the form:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">f</span><span class="p">(</span><span class="n">dirname</span><span class="p">,</span> <span class="n">fnames</span><span class="p">,</span> <span class="n">included_suffixes</span><span class="p">)</span>
</pre></div>
</div>
<dl class="docutils">
<dt>dirname <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The name of a directory</dd>
<dt>fnames <span class="classifier-delimiter">:</span> <span class="classifier">list</span></dt>
<dd>The files in that directory</dd>
<dt>included_suffixes <span class="classifier-delimiter">:</span> <span class="classifier">list</span></dt>
<dd>The file suffixes that should be included in the output (passing None
meansto include all suffixes in the output in the built-in formatters)</dd>
</dl>
<p>The function should return a list of lines that will be printed in the
notebook (if passing notebook_display_formatter) or the terminal (if
passing terminal_display_formatter). This function is iterated over for
each directory in self.path. Default formatters are in place, can be
passed here to support alternative formatting.</p>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="IPython.lib.editorhooks.html" title="Module: lib.editorhooks"
             >next</a> |</li>
        <li class="right" >
          <a href="IPython.lib.demo.html" title="Module: lib.demo"
             >previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" >The IPython API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright The IPython Development Team.
      Last updated on Sep 02, 2015.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>