Skip to main content

pretty print data structures

Project description

StructOut

prints networkx graphs and large int lists pleasantly to terminal.

import structout as so
so.lprint(range(1000),length=70)

import networkx as nx
g=nx.path_graph(5)
so.gprint(g)

'' ''

install

pip install structout

numberlists


# implemented options: -> i should update this at some point :)
def doALine(values,
        length=-1,minmax=False, chunk_operation=max,
        method = 'log', methodhow =2)

# there is also a convenience function 'bins' that
# does evenly spaced out bins :)

Graphs

Colors

# this will color nodes 1,2,3 in one color and 4,0 in another
gprint(graph, color=([1,2,3],[4,0]))
  • edge labels are always blue
  • digraphs should mark the direction with a blue dot

cut graph down to a subgraph

# print nodes with max distance 1 to the nodes 1 and 2
gprint(graph, zoomlevel=1, zoomnodes=[1,2])

other options

nodelabel='label',  # node and edge labels
edgelabel='label',
size=10,            # size
pos=None,           # pass a coordinate dictionary ; {nodeid : x,y}
n_graphs_per_line= 5 # when passing multiple graphs, wrap here

RNAprint

                        G.-.G.-.G
                          -.    -
                            G.=.G
                            -   -
                            G.=.G
                            -   -
                            G   G
                            -   -
                            G   U.....             .U
                            -         -.....     .- -
A.-.A.-.A.-.A.-.A.-.A.-.A.-.A               U.-.U   U
                =   =   =   =               =   =   -
        A.-.A.-.A.-.A.-.A.-.A      .U.-.U.-.U.-.U.-.U
                            -    .-
                            A.=.A
                            -   -
                            A.=.A.
                              -.  -.
                                A.-.A

heatmap

heatmap(matrix,dim = (20,20),operator= np.max, wide = True)

wide makes each symbol take up 2 characters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

structout-0.1.56.tar.gz (14.8 kB view details)

Uploaded Source

File details

Details for the file structout-0.1.56.tar.gz.

File metadata

  • Download URL: structout-0.1.56.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for structout-0.1.56.tar.gz
Algorithm Hash digest
SHA256 b2f6b10b5dd17e7a049c23b99d77ef68ec533f68ab05818cb49df7e71d051271
MD5 c646a023159e74065d83d91f633e72cc
BLAKE2b-256 6736664e240781c821fcd442ba5b379eadc459c5d058bdf2967647804c89d7cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page