Skip to main content

Tools to fetch and update paths, metadata and state for Mindscope Neuropixels sessions, in the cloud.

Project description

npc_lims

neuropixels cloud lab information management system Tools to fetch and update paths, metadata and state for Mindscope Neuropixels sessions, in the cloud.

PyPI Python version

Coverage CI/CD GitHub issues

quickstart

  • make a new Python >=3.9 virtual environment with conda or venv (lighter option, since this package does not require pandas, numpy etc.):

    python -m venv .venv
    
  • activate the virtual environment:

    • Windows
    .venv\scripts\activate
    
    • Unix
    source .venv/bin/activate.sh
    
  • install the package:

    python -m pip install npc_lims
    
  • setup credentials

    • required environment variables:
      • AWS S3
        • AWS_DEFAULT_REGION
        • AWS_ACCESS_KEY_ID
        • AWS_SECRET_ACCESS_KEY
        • to find and read files on S3
        • must have read access on relevant aind buckets
        • can be in a standard ~/.aws location, as used by AWS CLI or boto3
      • CodeOcean API
        • CODE_OCEAN_API_TOKEN
        • CODE_OCEAN_DOMAIN
        • to find processed data in "data assets" via the Codeocean API
        • generated in CodeOcean:
          • right click on Account (bottom left, person icon)
          • click User Secrets - these are secrets than can be made available as environment variables in CodeOcean capsules
          • go to Access Tokens and click Generate new token - this is for programatically querying CodeOcean's databases
            • in Token Name enter Codeocean API (read) and check read on capsules and datasets
            • a token will be generated: click copy (storing it in a password manager, if you use one)
          • head back to User Secrets where we'll paste it into a new secret via Add secret > API credentials - in description enter Codeocean API (read) - in API key enter CODE_OCEAN_API_KEY - in API secret paste the copied secret from before (should start with cop_...) CODE_OCEAN_DOMAIN is the codeocean https address, up to and including .org
    • environment variables can also be specified in a file named .env in the current working directory
  • now in Python we can find sessions that are available to work with:

        >>> import npc_lims;
    
    # get a sequence of `SessionInfo` dataclass instances, one per session:
        >>> tracked_sessions: tuple[npc_lims.SessionInfo, ...] = npc_lims.get_session_info()
    
    # each `SessionInfo` instance has minimal metadata about its session:
        >>> tracked_sessions[0]                 # doctest: +SKIP
        npc_lims.SessionInfo(id='626791_2022-08-15', subject=626791, date='2022-08-15', idx=0, project='DRPilotSession', is_ephys=True, is_sync=True, allen_path=PosixUPath('//allen/programs/mindscope/workgroups/dynamicrouting/PilotEphys/Task 2 pilot/DRpilot_626791_20220815'))
            >>> tracked_sessions[0].is_ephys        # doctest: +SKIP
        False
    
    # currently, we're only tracking behavior and ephys sessions that use variants of https://github.com/samgale/DynamicRoutingTask/blob/main/TaskControl.py:
        >>> all(s.date.year >= 2022 for s in tracked_sessions)
        True
    
  • "tracked sessions" are discovered via 3 routes:

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

npc_lims-0.1.109.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

npc_lims-0.1.109-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file npc_lims-0.1.109.tar.gz.

File metadata

  • Download URL: npc_lims-0.1.109.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.3.dev1+g1c5bd6a4 CPython/3.9.18

File hashes

Hashes for npc_lims-0.1.109.tar.gz
Algorithm Hash digest
SHA256 656dd6e5d79ff5de8e4989f38e5caa92dc7b03f7c5ae0ca2b1448d211f692c3d
MD5 c3904b4548b4bfed96b67faa54d99bd0
BLAKE2b-256 d5d08fadf1bb9f19b629d0e43d171dba87907f87f0c630be7783c7251117e481

See more details on using hashes here.

File details

Details for the file npc_lims-0.1.109-py3-none-any.whl.

File metadata

  • Download URL: npc_lims-0.1.109-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.3.dev1+g1c5bd6a4 CPython/3.9.18

File hashes

Hashes for npc_lims-0.1.109-py3-none-any.whl
Algorithm Hash digest
SHA256 e945815e1a6884ae42eaa836e49664d37a772d0d364e4d7e8c41486927357834
MD5 00a79a0d6815830f975ac4688d3321b5
BLAKE2b-256 5037a324a4487224f5e8bbbe610085976cacff25ec7fd852dfae52a985e81767

See more details on using hashes here.

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