Skip to main content

No project description provided

Project description

np-aind-metadata

PyPI Python version

Coverage CI/CD GitHub issues

Usage

conda create -n np_aind_metadata python>=3.10
conda activate np_aind_metadata
pip install np_aind_metadata

On-prem usage

If on Allen Institute premises, additional features are available via np-config. To use on-prem features install np-config.

pip install np-config

Python

On-prem

Copies the latest rig.json from storage to a local path.

>>> from datetime import datetime
>>> from pathlib import Path
>>> import datetime
>>> from np_aind_metadata import rigs

>>> rigs.copy_rig("NP3", datetime(2024, 4, 1), output_path=Path("rig.json"))
PosixPath('rig.json')

Off-prem

Updates a rig json and store it at output path.

>>> from pathlib import Path
>>> from np_aind_metadata.update import update_rig
>>> update_rig(
...     Path(".", "examples", "rig.json"),
...     open_ephys_settings_sources=[
...         Path(
...             ".",
...             "examples",
...             "example-session-directory",
...             "settings.xml"
...         ),
...     ],
...     output_path=Path("rig.json"),
... )
PosixPath('rig.json')

Convenience functions

Direct support for common use cases.

np-codeocean

Parses a dynamic routing session directory for a session.json, adds it's corresponding rig.json, and updates session.json to reflect the rig.json it is associated with. If not onprem, rig_storage_dir will need to be supplied.

>>> from pathlib import Path
>>> from np_aind_metadata.integrations import dynamic_routing_task
>>> session_dir = Path("examples") / "example-session-directory"
>>> dynamic_routing_task.add_rig_to_session_dir(session_dir, datetime.datetime(2024, 4, 1))

Model storage

Models are stored locally on disk. To initialize model storage.

Initialize storage for all supported rigs.

np-aind-metadata init-rig-storage "/directory/to/store/rigs"

Initialize storage for a specific rig.

np-aind-metadata init-rig-storage "/directory/to/store/rigs" "NP3" --date 2022/02/07

Update a stored rig.

np-aind-metadata update-rig "/directory/to/store/rigs" "NP3" --date 2022/02/07

Local development

Testing

Testing intended for cloned project from source control.

Unit tests

pdm run pytest

Storage tests

pdm run pytest-storage

On-prem tests

Requires user to likely be on prem with np group dependencies installed.

Install np group dependencies

pdm install -G np

Run tests

pdm run pytest-onprem

All tests

Requires dependencies from onprem.

pdm run pytest-full

Development

See instructions in https://github.com/AllenInstitute/np-aind-metadata/CONTRIBUTING.md and the original template: https://github.com/AllenInstitute/copier-pdm-npc/blob/main/README.md

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

np_aind_metadata-0.1.15.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

np_aind_metadata-0.1.15-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file np_aind_metadata-0.1.15.tar.gz.

File metadata

  • Download URL: np_aind_metadata-0.1.15.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.3 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for np_aind_metadata-0.1.15.tar.gz
Algorithm Hash digest
SHA256 f235f22acbbebd20664c488a93552c76b0ef189d16e18a564d53cebfcc7aace2
MD5 266a2d1a5cf9b39ddbb2562bc5b54197
BLAKE2b-256 31f44348af897730f74ac98f4db9a2c62b3b15ec2241dc8031c9a16593ac729c

See more details on using hashes here.

File details

Details for the file np_aind_metadata-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: np_aind_metadata-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.3 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for np_aind_metadata-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 ea41d42eb77271cd384e5e2fa9efd60321771cfc78a8dee291caa0da63e916c5
MD5 4686f5c36a06ef1c46f281feab5e601b
BLAKE2b-256 f543f111b6d65a7623e5b84aaa04eb958242c431f9a3b1ceb1684d9db0eb1d0e

See more details on using hashes here.

Supported by

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