Lo
def Lo(
x:Union, # Your data
plain:bool = False , # Show as plain text - values only
verbose:NoneType= None , # Verbose - show values too
depth:int = 0 , # Expand up to `depth`
color:Optional= None , # Use ANSI colors
):
Lo and behold! What a lovely numpy.ndarray!
lo
def lo(
x:Union, # Your data
plain:bool = False , # Show as plain text - values only
verbose:Optional= None , # Verbose - show values too
depth:int = 0 , # Expand up to `depth`
color:Optional= None , # Use ANSI colors
):
Examples
t = np.array([[1 ,2 ,3 ], [4 ,5 ,6 ]])
t
array([[1, 2, 3],
[4, 5, 6]])
array[2, 3] i64 n=6 xโ[1, 6] ฮผ=3.500 ฯ=1.708 [[1, 2, 3], [4, 5, 6]]
array([[1, 2, 3],
[4, 5, 6]])
array([[1, 2, 3],
[4, 5, 6]])
array[2, 3] i64 n=6 xโ[1, 6] ฮผ=3.500 ฯ=1.708 [[1, 2, 3], [4, 5, 6]]
array[3] i64 xโ[1, 3] ฮผ=2.000 ฯ=0.816 [1, 2, 3]
array[3] i64 xโ[4, 6] ฮผ=5.000 ฯ=0.816 [4, 5, 6]
lo(t[None ]).deeper(2 ) # We need to go deeper
array[1, 2, 3] i64 n=6 xโ[1, 6] ฮผ=3.500 ฯ=1.708 [[[1, 2, 3], [4, 5, 6]]]
array[2, 3] i64 n=6 xโ[1, 6] ฮผ=3.500 ฯ=1.708 [[1, 2, 3], [4, 5, 6]]
array[3] i64 xโ[1, 3] ฮผ=2.000 ฯ=0.816 [1, 2, 3]
array[3] i64 xโ[4, 6] ฮผ=5.000 ฯ=0.816 [4, 5, 6]
in_stats = ( (0.485 , 0.456 , 0.406 ), # mean
(0.229 , 0.224 , 0.225 ) ) # std
image = np.load("mysteryman.npy" ).transpose(1 ,2 ,0 )
lo(image)
array[196, 196, 3] f32 n=115248 (0.4Mb) xโ[-2.118, 2.640] ฮผ=-0.388 ฯ=1.073
spicy = image.flatten()[:12 ].copy()
spicy[0 ] *= 10000
spicy[1 ] /= 10000
spicy[2 ] = float ('inf' )
spicy[3 ] = float ('-inf' )
spicy[4 ] = float ('nan' )
spicy = spicy.reshape((2 ,6 ))
lo(spicy)
array[2, 6] f32 n=12 xโ[-3.541e+03, -1.975e-05] ฮผ=-393.848 ฯ=1.113e+03 +Inf! -Inf! NaN!
# image = np.zeros((196,196,3))
# image[:75,::2,:] = 1
# image[75::2,:,:] = 1
lo(image).rgb #.fig.savefig("output.png", metadata={"Software": None})
lo(image).rgb(scale= 2 , denorm= in_stats)
array[196, 196, 3] f32 n=115248 (0.4Mb) xโ[-0.135, 1.292] ฮผ=0.384 ฯ=0.322
x = np.random.randn(100000 )+ 3
lo(x).plt(center= "mean" )