Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

numpyboxedprint

An APL-inspired boxed prettyprint for numpy arrays

Installation

Download numpyboxedprint.py to your project source folder, then import it with

from numpyboxedprint import parr

Examples

Note that the dotted boxes may suffer from alignment issues if you are not using a terminal, in which case you should set output to be solid boxes only.

>>> parr(np.random.permutation(np.arange(-18, 18)).reshape(6, 3, 2))
┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐
┊┌───────┐┌───────┐┌───────┐┌───────┐┌───────┐┌───────┐┊
┊│-15  11││  0 -13││ -7 -17││ -6  12││  8  -2││ -4   1│┊
┊│ 15   2││ 14 -14││  4   3││-12 -16││ -1  17││ 13   7│┊
┊│ -9 -11││  5 -10││ 10  16││ -8 -18││  6  -3││  9  -5│┊
┊└───────┘└───────┘└───────┘└───────┘└───────┘└───────┘┊
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
>>> parr((np.random.rand(6, 3, 2)*21)-10)
┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐
┊┌───────────────┐┌───────────────┐┌───────────────┐┌───────────────┐┌───────────────┐┌───────────────┐┊
┊│ 9.1872  0.5022││-8.5393  5.7577││ 2.9377 -7.9471││ 3.4537  3.3882││ 7.7299 -3.6401││-2.1377 -7.3257│┊
┊│ 6.9504 -7.6301││-9.925   9.0617││-4.4495  6.9339││ 9.3859  5.3156││10.0023  1.1883││-6.314   2.4631│┊
┊│ 6.5639  7.6544││ 8.5532  5.5676││-2.4747  6.1217││ 6.3109  7.9315││-3.589   6.1495││-2.7177  4.1937│┊
┊└───────────────┘└───────────────┘└───────────────┘└───────────────┘└───────────────┘└───────────────┘┊
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
>>> parr((np.random.rand(3, 2, 3, 2, 1)*21)-10 + (np.random.rand(3, 2, 3, 2, 1)*21j)-10j)
┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐
┊┌────────────────────────────────────────────────────────┐┌────────────────────────────────────────────────────────┐┌────────────────────────────────────────────────────────┐┊
┊│┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐││┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐││┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐│┊
┊│┊┌────────────────┐┌────────────────┐┌────────────────┐┊││┊┌────────────────┐┌────────────────┐┌────────────────┐┊││┊┌────────────────┐┌────────────────┐┌────────────────┐┊│┊
┊│┊│ 1.0628 +9.8272j││ 6.2379 -5.1346j││ 5.3605 +4.3293j│┊││┊│10.2517 -8.8623j││-3.8071 -1.7466j││-2.3326 -7.1975j│┊││┊│ 1.7592 +6.1928j││ 1.4454 +3.1297j││ 2.2895 +4.1761j│┊│┊
┊│┊│ 6.4843 +8.2233j││-4.6883 -9.5888j││-2.8867 -1.2003j│┊││┊│ 9.4335 -2.557 j││ 5.9226 +5.4275j││ 9.5668 -2.7396j│┊││┊│-7.4857 -1.9728j││-5.5989+10.5038j││10.2296 +3.0695j│┊│┊
┊│┊└────────────────┘└────────────────┘└────────────────┘┊││┊└────────────────┘└────────────────┘└────────────────┘┊││┊└────────────────┘└────────────────┘└────────────────┘┊│┊
┊│└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘││└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘││└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘│┊
┊│┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐││┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐││┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐│┊
┊│┊┌────────────────┐┌────────────────┐┌────────────────┐┊││┊┌────────────────┐┌────────────────┐┌────────────────┐┊││┊┌────────────────┐┌────────────────┐┌────────────────┐┊│┊
┊│┊│ 3.5948 -5.8334j││ 6.2515 +8.1508j││ 3.1417 -8.1174j│┊││┊│ 4.9879 -5.4155j││-6.4725 -7.1965j││ 9.2553 +8.1822j│┊││┊│-6.7185 +2.085 j││ 7.4099 -7.3605j││ 4.5974 -5.0246j│┊│┊
┊│┊│10.8701 -0.5638j││ 2.4952 -9.6446j││ 1.7234 +8.939 j│┊││┊│-2.0065 +6.441 j││-9.0575+10.629 j││-9.9068 -2.4472j│┊││┊│10.7946 -7.444 j││ 4.0514 +5.8402j││ 6.8921+10.745 j│┊│┊
┊│┊└────────────────┘└────────────────┘└────────────────┘┊││┊└────────────────┘└────────────────┘└────────────────┘┊││┊└────────────────┘└────────────────┘└────────────────┘┊│┊
┊│└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘││└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘││└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘│┊
┊└────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────────┘┊
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘

About

An APL-inspired boxed prettyprint for numpy arrays

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages