-
Notifications
You must be signed in to change notification settings - Fork 3
bonsaiviking/IPMap
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Help on module hilbert: NAME hilbert CLASSES __builtin__.object HilbertCurve HilbertContainer class HilbertContainer(HilbertCurve) | A container that can be indexed along either the 1- or 2-dimensional aspects | of a Hilbert curve. | | Indexing by the 1-dimensional distance is done just like indexing into a list: curve[d] | | Indexing by 2-dimensional coordinates works the same way: curve[x,y] | | For example: | | >>> curve = HilbertContainer(8) | >>> curve[3] = "example" | >>> curve.d2xy(3) | (1, 0) | >>> curve[1,0] | 'example' | | Method resolution order: | HilbertContainer | HilbertCurve | __builtin__.object | | Methods defined here: | | __getitem__(self, d) | | __init__(self, side_length, empty=None) | | __iter__(self) | Generator for iterating over the curve. Yields a 2-tuple of (x, y) | and the value at that point, in Hilbert-curve order (a la turtle). | | __setitem__(self, d, value) | | ---------------------------------------------------------------------- | Methods inherited from HilbertCurve: | | d2xy(self, d) | Find the coordinates (x, y) of a point some distance *d* along the curve. | | xy2d(self, x, y) | Find the distance of the point (x, y) along the curve. | | ---------------------------------------------------------------------- | Data descriptors inherited from HilbertCurve: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | side_length class HilbertCurve(__builtin__.object) | Object-oriented interface to 2-dimensional Hilbert curves. | | A HilbertCurve object has one attribute, *side_length*, which is the square of | the order of the curve. A third-order Hilbert curve has a side length of 2**3, or 8. | The side length will be coerced into the next highest positive power of 2. | | Methods defined here: | | __init__(self, side_length) | | d2xy(self, d) | Find the coordinates (x, y) of a point some distance *d* along the curve. | | xy2d(self, x, y) | Find the distance of the point (x, y) along the curve. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | side_length FUNCTIONS d2xy(side_length, d) Find the coordinates (x, y) of a point some distance *d* along a Hilbert curve which fills a square *side_length* units on a side. xy2d(side_length, x, y) Find the distance of the point (x, y) along a Hilbert curve which fills a square *side_length* units on a side. Help on module ipmap: NAME ipmap CLASSES hilbert.HilbertContainer(hilbert.HilbertCurve) IPMap IPMapHtmlTable IPMapImage class IPMap(hilbert.HilbertContainer) | Base class for IPMap objects. Puts IP/value pairs into buckets and generates | a Hilbert curve mapping of buckets to x/y coordinates. | | Method resolution order: | IPMap | hilbert.HilbertContainer | hilbert.HilbertCurve | __builtin__.object | | Methods defined here: | | __init__(self, cidr, side_length=16) | Required argument *cidr* is the network mask in CIDR notation, e.g. 192.168.1.0/24. | | add(self, ip, value) | Update the IPMap with a new IP and value | | bucket(self, ip) | Get the bucket (0..resolution] that the IP belongs in | | build(self) | Build and return the whole map. Assumes there are no more values to | add, though the base class version is not destructive. Override this to | generate different kinds of maps. | | update_value(self, bucket, new) | Given a bucket, update its contents with the new value. Override this | method to use a different algorithm than addition (the default) | | xy2ip(self, x, y) | Given a set of x/y coordinates, return the lower bound of the IP | addresses in the corresponding bucket | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertContainer: | | __getitem__(self, d) | | __iter__(self) | Generator for iterating over the curve. Yields a 2-tuple of (x, y) | and the value at that point, in Hilbert-curve order (a la turtle). | | __setitem__(self, d, value) | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertCurve: | | d2xy(self, d) | Find the coordinates (x, y) of a point some distance *d* along the curve. | | xy2d(self, x, y) | Find the distance of the point (x, y) along the curve. | | ---------------------------------------------------------------------- | Data descriptors inherited from hilbert.HilbertCurve: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | side_length class IPMapHtmlTable(IPMap) | IPMap as an HTML table | | Method resolution order: | IPMapHtmlTable | IPMap | hilbert.HilbertContainer | hilbert.HilbertCurve | __builtin__.object | | Methods defined here: | | build(self, numclasses=10) | Returns the map as HTML *<tr>* and *<td>* elements, suitable for | including in the *<tbody>* element of a table. Text content is the base | IP for each bucket, and the class is the return value of | self.get_class(self[bucket]). | | get_class(self, num) | Override to enum classes | | ---------------------------------------------------------------------- | Methods inherited from IPMap: | | __init__(self, cidr, side_length=16) | Required argument *cidr* is the network mask in CIDR notation, e.g. 192.168.1.0/24. | | add(self, ip, value) | Update the IPMap with a new IP and value | | bucket(self, ip) | Get the bucket (0..resolution] that the IP belongs in | | update_value(self, bucket, new) | Given a bucket, update its contents with the new value. Override this | method to use a different algorithm than addition (the default) | | xy2ip(self, x, y) | Given a set of x/y coordinates, return the lower bound of the IP | addresses in the corresponding bucket | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertContainer: | | __getitem__(self, d) | | __iter__(self) | Generator for iterating over the curve. Yields a 2-tuple of (x, y) | and the value at that point, in Hilbert-curve order (a la turtle). | | __setitem__(self, d, value) | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertCurve: | | d2xy(self, d) | Find the coordinates (x, y) of a point some distance *d* along the curve. | | xy2d(self, x, y) | Find the distance of the point (x, y) along the curve. | | ---------------------------------------------------------------------- | Data descriptors inherited from hilbert.HilbertCurve: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | side_length class IPMapImage(IPMap) | IPMap as a heatmap image | | Method resolution order: | IPMapImage | IPMap | hilbert.HilbertContainer | hilbert.HilbertCurve | __builtin__.object | | Methods defined here: | | build(self, image_size=256, out='IPMap.png', fmt='PNG') | Saves a square (*image_size* x *image_size*) image with values | scaled to a 256-color heatmap. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | palette = [53, 52, 61, 51, 51, 61, 49, 50, 62, 48, 48, 63, 46, 46, 64,... | | ---------------------------------------------------------------------- | Methods inherited from IPMap: | | __init__(self, cidr, side_length=16) | Required argument *cidr* is the network mask in CIDR notation, e.g. 192.168.1.0/24. | | add(self, ip, value) | Update the IPMap with a new IP and value | | bucket(self, ip) | Get the bucket (0..resolution] that the IP belongs in | | update_value(self, bucket, new) | Given a bucket, update its contents with the new value. Override this | method to use a different algorithm than addition (the default) | | xy2ip(self, x, y) | Given a set of x/y coordinates, return the lower bound of the IP | addresses in the corresponding bucket | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertContainer: | | __getitem__(self, d) | | __iter__(self) | Generator for iterating over the curve. Yields a 2-tuple of (x, y) | and the value at that point, in Hilbert-curve order (a la turtle). | | __setitem__(self, d, value) | | ---------------------------------------------------------------------- | Methods inherited from hilbert.HilbertCurve: | | d2xy(self, d) | Find the coordinates (x, y) of a point some distance *d* along the curve. | | xy2d(self, x, y) | Find the distance of the point (x, y) along the curve. | | ---------------------------------------------------------------------- | Data descriptors inherited from hilbert.HilbertCurve: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | side_length FUNCTIONS ip_inttostr(ip) Convert an integer to an IPv4 address in dotted-decimal. ip_strtoint(ipstr) Convert an IPv4 address in dotted-decimal to an integer.
About
Map IPv4 addresses to Hilbert curves for data visualization
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published