Skip to main content

Fetch dream reports.

Project description

PyPI Downloads codecov Ruff Built with Material for MkDocs

krank

Fetch curated dream reports.

See the online documentation for details.

Installation

pip install --upgrade krank

Usage

import krank

# View a list of available corpora.
krank.list_corpora()
# ['hvdc', 'zhang2019']

# View a list of available versions for a corpus.
krank.list_versions("zhang2019")
# ['1']

# Print metadata about a single corpus.
krank.info("zhang2019")
# Corpus: zhang2019
#   Title: Zhang & Wamsley, 2019
#   Description: Dream reports collected from a laboratory polysomnography study
#   Version: 1
#   Citations: Zhang, J., & Wamsley, E. J. (2019); Wong, W., Herzog, R., ... (2025)

# Load a corpus.
corpus = krank.load("zhang2019")
corpus
# Corpus('zhang2019')

# Print corpus info (same as krank.info()).
print(corpus)
# Corpus: zhang2019
#   Title: Zhang & Wamsley, 2019
#   Description: Dream reports collected from a laboratory polysomnography study
#   Version: 1
#   Citations: Zhang, J., & Wamsley, E. J. (2019); Wong, W., Herzog, R., ... (2025)

# Get number of reports and authors.
corpus.n_reports
# 120
corpus.n_authors
# 16

# Return metadata as a dictionary.
corpus.metadata["title"]
# 'Zhang & Wamsley 2019 Dream Reports'
corpus.metadata["hash"]
# 'md5:a61a3c56f4ee8c14e4a6466044df88f8'
corpus.metadata["brief_description"]
# 'Dream reports collected from a laboratory polysomnography study'

# Return unique authors and their associated metadata in a tidy dataframe.
corpus.authors.head()
#    author  age     sex
# 0      10   23    Male
# 1      26   18    Male
# 2      30   19  Female
# 3      42   20    Male
# 4      83   20    Male

# Return dream reports and their associated metadata in a tidy dataframe.
corpus.reports.head()
#    author      time stage_intended stage_actual  experience                                             report
# 0      10  07:17:27            REM      Morning        True  I umm I was with my parents and we're having a...
# 1      10  02:07:02             N2         NREM        True  Ummm... trying to put um everything together [...
# 2      10  03:50:48            REM          REM        True  Yes I'm ummm... I'm in an argument with a...wi...
# 3      10  00:16:08             N1           SO       False  What? I don't have a dream. What was your ques...
# 4      10  00:54:12             N2           SO        True  Uhuh. Umm let's see.. Running around...(silence).

Contributing

Open an Issue to request a new corpus (or for any other reason).

Adding a new corpus involves the following steps:

  1. Adding a sources/<name>/prepare.ipynb that exports a single CSV file.
  2. Creating a new Zenodo archive with that CSV file.
  3. Add the corpus info to the registry.yaml file (See registry-schema.yaml for what fields are required.)
  4. Add the corpus to mkdocs.yaml.

Versioning

Follows a modified semver structure, where, given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when there are incompatible API changes or an existing corpus is removed.
  2. MINOR version when functionality is added in a backward compatible manner or a new corpus is added.
  3. PATCH version when backward compatible bug fixes are added or an existing corpus gets a new release.

Validating Registry Changes

After making changes to the registry, validate them locally using:

python scripts/validate_registry.py

This script checks:

  • Schema compliance (all required fields present with correct types)
  • Alphabetical ordering of collections and corpora
  • Valid references from collections to corpora
  • Proper hash formats and URLs

The validation runs automatically as part of the test suite in CI.

Credits

This project would not be possible without the work of the Fatiando a Terra Project, namely a heavy dependency on pooch, an inspiration from ensaio, and a structural model from the Fatiando a Terra FAIR data collection.

Uieda, L., V. C. Oliveira Jr, and V. C. F. Barbosa (2013), Modeling the Earth with Fatiando a Terra, Proceedings of the 12th Python in Science Conference, pp. 91-98. doi:10.25080/Majora-8b375195-010

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krank-0.1.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krank-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file krank-0.1.0.tar.gz.

File metadata

  • Download URL: krank-0.1.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for krank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35b683f01dbe9c1327c37d2128729fc7d1086ef385c30bb95f52ce69c41b8264
MD5 80bf5657c6b47bbecb3bf200d277f360
BLAKE2b-256 d730083f6c8a30d0aab341c77b6554f4521fe6ec8d5258b5b20a4a1ed75388ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for krank-0.1.0.tar.gz:

Publisher: release.yaml on remrama/krank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krank-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: krank-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for krank-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 961d0205a18fa081590cd01a5245654afa941da9f85d527780f157623cf63e0d
MD5 338a603cea1593d45f070c3368795ad5
BLAKE2b-256 8b2d13fda21382091a37a6dbb7408defd2552b133f5c8d83f6527d094d74d13e

See more details on using hashes here.

Provenance

The following attestation bundles were made for krank-0.1.0-py3-none-any.whl:

Publisher: release.yaml on remrama/krank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page