tkelleyireland / ipmap Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bonsaiviking/ipmap
Map IPv4 addresses to Hilbert curves for data visualization
This project forked from bonsaiviking/ipmap
Map IPv4 addresses to Hilbert curves for data visualization
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.