Metadata-Version: 2.4
Name: em-database
Version: 0.1.0
Summary: A database for electron microscopy data using pooch to download and manage files.
Author-email: Carter Francis <cartsfrancis@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://cssfrancis.github.io/em_data/
Project-URL: Documentation, https://cssfrancis.github.io/em_data/datasets.html
Project-URL: Repository, https://github.com/CSSFrancis/em_data
Project-URL: Issues, https://github.com/CSSFrancis/em_data/issues
Keywords: electron microscopy,database,materials science
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pooch
Requires-Dist: pyyaml
Requires-Dist: tqdm>=4.67.1
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"
Requires-Dist: hyperspy; extra == "tests"
Requires-Dist: quantem; extra == "tests"
Provides-Extra: doc
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: sphinx-rtd-theme; extra == "doc"
Requires-Dist: sphinx-gallery; extra == "doc"
Requires-Dist: quantem; extra == "doc"
Requires-Dist: hyperspy; extra == "doc"
Requires-Dist: pydata_sphinx_theme; extra == "doc"
Requires-Dist: sphinx_design; extra == "doc"
Dynamic: license-file

EM Data
-------

This is a simple project for aggregating different Electron Microscopy files which are hosted over different sources.  It uses pooch to download datasets and should be
used as a way to host simple example datasets for method validation.

Data is stored in a file "User/em_database" but this can be also set to a custom location.

List of datasets https://cssfrancis.github.io/em_data/datasets.html

## Installation

```bash
pip install em-database
```

## Usage

Every dataset is a class under `em_database.data`.  Calling `download()` fetches the
file to the data directory, verifies its checksum, and returns the path.  Files that
are already present are not downloaded again.

```python
import em_database.data as data
import hyperspy.api as hs

path = data.LayeredCuNb4DSTEM().download()
s = hs.load(path, lazy=True)
```

The download location defaults to `~/em_database` and can be changed either for the
session or through the `EM_DATABASE_DATA_DIR` environment variable:

```python
import em_database

em_database.set_data_dir("/path/to/somewhere")
em_database.get_data_dir()
em_database.reset_data_dir()
```

## Adding a dataset

Datasets are described by a YAML file in `em_database/datasets/`, one entry per file,
validated against `em_database/datasets/json-schema.json`.  The class name is generated
from the top-level key:

```yaml
MyDataset:
  description: What the data is, how it was acquired and how it is calibrated.
  source: https://zenodo.org/records/<record>/files
  checksum: md5:<hash>
  file: MyDataset.zspy
  data_size: 1.2 GB
  technique: 4D-STEM
  license: CC-BY-4.0
```

Open an issue with the new dataset template, or add the YAML file directly.
