Module KhipuDB :: Class Cord
[hide private]
[frames] | no frames]

Class Cord

source code

DatabaseObject --+
                 |
                Cord

Instance Methods [hide private]
 
termination_descr(self) source code
 
fiber_descr(self) source code
 
khipu(self) source code
 
investigator_num(self) source code
 
cord_cluster(self) source code
 
cord_clusters(self) source code
 
cords(self) source code
 
sorted_cords(self) source code
 
knot_clusters(self) source code
 
knots(self) source code
 
position(self) source code
 
short_string(self) source code
 
numerical(self)
Test whether the cord encodes a numerical value (approximate).
source code
 
numerify(self)
Convert the cord into a numerical value encodeed (approximate).
source code
 
url(self) source code
 
nice_str(self) source code

Inherited from DatabaseObject: __getstate__, __init__, __repr__, __setstate__, __str__

Class Methods [hide private]

Inherited from DatabaseObject: make, select, with_id

Class Variables [hide private]
  table = 'cord'
  fields = ['khipu_id', 'cord_id', 'twist_angle', 'thickness', '...
  id_field = 'cord_id'
Method Details [hide private]

numerical(self)

source code 

Test whether the cord encodes a numerical value (approximate).

This function is inexact: it returns true for knot sequences that could be numbers, even if the knot spacing indicates otherwise. On the other hand, it has been conjectured that multiple numbers might be encoded on a single string, using the long knots as a separator; these sequences will be marked non-numerical by this function.

numerify(self)

source code 

Convert the cord into a numerical value encodeed (approximate).

This function is not guaranteed to return the exact number encoded. We ignore "zeros" in the input string (which are encoded by gaps between knots in a fuzzy way, and therefore hard to make algorithmic), except for the last zero which we can detect because the ones digit is specially marked. Thus the numbers 10, 100, and 1000 all return 10 from numerify, although at least we can distinguish this equivalence group from 1 (because the ones digit is specially marked). Similarly, the numbers 164, 1064, and 1604 all return 164 from numerify, although 1640 (and 16400) will return 1640.

Returns None if the string is not considered numerical according to numerical.


Class Variable Details [hide private]

fields

Value:
['khipu_id',
 'cord_id',
 'twist_angle',
 'thickness',
 'fiber',
 'termination',
 'twist',
 'pendant_from',
...