Metadata-Version: 2.5
Name: datapipe-neuro
Version: 0.2.1
Summary: Dataset-aware pipeline for filing, registering, segmenting and compressing acquisition data.
Project-URL: Homepage, https://github.com/larsrollik/datapipe
Project-URL: Documentation, https://larsrollik.github.io/datapipe/
Project-URL: Issue Tracker, https://github.com/larsrollik/datapipe/issues
Author-email: "Lars B. Rollik" <lars@rollik.me>
License: 
        Copyright (c) 2026-present Lars B. Rollik. All rights reserved.
        
        Permission is granted, free of charge, to use, copy, modify, and distribute
        this software and associated documentation files (the "Software") for
        non-commercial research or academic purposes only, subject to the following
        conditions:
        
        1. This copyright notice and permission notice must be included in all copies
           or substantial portions of the Software.
        
        2. Any publication, presentation, or product that uses or builds upon the
           Software must give clear attribution to the original work and its authors.
        
        3. Commercial use is prohibited without a separate written commercial licence
           agreement with the copyright holder. Commercial use means incorporation of
           the Software into anything for which fees or other compensation are charged
           or received, including commercial products and commercial services.
        
        4. No patent licence, express or implied, is granted under these terms. Any
           use that would require a patent licence from the copyright holder requires
           a separate written agreement.
        
        5. Redistribution, in source or binary form, is permitted only for
           non-commercial purposes and must retain this notice unmodified.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
        DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR DEALINGS IN THE SOFTWARE.
        
        For commercial or patent licensing enquiries contact: lars@rollik.me
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: numpy>=1.24
Requires-Dist: pyyaml>=6
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material; extra == 'docs'
Description-Content-Type: text/markdown

# datapipe

Dataset-aware pipeline for filing, registering, segmenting and compressing acquisition data.

Each stage operates on **one sample or session per invocation**, so the unit of work is also the
unit of failure: a stage that cannot establish what it is looking at refuses rather than guessing,
and nothing is moved until its identity has been confirmed.

## Installation

```sh
pip install datapipe-neuro
```

The distribution is `datapipe-neuro`; the import name and the CLI are both `datapipe`. An unrelated
`datapipe` project already holds that name on PyPI.

Individual stages need tools that are deliberately **not** install-time dependencies, because most
runs use only one stage: `register` and `segment` need `brainreg` and
`brainglobe-segmentation`, and `compress` shells out to the [`datapack`](https://github.com/larsrollik/datapack)
CLI (`datapack-neuro`) rather than importing it.

## Stages

| Command | What it does |
|---|---|
| `datapipe register <sample>` | brainreg-registers one serial-section sample, writing output beside the stitched directories |
| `datapipe segment <sample>` | opens napari and brainglobe-segmentation preloaded on that sample's registration |
| `datapipe compress <sample> <dest>` | compresses one sample's raw and analysis trees via datapack into `dest/<sample>` |
| `datapipe place <path>` | files one scan or session into a data tree, refusing on identity mismatch |
| `datapipe splits <root>` | finds acquisitions the recorder broke in two, and tells them from false starts |

### place

`place` routes on what the directory *is*, not on a flag you have to remember: a serial-section
scan is repacked into the tree, while an acquisition session is moved, because compression is an
earlier stage and has already run by the time anything is placed.

The subject is checked against the directory's own record and a **mismatch is refused, not
warned about**. For an acquisition session that record is the full directory prefix, not its middle
field. A histology run that holds more than one brain carries every id in its name, and is split
per animal afterwards.

### splits

A recording broken in two by a crash and a false start followed by a real recording look alike on
disk: two acquisitions, minutes apart, same subject. `splits` separates them on the gap between
them and on how much each half contains, reporting its reasoning per candidate rather than only a
verdict. Durations come from the sample counts in the `.npy` sidecars — the array shape is read,
never the array — so a 400 GB recording is classified without being loaded.

## Licence

Non-commercial research and academic use. See [LICENSE](LICENSE); commercial use requires a separate
written agreement.
