PageRenderTime 67ms CodeModel.GetById 23ms app.highlight 37ms RepoModel.GetById 2ms app.codeStats 0ms

/apidocs/echonest.sorting-pysrc.html

http://echo-nest-remix.googlecode.com/
HTML | 203 lines | 172 code | 10 blank | 21 comment | 0 complexity | d9ec4b0690fdea0e5904ea7c9a336284 MD5 | raw file
  1<?xml version="1.0" encoding="ascii"?>
  2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3          "DTD/xhtml1-transitional.dtd">
  4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5<head>
  6  <title>echonest.sorting</title>
  7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  8  <script type="text/javascript" src="epydoc.js"></script>
  9</head>
 10
 11<body bgcolor="white" text="black" link="blue" vlink="#204080"
 12      alink="#204080">
 13<!-- ==================== NAVIGATION BAR ==================== -->
 14<table class="navbar" border="0" width="100%" cellpadding="0"
 15       bgcolor="#a0c0ff" cellspacing="0">
 16  <tr valign="middle">
 17
 18  <!-- Tree link -->
 19      <th>&nbsp;&nbsp;&nbsp;<a
 20        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 21
 22  <!-- Index link -->
 23      <th>&nbsp;&nbsp;&nbsp;<a
 24        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 25
 26  <!-- Help link -->
 27      <th>&nbsp;&nbsp;&nbsp;<a
 28        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 29
 30  <!-- Project homepage -->
 31      <th class="navbar" align="right" width="100%">
 32        <table border="0" cellpadding="0" cellspacing="0">
 33          <tr><th class="navbar" align="center"
 34            ><a class="navbar" target="_top" href="http://code.google.com/p/echo-nest-remix/">Project Homepage</a></th>
 35          </tr></table></th>
 36  </tr>
 37</table>
 38<table width="100%" cellpadding="0" cellspacing="0">
 39  <tr valign="top">
 40    <td width="100%">
 41      <span class="breadcrumbs">
 42        <a href="echonest-module.html">Package&nbsp;echonest</a> ::
 43        Module&nbsp;sorting
 44      </span>
 45    </td>
 46    <td>
 47      <table cellpadding="0" cellspacing="0">
 48        <!-- hide/show private -->
 49        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
 50    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
 51        <tr><td align="right"><span class="options"
 52            >[<a href="frames.html" target="_top">frames</a
 53            >]&nbsp;|&nbsp;<a href="echonest.sorting-pysrc.html"
 54            target="_top">no&nbsp;frames</a>]</span></td></tr>
 55      </table>
 56    </td>
 57  </tr>
 58</table>
 59<h1 class="epydoc">Source Code for <a href="echonest.sorting-module.html">Module echonest.sorting</a></h1>
 60<pre class="py-src">
 61<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
 62<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-docstring">Sorting key functions as utilities for `echonest.audio`.</tt> </tt>
 63<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 64<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"><tt class="py-docstring">For convenience, intended to be imported as::</tt> </tt>
 65<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 66<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-docstring">   from audio.sorting import *</tt> </tt>
 67<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 68<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-docstring">All of the functions in this module can be used as a sorting key for</tt> </tt>
 69<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring">`AudioQuantumList.ordered_by`, as in::</tt> </tt>
 70<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 71<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-docstring">    analysis.segments.ordered_by(duration)</tt> </tt>
 72<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 73<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-docstring">Some of the functions in this module return *another* function that takes </tt> </tt>
 74<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-docstring">one argument, an `AudioQuantum`, and returns a value (typically a `float`)</tt> </tt>
 75<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-docstring">that can then be used as a sorting value.</tt> </tt>
 76<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 77<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line"><tt class="py-docstring">By convention, all of these functions are named to be noun phrases that </tt> </tt>
 78<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line"><tt class="py-docstring">follow `sorted_by`, as seen above.</tt> </tt>
 79<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
 80<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"> </tt>
 81<a name="confidence"></a><div id="confidence-def"><a name="L21"></a><tt class="py-lineno">21</tt> <a class="py-toggle" href="#" id="confidence-toggle" onclick="return toggle('confidence');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#confidence">confidence</a><tt class="py-op">(</tt><tt class="py-param">x</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>       </tt>
 82</div><a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
 83<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line"><tt class="py-docstring">    Returns the `AudioQuantum`\'s `confidence` as a sorting value.</tt> </tt>
 84<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
 85<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable echonest.audio.AudioQuantumList.confidence=echonest.audio.AudioQuantumList-class.html#confidence,Function echonest.sorting.confidence()=echonest.sorting-module.html#confidence"><a title="echonest.audio.AudioQuantumList.confidence
 86echonest.sorting.confidence" class="py-name" href="#" onclick="return doclink('link-0', 'confidence', 'link-0');">confidence</a></tt> </tt>
 87</div><a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"> </tt>
 88<a name="duration"></a><div id="duration-def"><a name="L27"></a><tt class="py-lineno">27</tt> <a class="py-toggle" href="#" id="duration-toggle" onclick="return toggle('duration');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#duration">duration</a><tt class="py-op">(</tt><tt class="py-param">x</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>       </tt>
 89</div><a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
 90<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line"><tt class="py-docstring">    Returns the `AudioQuantum`\'s `duration` as a sorting value.</tt> </tt>
 91<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
 92<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Variable echonest.audio.AudioData.duration=echonest.audio.AudioData-class.html#duration,Variable echonest.audio.AudioQuantumList.duration=echonest.audio.AudioQuantumList-class.html#duration,Variable echonest.audio.LocalAudioFile.duration=echonest.audio.LocalAudioFile-class.html#duration,Variable echonest.audio.ModifiedRenderable.duration=echonest.audio.ModifiedRenderable-class.html#duration,Variable echonest.audio.Simultaneous.duration=echonest.audio.Simultaneous-class.html#duration,Method echonest.audio.TimeTruncateFactor.duration()=echonest.audio.TimeTruncateFactor-class.html#duration,Method echonest.audio.TimeTruncateLength.duration()=echonest.audio.TimeTruncateLength-class.html#duration,Function echonest.sorting.duration()=echonest.sorting-module.html#duration,Method echonest.video.ImageSequence.duration()=echonest.video.ImageSequence-class.html#duration"><a title="echonest.audio.AudioData.duration
 93echonest.audio.AudioQuantumList.duration
 94echonest.audio.LocalAudioFile.duration
 95echonest.audio.ModifiedRenderable.duration
 96echonest.audio.Simultaneous.duration
 97echonest.audio.TimeTruncateFactor.duration
 98echonest.audio.TimeTruncateLength.duration
 99echonest.sorting.duration
100echonest.video.ImageSequence.duration" class="py-name" href="#" onclick="return doclink('link-1', 'duration', 'link-1');">duration</a></tt> </tt>
101</div><a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line"> </tt>
102<a name="timbre_value"></a><div id="timbre_value-def"><a name="L33"></a><tt class="py-lineno">33</tt> <a class="py-toggle" href="#" id="timbre_value-toggle" onclick="return toggle('timbre_value');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#timbre_value">timbre_value</a><tt class="py-op">(</tt><tt class="py-param">index</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
103</div><div id="timbre_value-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="timbre_value-expanded"><a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
104<a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line"><tt class="py-docstring">    Returns a function that returns the value of `timbre`\[*index*]</tt> </tt>
105<a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line"><tt class="py-docstring">    of its input `AudioQuantum`. Sorts by the values of the *index*-th </tt> </tt>
106<a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line"><tt class="py-docstring">    value in the timbre vector.</tt> </tt>
107<a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
108<a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Variable echonest.audio.AudioQuantumList.timbre=echonest.audio.AudioQuantumList-class.html#timbre"><a title="echonest.audio.AudioQuantumList.timbre" class="py-name" href="#" onclick="return doclink('link-2', 'timbre', 'link-2');">timbre</a></tt><tt class="py-op">[</tt><tt class="py-name">index</tt><tt class="py-op">]</tt> </tt>
109</div><a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line"> </tt>
110<a name="pitch_value"></a><div id="pitch_value-def"><a name="L41"></a><tt class="py-lineno">41</tt> <a class="py-toggle" href="#" id="pitch_value-toggle" onclick="return toggle('pitch_value');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#pitch_value">pitch_value</a><tt class="py-op">(</tt><tt class="py-param">index</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
111</div><div id="pitch_value-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="pitch_value-expanded"><a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
112<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line"><tt class="py-docstring">    Returns a function that returns the value of `pitch`\[*index*]</tt> </tt>
113<a name="L44"></a><tt class="py-lineno">44</tt>  <tt class="py-line"><tt class="py-docstring">    of its input `AudioQuantum`. Sorts by the values of the *index*-th </tt> </tt>
114<a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line"><tt class="py-docstring">    value in the pitch vector.</tt> </tt>
115<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
116<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Variable echonest.audio.AudioQuantumList.pitches=echonest.audio.AudioQuantumList-class.html#pitches"><a title="echonest.audio.AudioQuantumList.pitches" class="py-name" href="#" onclick="return doclink('link-3', 'pitches', 'link-3');">pitches</a></tt><tt class="py-op">[</tt><tt class="py-name">index</tt><tt class="py-op">]</tt> </tt>
117</div><a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line"> </tt>
118<a name="pitch_distance_from"></a><div id="pitch_distance_from-def"><a name="L49"></a><tt class="py-lineno">49</tt> <a class="py-toggle" href="#" id="pitch_distance_from-toggle" onclick="return toggle('pitch_distance_from');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#pitch_distance_from">pitch_distance_from</a><tt class="py-op">(</tt><tt class="py-param">seg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
119</div><div id="pitch_distance_from-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="pitch_distance_from-expanded"><a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
120<a name="L51"></a><tt class="py-lineno">51</tt>  <tt class="py-line"><tt class="py-docstring">    Returns a function that returns the sum of the squared differences</tt> </tt>
121<a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line"><tt class="py-docstring">    between the `pitch` vector of its input `AudioQuantum` and the `pitch` </tt> </tt>
122<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line"><tt class="py-docstring">    vector of the reference parameter *seg*. Sorts by the pitch distance </tt> </tt>
123<a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line"><tt class="py-docstring">    from the reference `AudioSegment`.</tt> </tt>
124<a name="L55"></a><tt class="py-lineno">55</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
125<a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> <tt id="link-4" class="py-name" targets="Method echonest.audio.AudioData.sum()=echonest.audio.AudioData-class.html#sum"><a title="echonest.audio.AudioData.sum" class="py-name" href="#" onclick="return doclink('link-4', 'sum', 'link-4');">sum</a></tt><tt class="py-op">(</tt><tt class="py-name">map</tt><tt class="py-op">(</tt><tt id="link-5" class="py-name" targets="Function echonest.sorting._diff_squared()=echonest.sorting-module.html#_diff_squared"><a title="echonest.sorting._diff_squared" class="py-name" href="#" onclick="return doclink('link-5', '_diff_squared', 'link-5');">_diff_squared</a></tt><tt class="py-op">,</tt> <tt class="py-name">seg</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="echonest.audio.AudioQuantumList.pitches" class="py-name" href="#" onclick="return doclink('link-6', 'pitches', 'link-3');">pitches</a></tt><tt class="py-op">,</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="echonest.audio.AudioQuantumList.pitches" class="py-name" href="#" onclick="return doclink('link-7', 'pitches', 'link-3');">pitches</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
126</div><a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line"> </tt>
127<a name="timbre_distance_from"></a><div id="timbre_distance_from-def"><a name="L58"></a><tt class="py-lineno">58</tt> <a class="py-toggle" href="#" id="timbre_distance_from-toggle" onclick="return toggle('timbre_distance_from');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#timbre_distance_from">timbre_distance_from</a><tt class="py-op">(</tt><tt class="py-param">seg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
128</div><div id="timbre_distance_from-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="timbre_distance_from-expanded"><a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
129<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line"><tt class="py-docstring">    Returns a function that returns the sum of the squared differences </tt> </tt>
130<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line"><tt class="py-docstring">    between the `pitch` vector of its input `AudioQuantum` and the `pitch` </tt> </tt>
131<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line"><tt class="py-docstring">    vector of the reference parameter *seg*. Sorts by the pitch distance </tt> </tt>
132<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line"><tt class="py-docstring">    from the reference `AudioSegment`.</tt> </tt>
133<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
134<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> <tt id="link-8" class="py-name"><a title="echonest.audio.AudioData.sum" class="py-name" href="#" onclick="return doclink('link-8', 'sum', 'link-4');">sum</a></tt><tt class="py-op">(</tt><tt class="py-name">map</tt><tt class="py-op">(</tt><tt id="link-9" class="py-name"><a title="echonest.sorting._diff_squared" class="py-name" href="#" onclick="return doclink('link-9', '_diff_squared', 'link-5');">_diff_squared</a></tt><tt class="py-op">,</tt> <tt class="py-name">seg</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="echonest.audio.AudioQuantumList.timbre" class="py-name" href="#" onclick="return doclink('link-10', 'timbre', 'link-2');">timbre</a></tt><tt class="py-op">,</tt> <tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name"><a title="echonest.audio.AudioQuantumList.timbre" class="py-name" href="#" onclick="return doclink('link-11', 'timbre', 'link-2');">timbre</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
135</div><a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line"> </tt>
136<a name="noisiness"></a><div id="noisiness-def"><a name="L67"></a><tt class="py-lineno">67</tt> <a class="py-toggle" href="#" id="noisiness-toggle" onclick="return toggle('noisiness');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#noisiness">noisiness</a><tt class="py-op">(</tt><tt class="py-param">x</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
137</div><div id="noisiness-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="noisiness-expanded"><a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
138<a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line"><tt class="py-docstring">    Returns the sum of the twelve pitch vectors' elements. This is a very</tt> </tt>
139<a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line"><tt class="py-docstring">    fast way of judging the relative noisiness of a segment.</tt> </tt>
140<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
141<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-12" class="py-name"><a title="echonest.audio.AudioData.sum" class="py-name" href="#" onclick="return doclink('link-12', 'sum', 'link-4');">sum</a></tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="echonest.audio.AudioQuantumList.pitches" class="py-name" href="#" onclick="return doclink('link-13', 'pitches', 'link-3');">pitches</a></tt><tt class="py-op">)</tt> </tt>
142</div><a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line"> </tt>
143<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line"><tt class="py-comment"># local helper functions:</tt> </tt>
144<a name="_diff_squared"></a><div id="_diff_squared-def"><a name="L75"></a><tt class="py-lineno">75</tt> <a class="py-toggle" href="#" id="_diff_squared-toggle" onclick="return toggle('_diff_squared');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.sorting-module.html#_diff_squared">_diff_squared</a><tt class="py-op">(</tt><tt class="py-param">a</tt><tt class="py-op">,</tt> <tt class="py-param">b</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
145</div><div id="_diff_squared-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="_diff_squared-expanded"><a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
146<a name="L77"></a><tt class="py-lineno">77</tt>  <tt class="py-line"><tt class="py-docstring">    Local helper function. The square of the difference between a and b.</tt> </tt>
147<a name="L78"></a><tt class="py-lineno">78</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
148<a name="L79"></a><tt class="py-lineno">79</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">pow</tt><tt class="py-op">(</tt><tt class="py-name">a</tt><tt class="py-op">-</tt><tt class="py-name">b</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
149</div><a name="L80"></a><tt class="py-lineno">80</tt>  <tt class="py-line"> </tt><script type="text/javascript">
150<!--
151expandto(location.href);
152// -->
153</script>
154</pre>
155<br />
156<!-- ==================== NAVIGATION BAR ==================== -->
157<table class="navbar" border="0" width="100%" cellpadding="0"
158       bgcolor="#a0c0ff" cellspacing="0">
159  <tr valign="middle">
160
161  <!-- Tree link -->
162      <th>&nbsp;&nbsp;&nbsp;<a
163        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
164
165  <!-- Index link -->
166      <th>&nbsp;&nbsp;&nbsp;<a
167        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
168
169  <!-- Help link -->
170      <th>&nbsp;&nbsp;&nbsp;<a
171        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
172
173  <!-- Project homepage -->
174      <th class="navbar" align="right" width="100%">
175        <table border="0" cellpadding="0" cellspacing="0">
176          <tr><th class="navbar" align="center"
177            ><a class="navbar" target="_top" href="http://code.google.com/p/echo-nest-remix/">Project Homepage</a></th>
178          </tr></table></th>
179  </tr>
180</table>
181<table border="0" cellpadding="0" cellspacing="0" width="100%%">
182  <tr>
183    <td align="left" class="footer">
184    Generated by Epydoc 3.0.1 on Wed Sep  1 16:09:00 2010
185    </td>
186    <td align="right" class="footer">
187      <a target="mainFrame" href="http://epydoc.sourceforge.net"
188        >http://epydoc.sourceforge.net</a>
189    </td>
190  </tr>
191</table>
192
193<script type="text/javascript">
194  <!--
195  // Private objects are initially displayed (because if
196  // javascript is turned off then we want them to be
197  // visible); but by default, we want to hide them.  So hide
198  // them unless we have a cookie that says to show them.
199  checkCookie();
200  // -->
201</script>
202</body>
203</html>