Adding data to the data module#
Example datasets used in the documentation and tests are included in the
orix.data module via the pooch
These are listed in a file registry (
orix.data._registry.py) with their file
verification string (hash, SHA256, obtain with e.g.
sha256sum <file>) and location,
the latter potentially not within the package but from the orix-data repository or elsewhere, since some files are
considered too large to include in the package.
If a required dataset isn’t in the package, but is in the registry, it can be downloaded
from the repository when the user passes
allow_download=True to e.g.
The dataset is then downloaded to a local cache, in the location returned from
The location can be overwritten with a global
ORIX_DATA_DIR variable locally, e.g.
by setting export
Pooch handles downloading, caching, version control, file verification (against hash)
If we have updated the file hash, pooch will re-download it.
If the file is available in the cache, it can be loaded as the other files in the data
With every new version of orix, a new directory of data sets with the version name is added to the cache directory. Any old directories are not deleted automatically, and should then be deleted manually if desired.