Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 4726f970c4b56b9a0ebb9a03a0b6522e > files > 178

python-tables-doc-3.0.0-4.mga4.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>Declarative classes &mdash; PyTables 3.0.0 documentation</title>
    
    <link rel="stylesheet" href="../../_static/cloud.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../../" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '3.0.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>
    <script type="text/javascript" src="../../_static/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../_static/toggle_sections.js"></script>
    <script type="text/javascript" src="../../_static/toggle_sidebar.js"></script>
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="top" title="PyTables 3.0.0 documentation" href="../../index.html" />
    <link rel="up" title="Library Reference" href="../libref.html" />
    <link rel="next" title="Helper classes" href="helper_classes.html" />
    <link rel="prev" title="Link classes" href="link_classes.html" /> 
  </head>
  <body>
    <div class="relbar-top">
        
    <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> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="../../np-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="helper_classes.html" title="Helper classes"
             accesskey="N">next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="link_classes.html" title="Link classes"
             accesskey="P">previous</a> &nbsp; &nbsp;</li>
    <li><a href="../../index.html">PyTables 3.0.0 documentation</a> &raquo;</li>

          <li><a href="../index.html" >PyTables User&#8217;s Guide</a> &raquo;</li>
          <li><a href="../libref.html" accesskey="U">Library Reference</a> &raquo;</li> 
      </ul>
    </div>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="declarative-classes">
<h1>Declarative classes<a class="headerlink" href="#declarative-classes" title="Permalink to this headline">¶</a></h1>
<p>In this section a series of classes that are meant to
<em>declare</em> datatypes that are required for creating
primary PyTables datasets are described.</p>
<div class="section" id="the-atom-class-and-its-descendants">
<span id="atomclassdescr"></span><h2>The Atom class and its descendants<a class="headerlink" href="#the-atom-class-and-its-descendants" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="tables.Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Atom</tt><big>(</big><em>nptype</em>, <em>shape</em>, <em>dflt</em><big>)</big><a class="headerlink" href="#tables.Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the type of atomic cells stored in a dataset.</p>
<p>The meaning of <em>atomic</em> is that individual elements of a cell can
not be extracted directly by indexing (i.e.  __getitem__()) the
dataset; e.g. if a dataset has shape (2, 2) and its atoms have
shape (3,), to get the third element of the cell at (1, 0) one
should use dataset[1,0][2] instead of dataset[1,0,2].</p>
<p>The Atom class is meant to declare the different properties of the
<em>base element</em> (also known as <em>atom</em>) of CArray, EArray and
VLArray datasets, although they are also used to describe the base
elements of Array datasets. Atoms have the property that their
length is always the same.  However, you can grow datasets along
the extensible dimension in the case of EArray or put a variable
number of them on a VLArray row. Moreover, they are not restricted
to scalar values, and they can be <em>fully multidimensional
objects</em>.</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>itemsize</strong> : int</p>
<blockquote>
<div><p>For types with a non-fixed size, this sets the size in
bytes of individual items in the atom.</p>
</div></blockquote>
<p><strong>shape</strong> : tuple</p>
<blockquote>
<div><p>Sets the shape of the atom. An integer shape of
N is equivalent to the tuple (N,).</p>
</div></blockquote>
<p><strong>dflt</strong> :</p>
<blockquote>
<div><p>Sets the default value for the atom.</p>
</div></blockquote>
<p class="last"><strong>The following are the public methods and attributes of the Atom class.</strong> :</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>A series of descendant classes are offered in order to make the
use of these element descriptions easier. You should use a
particular Atom descendant class whenever you know the exact type
you will need when writing your code. Otherwise, you may use one
of the Atom.from_*() factory Methods.</p>
<p class="rubric">Arom attributes</p>
<dl class="attribute">
<dt id="tables.Atom.dflt">
<tt class="descname">dflt</tt><a class="headerlink" href="#tables.Atom.dflt" title="Permalink to this definition">¶</a></dt>
<dd><p>The default value of the atom.</p>
<p>If the user does not supply a value for an element while
filling a dataset, this default value will be written to disk.
If the user supplies a scalar value for a multidimensional
atom, this value is automatically <em>broadcast</em> to all the items
in the atom cell. If dflt is not supplied, an appropriate zero
value (or <em>null</em> string) will be chosen by default.  Please
note that default values are kept internally as NumPy objects.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.dtype">
<tt class="descname">dtype</tt><a class="headerlink" href="#tables.Atom.dtype" title="Permalink to this definition">¶</a></dt>
<dd><p>The NumPy dtype that most closely matches this atom.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.itemsize">
<tt class="descname">itemsize</tt><a class="headerlink" href="#tables.Atom.itemsize" title="Permalink to this definition">¶</a></dt>
<dd><p>Size in bytes of a single item in the atom.
Specially useful for atoms of the string kind.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.kind">
<tt class="descname">kind</tt><a class="headerlink" href="#tables.Atom.kind" title="Permalink to this definition">¶</a></dt>
<dd><p>The PyTables kind of the atom (a string).</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.shape">
<tt class="descname">shape</tt><a class="headerlink" href="#tables.Atom.shape" title="Permalink to this definition">¶</a></dt>
<dd><p>The shape of the atom (a tuple for scalar atoms).</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.type">
<tt class="descname">type</tt><a class="headerlink" href="#tables.Atom.type" title="Permalink to this definition">¶</a></dt>
<dd><p>The PyTables type of the atom (a string).</p>
<p>Atoms can be compared with atoms and other objects for
strict (in)equality without having to compare individual
attributes:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">=</span> <span class="n">StringAtom</span><span class="p">(</span><span class="n">itemsize</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>  <span class="c"># same as ``atom2``</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom2</span> <span class="o">=</span> <span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;string&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>  <span class="c"># same as ``atom1``</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom3</span> <span class="o">=</span> <span class="n">IntAtom</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="s">&#39;foo&#39;</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">atom2</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom2</span> <span class="o">!=</span> <span class="n">atom1</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">atom3</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom3</span> <span class="o">!=</span> <span class="n">atom2</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<div class="section" id="atom-properties">
<h3>Atom properties<a class="headerlink" href="#atom-properties" title="Permalink to this headline">¶</a></h3>
<dl class="attribute">
<dt id="tables.Atom.ndim">
<tt class="descclassname">Atom.</tt><tt class="descname">ndim</tt><a class="headerlink" href="#tables.Atom.ndim" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of dimensions of the atom.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.4.</span></p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.recarrtype">
<tt class="descclassname">Atom.</tt><tt class="descname">recarrtype</tt><a class="headerlink" href="#tables.Atom.recarrtype" title="Permalink to this definition">¶</a></dt>
<dd><p>String type to be used in numpy.rec.array().</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.Atom.size">
<tt class="descclassname">Atom.</tt><tt class="descname">size</tt><a class="headerlink" href="#tables.Atom.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Total size in bytes of the atom.</p>
</dd></dl>

</div>
<div class="section" id="atom-methods">
<h3>Atom methods<a class="headerlink" href="#atom-methods" title="Permalink to this headline">¶</a></h3>
<dl class="method">
<dt id="tables.Atom.copy">
<tt class="descclassname">Atom.</tt><tt class="descname">copy</tt><big>(</big><em>**override</em><big>)</big><a class="headerlink" href="#tables.Atom.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a copy of the atom, possibly overriding some arguments.</p>
<p>Constructor arguments to be overridden must be passed as
keyword arguments:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">=</span> <span class="n">Int32Atom</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom2</span> <span class="o">=</span> <span class="n">atom1</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">atom1</span><span class="p">)</span>
<span class="go">Int32Atom(shape=(12,), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">atom2</span><span class="p">)</span>
<span class="go">Int32Atom(shape=(12,), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="ow">is</span> <span class="n">atom2</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom3</span> <span class="o">=</span> <span class="n">atom1</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">atom3</span><span class="p">)</span>
<span class="go">Int32Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">foobar</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">TypeError</span>: <span class="n">__init__() got an unexpected keyword argument &#39;foobar&#39;</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="atom-factory-methods">
<h3>Atom factory methods<a class="headerlink" href="#atom-factory-methods" title="Permalink to this headline">¶</a></h3>
<dl class="classmethod">
<dt id="tables.Atom.from_dtype">
<em class="property">classmethod </em><tt class="descclassname">Atom.</tt><tt class="descname">from_dtype</tt><big>(</big><em>class_</em>, <em>dtype</em>, <em>dflt=None</em><big>)</big><a class="headerlink" href="#tables.Atom.from_dtype" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an Atom from a NumPy dtype.</p>
<p>An optional default value may be specified as the dflt
argument. Information in the dtype not represented in an Atom is
ignored:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_dtype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">dtype</span><span class="p">((</span><span class="n">numpy</span><span class="o">.</span><span class="n">int16</span><span class="p">,</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))))</span>
<span class="go">Int16Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_dtype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">dtype</span><span class="p">(</span><span class="s">&#39;Float64&#39;</span><span class="p">))</span>
<span class="go">Float64Atom(shape=(), dflt=0.0)</span>
</pre></div>
</div>
</dd></dl>

<dl class="classmethod">
<dt id="tables.Atom.from_kind">
<em class="property">classmethod </em><tt class="descclassname">Atom.</tt><tt class="descname">from_kind</tt><big>(</big><em>class_</em>, <em>kind</em>, <em>itemsize=None</em>, <em>shape=()</em>, <em>dflt=None</em><big>)</big><a class="headerlink" href="#tables.Atom.from_kind" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an Atom from a PyTables kind.</p>
<p>Optional item size, shape and default value may be
specified as the itemsize, shape and dflt
arguments, respectively. Bear in mind that not all atoms support
a default item size:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;int&#39;</span><span class="p">,</span> <span class="n">itemsize</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">Int16Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;int&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">Int32Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;int&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="go">Int32Atom(shape=(1,), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;string&#39;</span><span class="p">,</span> <span class="n">dflt</span><span class="o">=</span><span class="n">b</span><span class="s">&#39;hello&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">no default item size for kind ``string``</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;Float&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">unknown kind: &#39;Float&#39;</span>
</pre></div>
</div>
<p>Moreover, some kinds with atypical constructor signatures
are not supported; you need to use the proper
constructor:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_kind</span><span class="p">(</span><span class="s">&#39;enum&#39;</span><span class="p">)</span> 
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">the ``enum`` kind is not supported...</span>
</pre></div>
</div>
</dd></dl>

<dl class="classmethod">
<dt id="tables.Atom.from_sctype">
<em class="property">classmethod </em><tt class="descclassname">Atom.</tt><tt class="descname">from_sctype</tt><big>(</big><em>class_</em>, <em>sctype</em>, <em>shape=()</em>, <em>dflt=None</em><big>)</big><a class="headerlink" href="#tables.Atom.from_sctype" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an Atom from a NumPy scalar type sctype.</p>
<p>Optional shape and default value may be specified as the
shape and dflt
arguments, respectively. Information in the
sctype not represented in an Atom is ignored:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_sctype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">int16</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">Int16Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_sctype</span><span class="p">(</span><span class="s">&#39;S5&#39;</span><span class="p">,</span> <span class="n">dflt</span><span class="o">=</span><span class="s">&#39;hello&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">unknown NumPy scalar type: &#39;S5&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_sctype</span><span class="p">(</span><span class="s">&#39;Float64&#39;</span><span class="p">)</span>
<span class="go">Float64Atom(shape=(), dflt=0.0)</span>
</pre></div>
</div>
</dd></dl>

<dl class="classmethod">
<dt id="tables.Atom.from_type">
<em class="property">classmethod </em><tt class="descclassname">Atom.</tt><tt class="descname">from_type</tt><big>(</big><em>class_</em>, <em>type</em>, <em>shape=()</em>, <em>dflt=None</em><big>)</big><a class="headerlink" href="#tables.Atom.from_type" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an Atom from a PyTables type.</p>
<p>Optional shape and default value may be specified as the
shape and dflt arguments, respectively:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_type</span><span class="p">(</span><span class="s">&#39;bool&#39;</span><span class="p">)</span>
<span class="go">BoolAtom(shape=(), dflt=False)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_type</span><span class="p">(</span><span class="s">&#39;int16&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">Int16Atom(shape=(2, 2), dflt=0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_type</span><span class="p">(</span><span class="s">&#39;string40&#39;</span><span class="p">,</span> <span class="n">dflt</span><span class="o">=</span><span class="s">&#39;hello&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">unknown type: &#39;string40&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Atom</span><span class="o">.</span><span class="n">from_type</span><span class="p">(</span><span class="s">&#39;Float64&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">unknown type: &#39;Float64&#39;</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="atom-sub-classes">
<h3>Atom Sub-classes<a class="headerlink" href="#atom-sub-classes" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="tables.StringAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">StringAtom</tt><big>(</big><em>itemsize</em>, <em>shape=()</em>, <em>dflt=''</em><big>)</big><a class="headerlink" href="#tables.StringAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type string.</p>
<p>The item size is the <em>maximum</em> length in characters of strings.</p>
<dl class="attribute">
<dt id="tables.StringAtom.itemsize">
<tt class="descname">itemsize</tt><a class="headerlink" href="#tables.StringAtom.itemsize" title="Permalink to this definition">¶</a></dt>
<dd><p>Size in bytes of a sigle item in the atom.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="tables.BoolAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">BoolAtom</tt><big>(</big><em>shape=()</em>, <em>dflt=False</em><big>)</big><a class="headerlink" href="#tables.BoolAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type bool.</p>
</dd></dl>

<dl class="class">
<dt id="tables.IntAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">IntAtom</tt><big>(</big><em>itemsize=4</em>, <em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.IntAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of a signed integral type (int kind).</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int8Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int8Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.Int8Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">int8</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int16Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int16Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.Int16Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">int16</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int32Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int32Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.Int32Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">int32</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int64Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int64Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.Int64Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">int64</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UIntAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UIntAtom</tt><big>(</big><em>itemsize=4</em>, <em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.UIntAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of an unsigned integral type (uint kind).</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt8Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt8Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.UInt8Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">uint8</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt16Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt16Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.UInt16Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">uint16</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt32Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt32Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.UInt32Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">uint32</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt64Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt64Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.UInt64Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">uint64</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.FloatAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">FloatAtom</tt><big>(</big><em>itemsize=8</em>, <em>shape=()</em>, <em>dflt=0.0</em><big>)</big><a class="headerlink" href="#tables.FloatAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of a floating point type (float kind).</p>
</dd></dl>

<dl class="class">
<dt id="tables.Float32Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Float32Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0.0</em><big>)</big><a class="headerlink" href="#tables.Float32Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">float32</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Float64Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Float64Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0.0</em><big>)</big><a class="headerlink" href="#tables.Float64Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">float64</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="tables.ComplexAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">ComplexAtom</tt><big>(</big><em>itemsize</em>, <em>shape=()</em>, <em>dflt=0j</em><big>)</big><a class="headerlink" href="#tables.ComplexAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of kind complex.</p>
<p>Allowed item sizes are 8 (single precision) and 16 (double precision). This
class must be used instead of more concrete ones to avoid confusions with
numarray-like precision specifications used in PyTables 1.X.</p>
<dl class="attribute">
<dt id="tables.ComplexAtom.itemsize">
<tt class="descname">itemsize</tt><a class="headerlink" href="#tables.ComplexAtom.itemsize" title="Permalink to this definition">¶</a></dt>
<dd><p>Size in bytes of a sigle item in the atom.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="tables.Time32Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Time32Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0</em><big>)</big><a class="headerlink" href="#tables.Time32Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type time32.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Time64Atom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Time64Atom</tt><big>(</big><em>shape=()</em>, <em>dflt=0.0</em><big>)</big><a class="headerlink" href="#tables.Time64Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type time64.</p>
</dd></dl>

<dl class="class">
<dt id="tables.EnumAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">EnumAtom</tt><big>(</big><em>enum</em>, <em>dflt</em>, <em>base</em>, <em>shape=()</em><big>)</big><a class="headerlink" href="#tables.EnumAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Description of an atom of an enumerated type.</p>
<p>Instances of this class describe the atom type used to store enumerated
values. Those values belong to an enumerated type, defined by the first
argument (enum) in the constructor of the atom, which accepts the same
kinds of arguments as the Enum class (see <a class="reference internal" href="helper_classes.html#enumclassdescr"><em>The Enum class</em></a>).  The
enumerated type is stored in the enum attribute of the atom.</p>
<p>A default value must be specified as the second argument (dflt) in the
constructor; it must be the <em>name</em> (a string) of one of the enumerated
values in the enumerated type. When the atom is created, the corresponding
concrete value is broadcast and stored in the dflt attribute (setting
different default values for items in a multidimensional atom is not
supported yet). If the name does not match any value in the enumerated
type, a KeyError is raised.</p>
<p>Another atom must be specified as the base argument in order to determine
the base type used for storing the values of enumerated values in memory
and disk. This <em>storage atom</em> is kept in the base attribute of the created
atom. As a shorthand, you may specify a PyTables type instead of the
storage atom, implying that this has a scalar shape.</p>
<p>The storage atom should be able to represent each and every concrete value
in the enumeration. If it is not, a TypeError is raised. The default value
of the storage atom is ignored.</p>
<p>The type attribute of enumerated atoms is always enum.</p>
<p>Enumerated atoms also support comparisons with other objects:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">enum</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;T1&#39;</span><span class="p">,</span> <span class="s">&#39;T2&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">(</span><span class="n">enum</span><span class="p">,</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;int8&#39;</span><span class="p">)</span>  <span class="c"># same as ``atom2``</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom2</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">(</span><span class="n">enum</span><span class="p">,</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="n">Int8Atom</span><span class="p">())</span>  <span class="c"># same as ``atom1``</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom3</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">(</span><span class="n">enum</span><span class="p">,</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;int16&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom4</span> <span class="o">=</span> <span class="n">Int8Atom</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">enum</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">atom2</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom2</span> <span class="o">!=</span> <span class="n">atom1</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">atom3</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom1</span> <span class="o">==</span> <span class="n">atom4</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">atom4</span> <span class="o">!=</span> <span class="n">atom1</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Examples</p>
<p>The next C enum construction:</p>
<div class="highlight-python"><pre>enum myEnum {
            T0,
            T1,
            T2
            };</pre>
</div>
<p>would correspond to the following PyTables
declaration:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">myEnumAtom</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">([</span><span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;T1&#39;</span><span class="p">,</span> <span class="s">&#39;T2&#39;</span><span class="p">],</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;int32&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Please note the dflt argument with a value of &#8216;T0&#8217;. Since the concrete
value matching T0 is unknown right now (we have not used explicit concrete
values), using the name is the only option left for defining a default
value for the atom.</p>
<p>The chosen representation of values for this enumerated atom uses unsigned
32-bit integers, which surely wastes quite a lot of memory. Another size
could be selected by using the base argument (this time with a full-blown
storage atom):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">myEnumAtom</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">([</span><span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;T1&#39;</span><span class="p">,</span> <span class="s">&#39;T2&#39;</span><span class="p">],</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="n">UInt8Atom</span><span class="p">())</span>
</pre></div>
</div>
<p>You can also define multidimensional arrays for data elements:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">myEnumAtom</span> <span class="o">=</span> <span class="n">EnumAtom</span><span class="p">(</span>
<span class="gp">... </span>   <span class="p">[</span><span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="s">&#39;T1&#39;</span><span class="p">,</span> <span class="s">&#39;T2&#39;</span><span class="p">],</span> <span class="s">&#39;T0&#39;</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="s">&#39;uint32&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
</pre></div>
</div>
<p>for 3x2 arrays of uint32.</p>
<dl class="attribute">
<dt id="tables.EnumAtom.itemsize">
<tt class="descname">itemsize</tt><a class="headerlink" href="#tables.EnumAtom.itemsize" title="Permalink to this definition">¶</a></dt>
<dd><p>Size in bytes of a sigle item in the atom.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="pseudo-atoms">
<h3>Pseudo atoms<a class="headerlink" href="#pseudo-atoms" title="Permalink to this headline">¶</a></h3>
<p>Now, there come three special classes, ObjectAtom, VLStringAtom and
VLUnicodeAtom, that actually do not descend from Atom, but which goal is so
similar that they should be described here. Pseudo-atoms can only be used with
VLArray datasets (see <a class="reference internal" href="homogenous_storage.html#vlarrayclassdescr"><em>The VLArray class</em></a>), and they do not support
multidimensional values, nor multiple values per row.</p>
<p>They can be recognised because they also have kind, type and shape attributes,
but no size, itemsize or dflt ones. Instead, they have a base atom which
defines the elements used for storage.</p>
<p>See <tt class="file docutils literal"><span class="pre">examples/vlarray1.py</span></tt> and <tt class="file docutils literal"><span class="pre">examples/vlarray2.py</span></tt> for further
examples on VLArray datasets, including object serialization and string
management.</p>
<div class="section" id="objectatom">
<h4>ObjectAtom<a class="headerlink" href="#objectatom" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="tables.ObjectAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">ObjectAtom</tt><a class="headerlink" href="#tables.ObjectAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type object.</p>
<p>This class is meant to fit <em>any</em> kind of Python object in a row of a
VLArray dataset by using pickle behind the scenes. Due to the fact that
you can not foresee how long will be the output of the pickle
serialization (i.e. the atom already has a <em>variable</em> length), you can only
fit <em>one object per row</em>. However, you can still group several objects in a
single tuple or list and pass it to the <a class="reference internal" href="homogenous_storage.html#tables.VLArray.append" title="tables.VLArray.append"><tt class="xref py py-meth docutils literal"><span class="pre">VLArray.append()</span></tt></a> method.</p>
<p>Object atoms do not accept parameters and they cause the reads of rows to
always return Python objects. You can regard object atoms as an easy way to
save an arbitrary number of generic Python objects in a VLArray dataset.</p>
</dd></dl>

</div>
<div class="section" id="vlstringatom">
<span id="id1"></span><h4>VLStringAtom<a class="headerlink" href="#vlstringatom" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="tables.VLStringAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">VLStringAtom</tt><a class="headerlink" href="#tables.VLStringAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type <tt class="docutils literal"><span class="pre">vlstring</span></tt>.</p>
<p>This class describes a <em>row</em> of the VLArray class, rather than an atom. It
differs from the StringAtom class in that you can only add <em>one instance of
it to one specific row</em>, i.e. the <a class="reference internal" href="homogenous_storage.html#tables.VLArray.append" title="tables.VLArray.append"><tt class="xref py py-meth docutils literal"><span class="pre">VLArray.append()</span></tt></a> method only
accepts one object when the base atom is of this type.</p>
<p>Like StringAtom, this class does not make assumptions on the encoding of
the string, and raw bytes are stored as is.  Unicode strings are supported
as long as no character is out of the ASCII set; otherwise, you will need
to <em>explicitly</em> convert them to strings before you can save them.  For full
Unicode support, using VLUnicodeAtom (see <a class="reference internal" href="#vlunicodeatom"><em>VLUnicodeAtom</em></a>) is
recommended.</p>
<p>Variable-length string atoms do not accept parameters and they cause the
reads of rows to always return Python strings.  You can regard vlstring
atoms as an easy way to save generic variable length strings.</p>
</dd></dl>

</div>
<div class="section" id="vlunicodeatom">
<span id="id2"></span><h4>VLUnicodeAtom<a class="headerlink" href="#vlunicodeatom" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="tables.VLUnicodeAtom">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">VLUnicodeAtom</tt><a class="headerlink" href="#tables.VLUnicodeAtom" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an atom of type vlunicode.</p>
<p>This class describes a <em>row</em> of the VLArray class, rather than an atom.  It
is very similar to VLStringAtom (see <a class="reference internal" href="#vlstringatom"><em>VLStringAtom</em></a>), but it stores
Unicode strings (using 32-bit characters a la UCS-4, so all strings of the
same length also take up the same space).</p>
<p>This class does not make assumptions on the encoding of plain input
strings.  Plain strings are supported as long as no character is out of the
ASCII set; otherwise, you will need to <em>explicitly</em> convert them to Unicode
before you can save them.</p>
<p>Variable-length Unicode atoms do not accept parameters and they cause the
reads of rows to always return Python Unicode strings.  You can regard
vlunicode atoms as an easy way to save variable length Unicode strings.</p>
</dd></dl>

</div>
</div>
</div>
<div class="section" id="the-col-class-and-its-descendants">
<span id="colclassdescr"></span><h2>The Col class and its descendants<a class="headerlink" href="#the-col-class-and-its-descendants" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="tables.Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Col</tt><big>(</big><em>nptype</em>, <em>shape</em>, <em>dflt</em><big>)</big><a class="headerlink" href="#tables.Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column.</p>
<p>Col instances are used as a means to declare the different properties of a
non-nested column in a table or nested column.  Col classes are descendants
of their equivalent Atom classes (see <a class="reference internal" href="#atomclassdescr"><em>The Atom class and its descendants</em></a>), but their
instances have an additional _v_pos attribute that is used to decide the
position of the column inside its parent table or nested column (see the
IsDescription class in <a class="reference internal" href="#isdescriptionclassdescr"><em>The IsDescription class</em></a> for more information
on column positions).</p>
<p>In the same fashion as Atom, you should use a particular Col descendant
class whenever you know the exact type you will need when writing your
code. Otherwise, you may use one of the Col.from_*() factory methods.</p>
<p>Each factory method inherited from the Atom class is available with the
same signature, plus an additional pos parameter (placed in last position)
which defaults to None and that may take an integer value.  This parameter
might be used to specify the position of the column in the table.</p>
<p>Besides, there are the next additional factory methods, available only for
Col objects.</p>
<p>The following parameters are available for most Col-derived constructors.</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>itemsize</strong> : int</p>
<blockquote>
<div><p>For types with a non-fixed size, this sets the size in bytes of
individual items in the column.</p>
</div></blockquote>
<p><strong>shape</strong> : tuple</p>
<blockquote>
<div><p>Sets the shape of the column. An integer shape of N is equivalent to
the tuple (N,).</p>
</div></blockquote>
<p><strong>dflt</strong> :</p>
<blockquote>
<div><p>Sets the default value for the column.</p>
</div></blockquote>
<p><strong>pos</strong> : int</p>
<blockquote class="last">
<div><p>Sets the position of column in table.  If unspecified, the position
will be randomly selected.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<div class="section" id="col-instance-variables">
<h3>Col instance variables<a class="headerlink" href="#col-instance-variables" title="Permalink to this headline">¶</a></h3>
<p>In addition to the variables that they inherit from the Atom class, Col
instances have the following attributes.</p>
<dl class="attribute">
<dt id="tables.Col._v_pos">
<tt class="descclassname">Col.</tt><tt class="descname">_v_pos</tt><a class="headerlink" href="#tables.Col._v_pos" title="Permalink to this definition">¶</a></dt>
<dd><p>The <em>relative</em> position of this column with regard to its column
siblings.</p>
</dd></dl>

</div>
<div class="section" id="col-factory-methods">
<h3>Col factory methods<a class="headerlink" href="#col-factory-methods" title="Permalink to this headline">¶</a></h3>
<dl class="classmethod">
<dt id="tables.Col.from_atom">
<em class="property">classmethod </em><tt class="descclassname">Col.</tt><tt class="descname">from_atom</tt><big>(</big><em>class_</em>, <em>atom</em>, <em>pos=None</em><big>)</big><a class="headerlink" href="#tables.Col.from_atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Col definition from a PyTables atom.</p>
<p>An optional position may be specified as the pos argument.</p>
</dd></dl>

</div>
<div class="section" id="col-sub-classes">
<h3>Col sub-classes<a class="headerlink" href="#col-sub-classes" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="tables.StringCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">StringCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.StringCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.BoolCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">BoolCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.BoolCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.IntCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">IntCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.IntCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int8Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int8Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Int8Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int16Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int16Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Int16Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int32Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int32Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Int32Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Int64Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Int64Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Int64Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UIntCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UIntCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.UIntCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt8Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt8Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.UInt8Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt16Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt16Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.UInt16Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt32Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt32Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.UInt32Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.UInt64Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UInt64Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.UInt64Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Float32Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Float32Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Float32Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Float64Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Float64Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Float64Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.ComplexCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">ComplexCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.ComplexCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.TimeCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">TimeCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.TimeCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Time32Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Time32Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Time32Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.Time64Col">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Time64Col</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.Time64Col" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

<dl class="class">
<dt id="tables.EnumCol">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">EnumCol</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#tables.EnumCol" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines a non-nested column of a particular type.</p>
<p>The constructor accepts the same arguments as the equivalent
<cite>Atom</cite> class, plus an additional <tt class="docutils literal"><span class="pre">pos</span></tt> argument for
position information, which is assigned to the <cite>_v_pos</cite>
attribute.</p>
</dd></dl>

</div>
</div>
<div class="section" id="the-isdescription-class">
<span id="isdescriptionclassdescr"></span><h2>The IsDescription class<a class="headerlink" href="#the-isdescription-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="tables.IsDescription">
<em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">IsDescription</tt><a class="headerlink" href="#tables.IsDescription" title="Permalink to this definition">¶</a></dt>
<dd><p>Description of the structure of a table or nested column.</p>
<p>This class is designed to be used as an easy, yet meaningful way to
describe the structure of new Table (see <a class="reference internal" href="structured_storage.html#tableclassdescr"><em>The Table class</em></a>) datasets
or nested columns through the definition of <em>derived classes</em>. In order to
define such a class, you must declare it as descendant of IsDescription,
with as many attributes as columns you want in your table. The name of each
attribute will become the name of a column, and its value will hold a
description of it.</p>
<p>Ordinary columns can be described using instances of the Col class (see
<a class="reference internal" href="#colclassdescr"><em>The Col class and its descendants</em></a>). Nested columns can be described by using classes
derived from IsDescription, instances of it, or name-description
dictionaries. Derived classes can be declared in place (in which case the
column takes the name of the class) or referenced by name.</p>
<p>Nested columns can have a _v_pos special attribute which sets the
<em>relative</em> position of the column among sibling columns <em>also having
explicit positions</em>.  The pos constructor argument of Col instances is used
for the same purpose.  Columns with no explicit position will be placed
afterwards in alphanumeric order.</p>
<p>Once you have created a description object, you can pass it to the Table
constructor, where all the information it contains will be used to define
the table structure.</p>
<p class="rubric">IsDescription attributes</p>
<dl class="attribute">
<dt id="tables.IsDescription._v_pos">
<tt class="descname">_v_pos</tt><a class="headerlink" href="#tables.IsDescription._v_pos" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the position of a possible nested column description among its
sibling columns.  This attribute can be specified <em>when declaring</em>
an IsDescription subclass to complement its <em>metadata</em>.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.IsDescription.columns">
<tt class="descname">columns</tt><a class="headerlink" href="#tables.IsDescription.columns" title="Permalink to this definition">¶</a></dt>
<dd><p>Maps the name of each column in the description to its own descriptive
object. This attribute is <em>automatically created</em> when an IsDescription
subclass is declared.  Please note that declared columns can no longer
be accessed as normal class variables after its creation.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="description-helper-functions">
<h2>Description helper functions<a class="headerlink" href="#description-helper-functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tables.description.descr_from_dtype">
<tt class="descclassname">tables.description.</tt><tt class="descname">descr_from_dtype</tt><big>(</big><em>dtype_</em><big>)</big><a class="reference internal" href="../../_modules/tables/description.html#descr_from_dtype"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.description.descr_from_dtype" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a description instance and byteorder from a (nested) NumPy dtype.</p>
</dd></dl>

<dl class="function">
<dt id="tables.description.dtype_from_descr">
<tt class="descclassname">tables.description.</tt><tt class="descname">dtype_from_descr</tt><big>(</big><em>descr</em>, <em>byteorder=None</em><big>)</big><a class="reference internal" href="../../_modules/tables/description.html#dtype_from_descr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.description.dtype_from_descr" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a (nested) NumPy dtype from a description instance and byteorder.</p>
<p>The descr parameter can be a Description or IsDescription
instance, sub-class of IsDescription or a dictionary.</p>
</dd></dl>

</div>
<div class="section" id="the-attributeset-class">
<span id="attributesetclassdescr"></span><h2>The AttributeSet class<a class="headerlink" href="#the-attributeset-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="tables.attributeset.AttributeSet">
<em class="property">class </em><tt class="descclassname">tables.attributeset.</tt><tt class="descname">AttributeSet</tt><big>(</big><em>node</em><big>)</big><a class="reference internal" href="../../_modules/tables/attributeset.html#AttributeSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.attributeset.AttributeSet" title="Permalink to this definition">¶</a></dt>
<dd><p>Container for the HDF5 attributes of a Node</p>
<p>This class provides methods to create new HDF5 node attributes,
and to get, rename or delete existing ones.</p>
<p>Like in Group instances (see <a class="reference internal" href="hierarchy_classes.html#groupclassdescr"><em>The Group class</em></a>), AttributeSet
instances make use of the <em>natural naming</em> convention, i.e. you can
access the attributes on disk as if they were normal Python
attributes of the AttributeSet instance.</p>
<p>This offers the user a very convenient way to access HDF5 node
attributes. However, for this reason and in order not to pollute the
object namespace, one can not assign <em>normal</em> attributes to
AttributeSet instances, and their members use names which start by
special prefixes as happens with Group objects.</p>
<p class="rubric">Notes on native and pickled attributes</p>
<p>The values of most basic types are saved as HDF5 native data in the
HDF5 file.  This includes Python bool, int, float, complex and str
(but not long nor unicode) values, as well as their NumPy scalar
versions and homogeneous or <em>structured</em> NumPy arrays of them.  When
read, these values are always loaded as NumPy scalar or array
objects, as needed.</p>
<p>For that reason, attributes in native HDF5 files will be always
mapped into NumPy objects.  Specifically, a multidimensional
attribute will be mapped into a multidimensional ndarray and a
scalar will be mapped into a NumPy scalar object (for example, a
scalar H5T_NATIVE_LLONG will be read and returned as a numpy.int64
scalar).</p>
<p>However, other kinds of values are serialized using pickle, so you
only will be able to correctly retrieve them using a Python-aware
HDF5 library.  Thus, if you want to save Python scalar values and
make sure you are able to read them with generic HDF5 tools, you
should make use of <em>scalar or homogeneous/structured array NumPy
objects</em> (for example, numpy.int64(1) or numpy.array([1, 2, 3],
dtype=&#8217;int16&#8217;)).</p>
<p>One more advice: because of the various potential difficulties in
restoring a Python object stored in an attribute, you may end up
getting a pickle string where a Python object is expected. If this
is the case, you may wish to run pickle.loads() on that string to
get an idea of where things went wrong, as shown in this example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">tempfile</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">tables</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyClass</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="gp">... </span>  <span class="n">foo</span> <span class="o">=</span> <span class="s">&#39;bar&#39;</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">myObject</span> <span class="o">=</span> <span class="n">MyClass</span><span class="p">()</span>  <span class="c"># save object of custom class in HDF5 attr</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h5fname</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mktemp</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&#39;.h5&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h5f</span> <span class="o">=</span> <span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="n">h5fname</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h5f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">_v_attrs</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">myObject</span>  <span class="c"># store the object</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">h5f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">_v_attrs</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">foo</span>  <span class="c"># retrieve it</span>
<span class="go">bar</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h5f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">del</span> <span class="n">MyClass</span><span class="p">,</span> <span class="n">myObject</span>  <span class="c"># delete class of object and reopen file</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h5f</span> <span class="o">=</span> <span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="n">h5fname</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="nb">repr</span><span class="p">(</span><span class="n">h5f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">_v_attrs</span><span class="o">.</span><span class="n">obj</span><span class="p">)</span>
<span class="go">&#39;ccopy_reg\n_reconstructor...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">pickle</span>  <span class="c"># let&#39;s unpickle that to see what went wrong</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pickle</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">h5f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">_v_attrs</span><span class="o">.</span><span class="n">obj</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">AttributeError</span>: <span class="n">&#39;module&#39; object has no attribute &#39;MyClass&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># So the problem was not in the stored object,</span>
<span class="gp">... </span><span class="c"># but in the *environment* where it was restored.</span>
<span class="gp">... </span><span class="n">h5f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">h5fname</span><span class="p">)</span>
</pre></div>
</div>
<p class="rubric">Notes on AttributeSet methods</p>
<p>Note that this class overrides the __getattr__(), __setattr__() and
__delattr__() special methods.  This allows you to read, assign or
delete attributes on disk by just using the next constructs:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">leaf</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">myattr</span> <span class="o">=</span> <span class="s">&#39;str attr&#39;</span>    <span class="c"># set a string (native support)</span>
<span class="n">leaf</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">myattr2</span> <span class="o">=</span> <span class="mi">3</span>            <span class="c"># set an integer (native support)</span>
<span class="n">leaf</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">myattr3</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)]</span>  <span class="c"># a generic object (Pickled)</span>
<span class="n">attrib</span> <span class="o">=</span> <span class="n">leaf</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">myattr</span>        <span class="c"># get the attribute ``myattr``</span>
<span class="k">del</span> <span class="n">leaf</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">myattr</span>             <span class="c"># delete the attribute ``myattr``</span>
</pre></div>
</div>
<p>In addition, the dictionary-like __getitem__(), __setitem__() and
__delitem__() methods are available, so you may write things like
this:</p>
<div class="highlight-python"><pre>for name in :attr:`Node._v_attrs`._f_list():
    print "name: %s, value: %s" % (name, :attr:`Node._v_attrs`[name])</pre>
</div>
<p>Use whatever idiom you prefer to access the attributes.</p>
<p>If an attribute is set on a target node that already has a large
number of attributes, a PerformanceWarning will be issued.</p>
<p class="rubric">AttributeSet attributes</p>
<dl class="attribute">
<dt id="tables.AttributeSet._v_attrnames">
<tt class="descname">_v_attrnames</tt><a class="headerlink" href="#tables.AttributeSet._v_attrnames" title="Permalink to this definition">¶</a></dt>
<dd><p>A list with all attribute names.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.AttributeSet._v_attrnamessys">
<tt class="descname">_v_attrnamessys</tt><a class="headerlink" href="#tables.AttributeSet._v_attrnamessys" title="Permalink to this definition">¶</a></dt>
<dd><p>A list with system attribute names.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.AttributeSet._v_attrnamesuser">
<tt class="descname">_v_attrnamesuser</tt><a class="headerlink" href="#tables.AttributeSet._v_attrnamesuser" title="Permalink to this definition">¶</a></dt>
<dd><p>A list with user attribute names.</p>
</dd></dl>

<dl class="attribute">
<dt id="tables.AttributeSet._v_unimplemented">
<tt class="descname">_v_unimplemented</tt><a class="headerlink" href="#tables.AttributeSet._v_unimplemented" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of attribute names with unimplemented native HDF5 types.</p>
</dd></dl>

</dd></dl>

<div class="section" id="attributeset-properties">
<h3>AttributeSet properties<a class="headerlink" href="#attributeset-properties" title="Permalink to this headline">¶</a></h3>
<dl class="attribute">
<dt id="tables.attributeset.AttributeSet._v_node">
<tt class="descclassname">AttributeSet.</tt><tt class="descname">_v_node</tt><a class="headerlink" href="#tables.attributeset.AttributeSet._v_node" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="hierarchy_classes.html#tables.Node" title="tables.Node"><tt class="xref py py-class docutils literal"><span class="pre">Node</span></tt></a> instance this attribute set is associated with.</p>
</dd></dl>

</div>
<div class="section" id="attributeset-methods">
<h3>AttributeSet methods<a class="headerlink" href="#attributeset-methods" title="Permalink to this headline">¶</a></h3>
<dl class="method">
<dt id="tables.attributeset.AttributeSet._f_copy">
<tt class="descclassname">AttributeSet.</tt><tt class="descname">_f_copy</tt><big>(</big><em>where</em><big>)</big><a class="reference internal" href="../../_modules/tables/attributeset.html#AttributeSet._f_copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.attributeset.AttributeSet._f_copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy attributes to the where node.</p>
<p>Copies all user and certain system attributes to the given where
node (a Node instance - see <a class="reference internal" href="hierarchy_classes.html#nodeclassdescr"><em>The Node class</em></a>), replacing
the existing ones.</p>
</dd></dl>

<dl class="method">
<dt id="tables.attributeset.AttributeSet._f_list">
<tt class="descclassname">AttributeSet.</tt><tt class="descname">_f_list</tt><big>(</big><em>attrset='user'</em><big>)</big><a class="reference internal" href="../../_modules/tables/attributeset.html#AttributeSet._f_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.attributeset.AttributeSet._f_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of attribute names.</p>
<p>The attrset string selects the attribute set to be used.  A
&#8216;user&#8217; value returns only user attributes (this is the default).
A &#8216;sys&#8217; value returns only system attributes.  Finally, &#8216;all&#8217;
returns both system and user attributes.</p>
</dd></dl>

<dl class="method">
<dt id="tables.attributeset.AttributeSet._f_rename">
<tt class="descclassname">AttributeSet.</tt><tt class="descname">_f_rename</tt><big>(</big><em>oldattrname</em>, <em>newattrname</em><big>)</big><a class="reference internal" href="../../_modules/tables/attributeset.html#AttributeSet._f_rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.attributeset.AttributeSet._f_rename" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename an attribute from oldattrname to newattrname.</p>
</dd></dl>

<dl class="method">
<dt id="tables.attributeset.AttributeSet.__contains__">
<tt class="descclassname">AttributeSet.</tt><tt class="descname">__contains__</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="../../_modules/tables/attributeset.html#AttributeSet.__contains__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.attributeset.AttributeSet.__contains__" title="Permalink to this definition">¶</a></dt>
<dd><p>Is there an attribute with that name?</p>
<p>A true value is returned if the attribute set has an attribute
with the given name, false otherwise.</p>
</dd></dl>

</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
        <p class="logo"><a href="../../index.html">
          <img class="logo" src="../../_static/logo-pytables-small.png" alt="Logo"/>
        </a></p>
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Declarative classes</a><ul>
<li><a class="reference internal" href="#the-atom-class-and-its-descendants">The Atom class and its descendants</a><ul>
<li><a class="reference internal" href="#atom-properties">Atom properties</a></li>
<li><a class="reference internal" href="#atom-methods">Atom methods</a></li>
<li><a class="reference internal" href="#atom-factory-methods">Atom factory methods</a></li>
<li><a class="reference internal" href="#atom-sub-classes">Atom Sub-classes</a></li>
<li><a class="reference internal" href="#pseudo-atoms">Pseudo atoms</a><ul>
<li><a class="reference internal" href="#objectatom">ObjectAtom</a></li>
<li><a class="reference internal" href="#vlstringatom">VLStringAtom</a></li>
<li><a class="reference internal" href="#vlunicodeatom">VLUnicodeAtom</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#the-col-class-and-its-descendants">The Col class and its descendants</a><ul>
<li><a class="reference internal" href="#col-instance-variables">Col instance variables</a></li>
<li><a class="reference internal" href="#col-factory-methods">Col factory methods</a></li>
<li><a class="reference internal" href="#col-sub-classes">Col sub-classes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#the-isdescription-class">The IsDescription class</a></li>
<li><a class="reference internal" href="#description-helper-functions">Description helper functions</a></li>
<li><a class="reference internal" href="#the-attributeset-class">The AttributeSet class</a><ul>
<li><a class="reference internal" href="#attributeset-properties">AttributeSet properties</a></li>
<li><a class="reference internal" href="#attributeset-methods">AttributeSet methods</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="link_classes.html"
                        title="previous chapter">Link classes</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="helper_classes.html"
                        title="next chapter">Helper classes</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/usersguide/libref/declarative_classes.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="clearer"></div>
    </div>
    <div class="relbar-bottom">
        
    <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> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="../../np-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="helper_classes.html" title="Helper classes"
             >next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="link_classes.html" title="Link classes"
             >previous</a> &nbsp; &nbsp;</li>
    <li><a href="../../index.html">PyTables 3.0.0 documentation</a> &raquo;</li>

          <li><a href="../index.html" >PyTables User&#8217;s Guide</a> &raquo;</li>
          <li><a href="../libref.html" >Library Reference</a> &raquo;</li> 
      </ul>
    </div>
    </div>

    <div class="footer">
        &copy; Copyright 2011-2013, PyTables maintainers.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
    <!-- cloud_sptheme 1.3 -->
  </body>
</html>