lovely-numpy


Namelovely-numpy JSON
Version 0.2.11 PyPI version JSON
download
home_pagehttps://github.com/xl0/lovely-numpy
Summary💟 Lovely numpy
upload_time2024-02-07 04:13:52
maintainer
docs_urlNone
authorAlexey Zaytsev
requires_python>=3.7
licenseMIT License
keywords jupyter numpy visualisation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            💟 Lovely NumPy
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

<div>

## [Read full docs](https://xl0.github.io/lovely-numpy)

</div>

### More lovely stuff

##### Working with numbers

- [PyTorch](https://pytorch.org/): ❤️ [Lovely
  Tensors](https://github.com/xl0/lovely-tensors)
- [JAX](https://jax.readthedocs.io/): 💘 [Lovely
  `JAX`](https://github.com/xl0/lovely-jax)
- [TinyGrad](https://github.com/tinygrad/tinygrad): 🫀 [Lovely
  Grad](https://github.com/xl0/lovely-grad)

##### Proompting

- Log prompts with 💌 [Lovely
  Prompts](https://github.com/xl0/lovely-prompts)
- Better LangChain: 😎 [Proompter](https://github.com/xl0/proompter)

##### Community

- [Discord](https://discord.gg/qBaqauUWXP) (Now the link works!)

## Install

``` sh
pip install lovely-numpy
```

or

``` sh
conda install -c conda-forge lovely-numpy
```

## How to use

How often do you find yourself debugging NumPy code? You dump your
variable to the cell output, and see this:

``` python
numbers
```

    array([[[-0.3541, -0.1975, -0.6715],
            [-0.3369, -0.1975, -0.9853],
            ...,
            [-0.4739, -0.3725, -0.689 ],
            [ 2.2489,  2.4111,  2.396 ]],

           [[-0.4054, -0.25  , -0.7238],
            [-0.4226, -0.2325, -1.0724],
            ...,
            [-0.8507, -0.6702, -1.0201],
            [ 2.1633,  2.3585,  2.3263]],

           ...,

           [[-0.8507, -0.3901, -1.1944],
            [-0.7822, -0.2325, -1.4559],
            ...,
            [-1.5014, -1.2304, -1.4733],
            [ 2.1804,  2.4111,  2.4308]],

           [[-0.8335, -0.4076, -1.2293],
            [-0.8164, -0.285 , -1.5256],
            ...,
            [-1.5528, -1.2829, -1.5256],
            [ 2.1119,  2.341 ,  2.3611]]], dtype=float32)

Was it really useful for you, as a human, to see all these numbers?

What is the shape? The size?  
What are the statistics?  
Are any of the values `nan` or `inf`?  
Is it an image of a man holding a tench?

``` python
from lovely_numpy import lo
```

## <code>Lo</code> and behold!

``` python
lo(numbers)
```

    array[196, 196, 3] f32 n=115248 (0.4Mb) x∈[-2.118, 2.640] μ=-0.388 σ=1.073

Better, eh?

``` python
lo(numbers[1,:6,1]) # Still shows values if there are not too many.
```

    array[6] f32 x∈[-0.408, -0.232] μ=-0.340 σ=0.075 [-0.250, -0.232, -0.338, -0.408, -0.408, -0.408]

``` python
spicy = numbers[0,:12,0].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) # Spicy stuff
```

    array[2, 6] f32 n=12 x∈[-3.541e+03, -3.369e-05] μ=-393.776 σ=1.113e+03 +Inf! -Inf! NaN!

``` python
lo(np.zeros((10, 10))) # A zero array - make it obvious
```

    array[10, 10] n=100 all_zeros

``` python
lo(spicy, verbose=True)
```

    array[2, 6] f32 n=12 x∈[-3.541e+03, -3.369e-05] μ=-393.776 σ=1.113e+03 +Inf! -Inf! NaN!
    array([[-3540.5432,    -0.    , ...,        nan,    -0.4054],
           [   -0.4226,    -0.4911, ...,    -0.5424,    -0.5082]],
          dtype=float32)

## Going `.deeper`

``` python
lo(numbers.transpose(2,1,0)).deeper
```

    array[3, 196, 196] f32 n=115248 (0.4Mb) x∈[-2.118, 2.640] μ=-0.388 σ=1.073
      array[196, 196] f32 n=38416 x∈[-2.118, 2.249] μ=-0.324 σ=1.036
      array[196, 196] f32 n=38416 x∈[-1.966, 2.429] μ=-0.274 σ=0.973
      array[196, 196] f32 n=38416 x∈[-1.804, 2.640] μ=-0.567 σ=1.178

``` python
# You can go deeper if you need to
lo(numbers[:3,:4]).deeper(2)
```

    array[3, 4, 3] f32 n=36 x∈[-1.125, -0.197] μ=-0.563 σ=0.280
      array[4, 3] f32 n=12 x∈[-0.985, -0.197] μ=-0.487 σ=0.259
        array[3] f32 x∈[-0.672, -0.197] μ=-0.408 σ=0.197 [-0.354, -0.197, -0.672]
        array[3] f32 x∈[-0.985, -0.197] μ=-0.507 σ=0.343 [-0.337, -0.197, -0.985]
        array[3] f32 x∈[-0.881, -0.303] μ=-0.530 σ=0.252 [-0.405, -0.303, -0.881]
        array[3] f32 x∈[-0.776, -0.303] μ=-0.506 σ=0.199 [-0.440, -0.303, -0.776]
      array[4, 3] f32 n=12 x∈[-1.072, -0.232] μ=-0.571 σ=0.281
        array[3] f32 x∈[-0.724, -0.250] μ=-0.460 σ=0.197 [-0.405, -0.250, -0.724]
        array[3] f32 x∈[-1.072, -0.232] μ=-0.576 σ=0.360 [-0.423, -0.232, -1.072]
        array[3] f32 x∈[-0.968, -0.338] μ=-0.599 σ=0.268 [-0.491, -0.338, -0.968]
        array[3] f32 x∈[-0.968, -0.408] μ=-0.651 σ=0.235 [-0.577, -0.408, -0.968]
      array[4, 3] f32 n=12 x∈[-1.125, -0.285] μ=-0.631 σ=0.280
        array[3] f32 x∈[-0.828, -0.303] μ=-0.535 σ=0.219 [-0.474, -0.303, -0.828]
        array[3] f32 x∈[-1.125, -0.285] μ=-0.628 σ=0.360 [-0.474, -0.285, -1.125]
        array[3] f32 x∈[-1.020, -0.390] μ=-0.651 σ=0.268 [-0.542, -0.390, -1.020]
        array[3] f32 x∈[-1.003, -0.478] μ=-0.708 σ=0.219 [-0.645, -0.478, -1.003]

## Now in `.rgb` color

The important queston - is it our man?

``` python
lo(numbers).rgb
```

![](index_files/figure-commonmark/cell-11-output-1.png)

*Maaaaybe?* Looks like someone normalized him.

``` python
in_stats = ( (0.485, 0.456, 0.406),     # mean 
             (0.229, 0.224, 0.225) )    # std

# numbers.rgb(in_stats, cl=True) # For channel-last input format
lo(numbers).rgb(denorm=in_stats)
```

![](index_files/figure-commonmark/cell-12-output-1.png)

It’s indeed our hero, the Tenchman!

## See the `.chans`

``` python
# .chans will map values betwen [-1,1] to colors.
# Make our values fit into that range to avoid clipping.
mean = np.array(in_stats[0])
std = np.array(in_stats[1])
numbers_01 = (numbers*std + mean).clip(0,1)
lo(numbers_01)
```

    array[196, 196, 3] n=115248 (0.9Mb) x∈[0., 1.000] μ=0.361 σ=0.248

``` python
lo(numbers_01).chans
```

![](index_files/figure-commonmark/cell-14-output-1.png)

## Grouping

``` python
# Make 8 images with progressively higher brightness and stack them 2x2x2.
eight_images = (np.stack([numbers]*8) + np.linspace(-2, 2, 8)[:,None,None,None])
eight_images = (eight_images
                     *np.array(in_stats[1])
                     +np.array(in_stats[0])
                ).clip(0,1).reshape(2,2,2,196,196,3)
            
lo(eight_images)
```

    array[2, 2, 2, 196, 196, 3] n=921984 (7.0Mb) x∈[0., 1.000] μ=0.382 σ=0.319

``` python
lo(eight_images).rgb
```

![](index_files/figure-commonmark/cell-16-output-1.png)

## Histogram

``` python
lo(numbers+3).plt
```

![](index_files/figure-commonmark/cell-17-output-1.svg)

``` python
lo(numbers+3).plt(center="mean", max_s=1000)
```

![](index_files/figure-commonmark/cell-18-output-1.svg)

``` python
lo(numbers+3).plt(center="range")
```

![](index_files/figure-commonmark/cell-19-output-1.svg)

## Options \| [Docs](03d_utils.config.html)

``` python
from lovely_numpy import set_config, config, lovely
```

``` python
set_config(precision=5, sci_mode=True, color=False)
lo(np.array([1.,2,np.nan]))
```

    array[3] μ=1.50000e+00 σ=5.00000e-01 NaN! [1.00000e+00, 2.00000e+00, nan]

``` python
set_config(precision=None, sci_mode=None, color=None) # None -> Reset to defaults
lo(np.array([1.,2,np.nan]))
```

    array[3] μ=1.500 σ=0.500 NaN! [1.000, 2.000, nan]

``` python
# Or with config context manager.
with config(sci_mode=True):
    print(lo(np.array([1,2,3])))

print(lo(np.array([1,2,3])))
```

    array[3] i64 x∈[1, 3] μ=2.000e+00 σ=8.165e-01 [1, 2, 3]
    array[3] i64 x∈[1, 3] μ=2.000 σ=0.816 [1, 2, 3]

## Default `str` and `repr`

``` python
set_config(repr=lovely)
print(np.array([1, 2, 3])) # Note: print() calls str(). Cell output is repr()
print(repr(np.array([1, 2, 3]))) # See docs if you want to only set `repr`` or `str``
```

    array[3] i64 x∈[1, 3] μ=2.000 σ=0.816 [1, 2, 3]
    array[3] i64 x∈[1, 3] μ=2.000 σ=0.816 [1, 2, 3]

``` python
lo(np.array([1, 2, 3])).p # To see the plain values
```

    array([1, 2, 3])

## Without <code>Lo</code>

``` python
from lovely_numpy import rgb, chans, plot
```

``` python
lovely(numbers) # Returns `str`, that's why you see ''.
# Note:  lo(x) returns a wrapper object with a `__repr__` and other methods.
```

    'array[196, 196, 3] f32 n=115248 (0.4Mb) x∈[-2.118, 2.640] μ=-0.388 σ=1.073'

``` python
rgb(numbers, denorm=in_stats)
```

![](index_files/figure-commonmark/cell-28-output-1.png)

``` python
chans(numbers*0.3+0.5)
```

![](index_files/figure-commonmark/cell-29-output-1.png)

``` python
plot(numbers)
```

![](index_files/figure-commonmark/cell-30-output-1.svg)

## Matplotlib integration \| [Docs](matplotlib.html)

``` python
lo(numbers).rgb(in_stats).fig # matplotlib figure
```

![](index_files/figure-commonmark/cell-31-output-1.png)

``` python
lo(numbers).plt.fig.savefig('pretty.svg') # Save it
```

``` python
!file pretty.svg; rm pretty.svg
```

    pretty.svg: SVG Scalable Vector Graphics image

``` python
fig = plt.figure(figsize=(8,3))
fig.set_constrained_layout(True)
gs = fig.add_gridspec(2,2)
ax1 = fig.add_subplot(gs[0, :])
ax2 = fig.add_subplot(gs[1, 0])
ax3 = fig.add_subplot(gs[1,1:])

ax2.set_axis_off()
ax3.set_axis_off()

lo(numbers_01).plt(ax=ax1)
lo(numbers_01).rgb(ax=ax2)
lo(numbers_01).chans(ax=ax3);
```

![](index_files/figure-commonmark/cell-34-output-1.png)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xl0/lovely-numpy",
    "name": "lovely-numpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "jupyter numpy visualisation",
    "author": "Alexey Zaytsev",
    "author_email": "alexey.zaytsev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a3/49/00e8f4b3cdc67f235bf1f259d843ca1694ad68f56e5dea055610cffff444/lovely-numpy-0.2.11.tar.gz",
    "platform": null,
    "description": "\ud83d\udc9f Lovely NumPy\n================\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n<div>\n\n## [Read full docs](https://xl0.github.io/lovely-numpy)\n\n</div>\n\n### More lovely stuff\n\n##### Working with numbers\n\n- [PyTorch](https://pytorch.org/): \u2764\ufe0f [Lovely\n  Tensors](https://github.com/xl0/lovely-tensors)\n- [JAX](https://jax.readthedocs.io/): \ud83d\udc98 [Lovely\n  `JAX`](https://github.com/xl0/lovely-jax)\n- [TinyGrad](https://github.com/tinygrad/tinygrad): \ud83e\udec0 [Lovely\n  Grad](https://github.com/xl0/lovely-grad)\n\n##### Proompting\n\n- Log prompts with \ud83d\udc8c [Lovely\n  Prompts](https://github.com/xl0/lovely-prompts)\n- Better LangChain: \ud83d\ude0e [Proompter](https://github.com/xl0/proompter)\n\n##### Community\n\n- [Discord](https://discord.gg/qBaqauUWXP) (Now the link works!)\n\n## Install\n\n``` sh\npip install lovely-numpy\n```\n\nor\n\n``` sh\nconda install -c conda-forge lovely-numpy\n```\n\n## How to use\n\nHow often do you find yourself debugging NumPy code? You dump your\nvariable to the cell output, and see this:\n\n``` python\nnumbers\n```\n\n    array([[[-0.3541, -0.1975, -0.6715],\n            [-0.3369, -0.1975, -0.9853],\n            ...,\n            [-0.4739, -0.3725, -0.689 ],\n            [ 2.2489,  2.4111,  2.396 ]],\n\n           [[-0.4054, -0.25  , -0.7238],\n            [-0.4226, -0.2325, -1.0724],\n            ...,\n            [-0.8507, -0.6702, -1.0201],\n            [ 2.1633,  2.3585,  2.3263]],\n\n           ...,\n\n           [[-0.8507, -0.3901, -1.1944],\n            [-0.7822, -0.2325, -1.4559],\n            ...,\n            [-1.5014, -1.2304, -1.4733],\n            [ 2.1804,  2.4111,  2.4308]],\n\n           [[-0.8335, -0.4076, -1.2293],\n            [-0.8164, -0.285 , -1.5256],\n            ...,\n            [-1.5528, -1.2829, -1.5256],\n            [ 2.1119,  2.341 ,  2.3611]]], dtype=float32)\n\nWas it really useful for you, as a human, to see all these numbers?\n\nWhat is the shape? The size?  \nWhat are the statistics?  \nAre any of the values `nan` or `inf`?  \nIs it an image of a man holding a tench?\n\n``` python\nfrom lovely_numpy import lo\n```\n\n## <code>Lo</code> and behold!\n\n``` python\nlo(numbers)\n```\n\n    array[196, 196, 3] f32 n=115248 (0.4Mb) x\u2208[-2.118, 2.640] \u03bc=-0.388 \u03c3=1.073\n\nBetter, eh?\n\n``` python\nlo(numbers[1,:6,1]) # Still shows values if there are not too many.\n```\n\n    array[6] f32 x\u2208[-0.408, -0.232] \u03bc=-0.340 \u03c3=0.075 [-0.250, -0.232, -0.338, -0.408, -0.408, -0.408]\n\n``` python\nspicy = numbers[0,:12,0].copy()\n\nspicy[0] *= 10000\nspicy[1] /= 10000\nspicy[2] = float('inf')\nspicy[3] = float('-inf')\nspicy[4] = float('nan')\n\nspicy = spicy.reshape((2,6))\nlo(spicy) # Spicy stuff\n```\n\n    array[2, 6] f32 n=12 x\u2208[-3.541e+03, -3.369e-05] \u03bc=-393.776 \u03c3=1.113e+03 +Inf! -Inf! NaN!\n\n``` python\nlo(np.zeros((10, 10))) # A zero array - make it obvious\n```\n\n    array[10, 10] n=100 all_zeros\n\n``` python\nlo(spicy, verbose=True)\n```\n\n    array[2, 6] f32 n=12 x\u2208[-3.541e+03, -3.369e-05] \u03bc=-393.776 \u03c3=1.113e+03 +Inf! -Inf! NaN!\n    array([[-3540.5432,    -0.    , ...,        nan,    -0.4054],\n           [   -0.4226,    -0.4911, ...,    -0.5424,    -0.5082]],\n          dtype=float32)\n\n## Going `.deeper`\n\n``` python\nlo(numbers.transpose(2,1,0)).deeper\n```\n\n    array[3, 196, 196] f32 n=115248 (0.4Mb) x\u2208[-2.118, 2.640] \u03bc=-0.388 \u03c3=1.073\n      array[196, 196] f32 n=38416 x\u2208[-2.118, 2.249] \u03bc=-0.324 \u03c3=1.036\n      array[196, 196] f32 n=38416 x\u2208[-1.966, 2.429] \u03bc=-0.274 \u03c3=0.973\n      array[196, 196] f32 n=38416 x\u2208[-1.804, 2.640] \u03bc=-0.567 \u03c3=1.178\n\n``` python\n# You can go deeper if you need to\nlo(numbers[:3,:4]).deeper(2)\n```\n\n    array[3, 4, 3] f32 n=36 x\u2208[-1.125, -0.197] \u03bc=-0.563 \u03c3=0.280\n      array[4, 3] f32 n=12 x\u2208[-0.985, -0.197] \u03bc=-0.487 \u03c3=0.259\n        array[3] f32 x\u2208[-0.672, -0.197] \u03bc=-0.408 \u03c3=0.197 [-0.354, -0.197, -0.672]\n        array[3] f32 x\u2208[-0.985, -0.197] \u03bc=-0.507 \u03c3=0.343 [-0.337, -0.197, -0.985]\n        array[3] f32 x\u2208[-0.881, -0.303] \u03bc=-0.530 \u03c3=0.252 [-0.405, -0.303, -0.881]\n        array[3] f32 x\u2208[-0.776, -0.303] \u03bc=-0.506 \u03c3=0.199 [-0.440, -0.303, -0.776]\n      array[4, 3] f32 n=12 x\u2208[-1.072, -0.232] \u03bc=-0.571 \u03c3=0.281\n        array[3] f32 x\u2208[-0.724, -0.250] \u03bc=-0.460 \u03c3=0.197 [-0.405, -0.250, -0.724]\n        array[3] f32 x\u2208[-1.072, -0.232] \u03bc=-0.576 \u03c3=0.360 [-0.423, -0.232, -1.072]\n        array[3] f32 x\u2208[-0.968, -0.338] \u03bc=-0.599 \u03c3=0.268 [-0.491, -0.338, -0.968]\n        array[3] f32 x\u2208[-0.968, -0.408] \u03bc=-0.651 \u03c3=0.235 [-0.577, -0.408, -0.968]\n      array[4, 3] f32 n=12 x\u2208[-1.125, -0.285] \u03bc=-0.631 \u03c3=0.280\n        array[3] f32 x\u2208[-0.828, -0.303] \u03bc=-0.535 \u03c3=0.219 [-0.474, -0.303, -0.828]\n        array[3] f32 x\u2208[-1.125, -0.285] \u03bc=-0.628 \u03c3=0.360 [-0.474, -0.285, -1.125]\n        array[3] f32 x\u2208[-1.020, -0.390] \u03bc=-0.651 \u03c3=0.268 [-0.542, -0.390, -1.020]\n        array[3] f32 x\u2208[-1.003, -0.478] \u03bc=-0.708 \u03c3=0.219 [-0.645, -0.478, -1.003]\n\n## Now in `.rgb` color\n\nThe important queston - is it our man?\n\n``` python\nlo(numbers).rgb\n```\n\n![](index_files/figure-commonmark/cell-11-output-1.png)\n\n*Maaaaybe?* Looks like someone normalized him.\n\n``` python\nin_stats = ( (0.485, 0.456, 0.406),     # mean \n             (0.229, 0.224, 0.225) )    # std\n\n# numbers.rgb(in_stats, cl=True) # For channel-last input format\nlo(numbers).rgb(denorm=in_stats)\n```\n\n![](index_files/figure-commonmark/cell-12-output-1.png)\n\nIt\u2019s indeed our hero, the Tenchman!\n\n## See the `.chans`\n\n``` python\n# .chans will map values betwen [-1,1] to colors.\n# Make our values fit into that range to avoid clipping.\nmean = np.array(in_stats[0])\nstd = np.array(in_stats[1])\nnumbers_01 = (numbers*std + mean).clip(0,1)\nlo(numbers_01)\n```\n\n    array[196, 196, 3] n=115248 (0.9Mb) x\u2208[0., 1.000] \u03bc=0.361 \u03c3=0.248\n\n``` python\nlo(numbers_01).chans\n```\n\n![](index_files/figure-commonmark/cell-14-output-1.png)\n\n## Grouping\n\n``` python\n# Make 8 images with progressively higher brightness and stack them 2x2x2.\neight_images = (np.stack([numbers]*8) + np.linspace(-2, 2, 8)[:,None,None,None])\neight_images = (eight_images\n                     *np.array(in_stats[1])\n                     +np.array(in_stats[0])\n                ).clip(0,1).reshape(2,2,2,196,196,3)\n            \nlo(eight_images)\n```\n\n    array[2, 2, 2, 196, 196, 3] n=921984 (7.0Mb) x\u2208[0., 1.000] \u03bc=0.382 \u03c3=0.319\n\n``` python\nlo(eight_images).rgb\n```\n\n![](index_files/figure-commonmark/cell-16-output-1.png)\n\n## Histogram\n\n``` python\nlo(numbers+3).plt\n```\n\n![](index_files/figure-commonmark/cell-17-output-1.svg)\n\n``` python\nlo(numbers+3).plt(center=\"mean\", max_s=1000)\n```\n\n![](index_files/figure-commonmark/cell-18-output-1.svg)\n\n``` python\nlo(numbers+3).plt(center=\"range\")\n```\n\n![](index_files/figure-commonmark/cell-19-output-1.svg)\n\n## Options \\| [Docs](03d_utils.config.html)\n\n``` python\nfrom lovely_numpy import set_config, config, lovely\n```\n\n``` python\nset_config(precision=5, sci_mode=True, color=False)\nlo(np.array([1.,2,np.nan]))\n```\n\n    array[3] \u03bc=1.50000e+00 \u03c3=5.00000e-01 NaN! [1.00000e+00, 2.00000e+00, nan]\n\n``` python\nset_config(precision=None, sci_mode=None, color=None) # None -> Reset to defaults\nlo(np.array([1.,2,np.nan]))\n```\n\n    array[3] \u03bc=1.500 \u03c3=0.500 NaN! [1.000, 2.000, nan]\n\n``` python\n# Or with config context manager.\nwith config(sci_mode=True):\n    print(lo(np.array([1,2,3])))\n\nprint(lo(np.array([1,2,3])))\n```\n\n    array[3] i64 x\u2208[1, 3] \u03bc=2.000e+00 \u03c3=8.165e-01 [1, 2, 3]\n    array[3] i64 x\u2208[1, 3] \u03bc=2.000 \u03c3=0.816 [1, 2, 3]\n\n## Default `str` and `repr`\n\n``` python\nset_config(repr=lovely)\nprint(np.array([1, 2, 3])) # Note: print() calls str(). Cell output is repr()\nprint(repr(np.array([1, 2, 3]))) # See docs if you want to only set `repr`` or `str``\n```\n\n    array[3] i64 x\u2208[1, 3] \u03bc=2.000 \u03c3=0.816 [1, 2, 3]\n    array[3] i64 x\u2208[1, 3] \u03bc=2.000 \u03c3=0.816 [1, 2, 3]\n\n``` python\nlo(np.array([1, 2, 3])).p # To see the plain values\n```\n\n    array([1, 2, 3])\n\n## Without <code>Lo</code>\n\n``` python\nfrom lovely_numpy import rgb, chans, plot\n```\n\n``` python\nlovely(numbers) # Returns `str`, that's why you see ''.\n# Note:  lo(x) returns a wrapper object with a `__repr__` and other methods.\n```\n\n    'array[196, 196, 3] f32 n=115248 (0.4Mb) x\u2208[-2.118, 2.640] \u03bc=-0.388 \u03c3=1.073'\n\n``` python\nrgb(numbers, denorm=in_stats)\n```\n\n![](index_files/figure-commonmark/cell-28-output-1.png)\n\n``` python\nchans(numbers*0.3+0.5)\n```\n\n![](index_files/figure-commonmark/cell-29-output-1.png)\n\n``` python\nplot(numbers)\n```\n\n![](index_files/figure-commonmark/cell-30-output-1.svg)\n\n## Matplotlib integration \\| [Docs](matplotlib.html)\n\n``` python\nlo(numbers).rgb(in_stats).fig # matplotlib figure\n```\n\n![](index_files/figure-commonmark/cell-31-output-1.png)\n\n``` python\nlo(numbers).plt.fig.savefig('pretty.svg') # Save it\n```\n\n``` python\n!file pretty.svg; rm pretty.svg\n```\n\n    pretty.svg: SVG Scalable Vector Graphics image\n\n``` python\nfig = plt.figure(figsize=(8,3))\nfig.set_constrained_layout(True)\ngs = fig.add_gridspec(2,2)\nax1 = fig.add_subplot(gs[0, :])\nax2 = fig.add_subplot(gs[1, 0])\nax3 = fig.add_subplot(gs[1,1:])\n\nax2.set_axis_off()\nax3.set_axis_off()\n\nlo(numbers_01).plt(ax=ax1)\nlo(numbers_01).rgb(ax=ax2)\nlo(numbers_01).chans(ax=ax3);\n```\n\n![](index_files/figure-commonmark/cell-34-output-1.png)\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "\ud83d\udc9f Lovely numpy",
    "version": "0.2.11",
    "project_urls": {
        "Homepage": "https://github.com/xl0/lovely-numpy"
    },
    "split_keywords": [
        "jupyter",
        "numpy",
        "visualisation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "556df701800a282411cdad146fda9f67e6a1bc501ebc9d9cb1d3afeedfc8a972",
                "md5": "00e87642e3a16b4183c644f29c0ca802",
                "sha256": "3587599bf7273df84c1cd909458a150967badb8aa097f92870aacf6b33f23f46"
            },
            "downloads": -1,
            "filename": "lovely_numpy-0.2.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "00e87642e3a16b4183c644f29c0ca802",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 24707,
            "upload_time": "2024-02-07T04:13:48",
            "upload_time_iso_8601": "2024-02-07T04:13:48.007102Z",
            "url": "https://files.pythonhosted.org/packages/55/6d/f701800a282411cdad146fda9f67e6a1bc501ebc9d9cb1d3afeedfc8a972/lovely_numpy-0.2.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a34900e8f4b3cdc67f235bf1f259d843ca1694ad68f56e5dea055610cffff444",
                "md5": "4de798299e70a1d3cd9f18900b031e43",
                "sha256": "aba4774a3e4a84bdc001194f1cb892ed673d6412f3b1ae6fbc2708347b3c3601"
            },
            "downloads": -1,
            "filename": "lovely-numpy-0.2.11.tar.gz",
            "has_sig": false,
            "md5_digest": "4de798299e70a1d3cd9f18900b031e43",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24411,
            "upload_time": "2024-02-07T04:13:52",
            "upload_time_iso_8601": "2024-02-07T04:13:52.527578Z",
            "url": "https://files.pythonhosted.org/packages/a3/49/00e8f4b3cdc67f235bf1f259d843ca1694ad68f56e5dea055610cffff444/lovely-numpy-0.2.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 04:13:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xl0",
    "github_project": "lovely-numpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lovely-numpy"
}
        
Elapsed time: 0.17846s