Metadata-Version: 2.1
Name: np-session
Version: 0.6.19
Summary: Tools for accessing data, metadata, and jobs related to ecephys and behavior sessions for the Mindscope Neuropixels team.
Author-email: Ben Hardcastle <ben.hardcastle@alleninstitute.org>
Requires-Python: >=3.7
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Dist: backports.cached-property
Requires-Dist: firebase-admin>=6.1.0
Requires-Dist: np-tools>=0.1.6
Requires-Dist: np_config>=0.4.17
Requires-Dist: np_logging>=0.3.8
Requires-Dist: psycopg2-binary>=2
Requires-Dist: pydantic>=1.10.5
Requires-Dist: redis<=4.1.4
Requires-Dist: requests>=2
Requires-Dist: typing-extensions>=4
Provides-Extra: dev
Requires-Dist: mypy>=0.910; extra == "dev"
Requires-Dist: types-requests>=2; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: blue>=0.9.1; extra == "dev"
Requires-Dist: coverage[toml]>=7.2.2; extra == "dev"
Requires-Dist: pdm>=2.4.9; extra == "dev"
Requires-Dist: bump>=1.3.2; extra == "dev"
Requires-Dist: types-backports>=0.1.3; extra == "dev"
Requires-Dist: ruff>=0.0.260; extra == "dev"
Project-URL: Bug Tracker, https://github.com/alleninstitute/np_session/issues
Project-URL: Repository, https://github.com/alleninstitute/np_session
Description-Content-Type: text/markdown

# np_session


### *For use on internal Allen Institute network*

A lightweight package for handling file paths and metadata associated with
Mindscope Neuropixels experiments with data on local rig-connected machines or
the /allen network.
Provides an interface that can be used by other applications.

```python
>>> from np_session import Session

# initialize with a lims session ID or a string containing one: 
>>> session = Session('c:/1116941914_surface-image1-left.png') 
>>> session.lims.id
1116941914
>>> session.folder
'1116941914_576323_20210721'
>>> session.is_ecephys
True
>>> session.rig.acq # hostnames reflect the computers used during the session, not necessarily the current machines
'W10DT05515'

# some properties are objects with richer information:
>>> session.mouse
Mouse(576323)
>>> session.project
Project('NeuropixelVisualBehavior')

# - `pathlib` objects for filesystem paths:
>>> session.lims_path.as_posix()
'//allen/programs/braintv/production/visualbehavior/prod0/specimen_1098595957/ecephys_session_1116941914'
>>> session.data_dict['es_id']
'1116941914'

# - `datetime` objects for easy date manipulation:
>>> session.date
datetime.date(2021, 7, 21)

# - dictionaries from lims (loaded lazily):
>>> session.mouse.lims
LIMS2MouseInfo(576323)
>>> session.mouse.lims.id
1098595957
>>> session.mouse.lims['full_genotype']
'wt/wt'

# with useful string representations:
>>> str(session.mouse)
'576323'
>>> str(session.project)
'NeuropixelVisualBehavior'
>>> str(session.rig)        # from `np_config` package
'NP.0'

```

## Adding a new project

- Add an enum with any project identifiers (e.g. lims project code) to
  `components.info.Projects`

- Create an entry for lims manifests (if applicable) in Zookeeper at
  `projects/np_session/manifests`
    - the D1 manifest will need customizing (see other entries)
    - the default D0 and D2 manifests will likely suffice: nothing needs
      to be done
