Skip to main content

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

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 a path handle. Files that are already present are not downloaded again.

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

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

By default the download runs on a background thread so a notebook cell returns immediately. The handle it returns is the file path, so you can hand it straight to a loader as above — it only blocks at the moment the file is actually opened. Call path.done() to check progress without blocking, or path.result() to wait explicitly. Pass download(background=False) to block and get the path as a plain string instead.

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

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:

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.

Metadata

Release files for em-database 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for em-database 0.3.0
File Size Uploaded
em_database-0.3.0.tar.gz 42.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for em-database 0.3.0
File Interpreter ABI Platform
em_database-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 101.1 kB

Release files / em_database-0.3.0.tar.gz

Download URL em_database-0.3.0.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e4533fd905c9168376c8278934e304b1595c6d06e4a1034d4af5266268063656
BLAKE2b-256 checksum
How to use checksums
7aa95bcff595829331f7c5adc5a348d62d90cb52fb46a0d3c85693df7ef8582a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / em_database-0.3.0-py3-none-any.whl

Download URL em_database-0.3.0-py3-none-any.whl
Size 58.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
140f29d2b77db57cf69f0fb35fd78406d3095368756ea9efb52d299b8f3a2705
BLAKE2b-256 checksum
How to use checksums
19ab39912c3cc77d4417f96df7bd5d7d67d0a3f63b774039ebad6b11556f82a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page