Metex - Maximum Entropy TEXtures
Utilities for generating maximum entropy textures, according to Victor and Conte 2012.
Metex can be used as a standalone software from the command line, or as a Python package to generate and manipulate textures.
Requirements
- Python 3
- numpy ≥ 1.7
- matplotlib
Installation
To install the latest release, run:
pip install metex
(depending on your system, you may need to use pip3 instead of pip
in the command above).
This should install the metex package on your PYTHONPATH, as well
as an executable script called metex to your regular PATH.
Testing
(requires setuptools). If metex is already installed on your
system, look for the copy of the test_library.py and
test_cli_interface.sh scripts installed alongside the rest of the
metex files and execute it. For example:
python /usr/lib/python3.X/site-packages/metex/test/test_library.py
/bin/bash /usr/lib/python3.X/site-packages/metex/test/test_cli_interface.sh
Usage (command line)
Generate one sample of a fully random, square 10x10 texture, which will be saved to the current folder as '0.png':
metex 10
Save 10 samples of a 100x150 texture in folder named 'fig', with parameter 'alpha' set to -0.6. Name each sample 'fig_[n].png', where [n] takes on values 0,...,9:
metex --folder=fig --prefix=fig_ --n_samples=10 --alpha=-0.6 100 150
For more information on the command line parameters,
metex --help
(also see metex/core.py).
Usage (library)
The library implements a Texture class that represents the maximum
entropy distribution of textures with a given level of a statistic and
a given size. Objects of class Texture can be sampled, generating
objects of class TextureSample. This is a subclass of
numpy.ndarray with support for array-like manipulation, image
generation for use in experiments (via matplotlib) and terminal-based
pretty-printing (for messing around).
>>> import metex
>>> texture = metex.Texture(height=15, width=25, beta1=0.7)
>>> sample = texture.sample()
>>> print(sample)
⬛⬛⬛⬛⬛⬜⬛⬛⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜
⬜⬛⬛⬛⬛⬛⬛⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬛⬜⬛⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜
⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜
⬜⬜⬜⬜⬜⬜⬛⬛⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜
⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬜⬜⬜⬜⬜⬜⬛⬛
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬛⬜⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬜
⬜⬜⬛⬜⬜⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬛⬜⬛⬛⬜⬜
⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜
>>> print(sample[:5,:])
⬛⬛⬛⬛⬛⬜⬛⬛⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜
⬜⬛⬛⬛⬛⬛⬛⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬛⬜⬛⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜
⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛
>>> print(sample[:,:5])
⬛⬛⬛⬛⬛
⬜⬛⬛⬛⬛
⬜⬜⬜⬜⬛
⬛⬜⬛⬜⬜
⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬛⬛⬛⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬛⬜⬜⬛⬛
⬜⬜⬛⬜⬜
⬛⬛⬛⬛⬛
⬜⬜⬜⬜⬛
The exact rendering of the texture will depend on your terminal.
Changelog
See the CHANGELOG.md file for a list of changes from older versions.
Authors
metex is maintained by Eugenio Piasini.
Metadata
Release files for metex 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| metex-1.2.1.tar.gz | 23.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| metex-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.2 kB
Release files / metex-1.2.1.tar.gz
| Download URL | metex-1.2.1.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
307b439aca680d05fb47d879764e5f2d0264c54939d8745ea7dc1d570d7d5684
|
|
BLAKE2b-256 checksum How to use checksums |
9c8458fe908b57820f913c6ec76a568836166ee98aae4f292d6be0e0b3b2d185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / metex-1.2.1-py3-none-any.whl
| Download URL | metex-1.2.1-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b88e769dd556b861bb8a2dd2519ddf5ab595e3cc1687cf189653a046b1fae16f
|
|
BLAKE2b-256 checksum How to use checksums |
263fa108cf7055296d2ea2e17157d1d86e009b8a249a08896f247283eaf2029e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for metex 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.