GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • index
  • modules
  • next
  • previous
  • PyTAPS v1.4 documentation
  • PyTAPS Helpers
  • Show Source

This view

  • Original page
  • New address

GeezerVison is showing pythonhosted.org — PyTAPS Helpers — PyTAPS v1.4 documentation

Navigation

  • index
  • modules |
  • next |
  • previous |
  • PyTAPS v1.4 documentation »

PyTAPS Helpers¶

OffsetList¶

An OffsetList() is a multi-dimensional jagged array. The data array is stored as a one-dimensional array which is then indexed into with an array of offsets.

For example:

>>> point = namedtuple('point', 'x y z')
>>> o = OffsetList([0,2,4], point([1,2,3,4], [5,6,7,8], [9,0,1,2]))
>>> o
<itaps.helpers.OffsetListTuple object at 0x7f3d9922b110>
>>> o[0]
point(x=[1, 2], y=[5, 6], z=[9, 0])
>>> o[0,1]
point(x=2, y=6, z=0)
>>> o.x
<itaps.helpers.OffsetListSingle object at 0x7f3d9922b7d0>
itaps.helpers.OffsetList(offsets, data)¶

If data is a tuple, return a new OffsetListTuple instance with the specified offsets and data. Otherwise, return a new OffsetListSingle instance.

class itaps.helpers.OffsetListSingle(offsets, data)¶

Return a new OffsetListSingle with the specified offsets and data.

len(o)

Return the number of sub-arrays in the object o. Equivalent to o.length().

Return :The number of sub-arrays
o[i]

Return the ith sub-array of o. Equivalent to o.data[ o.offsets[i]:o.offsets[i+1] ].

Param i:Outer dimension of the list
Return :The ith sub-array
o[i, j]

Return the element in the jth position of the ith sub-array of o. Equivalent to o.data[ o.offsets[i]+j ].

Param i:Outer dimension of the list
Param j:Index into the ith array’s sub-array
Return :The jth element of the ith sub-array
offsets¶

Return the raw offset array.

data¶

Return the raw data array.

length([i])¶

Return the number of sub-arrays that are stored in this object. If i is specified, return the number of elements for the ith sub-array.

Parameters:
  • i – Index of the sub-array to query
Returns:

If i is None, the number of sub-arrays stored in this object. Otherwise, the number of elements for the ith sub-array.

class itaps.helpers.OffsetListTuple(offsets, data)¶

Return a new OffsetListTuple with the specified offsets and data. This is a subclass of OffsetListSingle. In addition to the methods defined in OffsetListSingle, OffsetListTuple provides the following methods.

o.x

Return a new OffsetListSingle with the same offsets as o and data equal to o.data.x. Equivalent to o.slice('x'). Requires Python 2.6+.

Return :A new OffsetListSingle
fields¶

Return the fields of the namedtuple used by this instance. Requires Python 2.6+.

slice(field)¶

Return a new OffsetListSingle derived from this instance. If field is an integer, set the OffsetListSingle‘s data to data[field]. Otherwise, set the data to getattr(data, field). Using non-integer values requires Python 2.6+.

Returns:A new OffsetListSingle
o[i]
o[i, j]

These methods work as in an OffsetListSingle, but return a tuple (or namedtuple in Python 2.6+) of the requested data.

IndexedList¶

An IndexedList is a multi-dimensional jagged array. The data array is stored as a one-dimensional array which is then indexed into with an array of offsets and an array of indices.

For example:

>>> import numpy
>>> o = IndexedList(numpy.array([0, 3, 6]),
...                 numpy.array([0, 1, 2,
...                              1, 2, 3,
...                              2, 3, 4]),
...                 numpy.array([10, 11, 12, 13, 14]))
>>> o[0]
array([10, 11, 12])
>>> o[0, 1]
11
>>> o.indices[0]
array([0, 1, 2])
class itaps.helpers.IndexedList(offsets, indices, data)¶

Return a new IndexedList with the specified offsets, indices, and data.

len(o)

Return the number of entities in the object o. Equivalent to o.length().

o[i]

Return the ith sub-array of o. Equivalent to o.data[ o.indices[i] ].

Param i:Outer dimension of the list
Return :The ith sub-array

Note

This method relies on the special indexing features of NumPy, namely indexing an array with another array.

o[i, j]

Return the element in the jth position of the ith sub-array of o. Equivalent to o.data[ o.indices[i, j] ].

Param i:Outer dimension of the list
Param j:Index into the ith array’s sub-array
Return :The jth element of the ith sub-array
indices¶

Return the offsets and indices as an OffsetListSingle instance.

data¶

Return the raw data array.

length([i])¶

Return the number of entities whose adjacencies are stored in this object. If i is specified, return the number of adjacencies for the ith entity.

Parameters:
  • i – Index of the entity to query
Returns:

If i is None, the number of entities whose adjacencies are stored. Otherwise, the number of adjacencies for the ith entity.

Table Of Contents

  • PyTAPS Helpers
    • OffsetList
    • IndexedList

Previous topic

iRel Interface

Next topic

C API

This Page

  • Show Source

Quick search

Enter search terms or a module, class or function name.

Navigation

  • index
  • modules |
  • next |
  • previous |
  • PyTAPS v1.4 documentation »
© Copyright 2009-2011, James Porter. Created using Sphinx 1.0.4.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.