A Python wrapper for the CatGt command-line tool
Project description
purrito
A Python wrapper for CatGt, providing a human-readable interface to generate command-line arguments for the CatGt tool.
Overview
CatGt is a command-line tool for preprocessing SpikeGLX data from Neuropixels probes. This wrapper simplifies the process of creating CatGt commands by allowing users to specify options in Python.
Installation
pip install purrito-catgt-wrapper
Import it in Python as:
from purrito import CatGt
For development:
pip install -e .
Usage
Basic Example
from purrito import CatGt
# Create a CatGt instance with basic parameters
catgt = CatGt(
basepath="/path/to/data",
run="g0",
gate=0,
trigger=0
)
# Check the command that will be executed
catgt.dry_run()
# Output: CatGt -dir=/path/to/data -run=g0 -g=0 -t=0
# Run catgt
catgt.run()
# Generate the command line string
Advanced Example with Options
from purrito import CatGt
# Create a CatGt instance with preprocessing options
catgt = CatGt(
basepath="/data/neuropixels",
run="g0",
gate=0,
trigger=0,
ap=True, # Process AP band
lf=True, # Process LF band
prb=0, # Probe index
prb_fld=True, # Probe folder
dest="/data/processed", # Output destination
)
cmd = catgt.build_command()
print(cmd)
Using with subprocess
import subprocess
from purrito import CatGt
catgt = CatGt(
basepath="/data/test",
run="g0",
gate=0,
ap=True
)
# Get command as list for subprocess
args = catgt.get_command_args(catgt_path="/usr/local/bin/CatGt")
# Run the command
# subprocess.run(args)
Features
- Intuitive Python API: Specify options using Python arguments
- Flexible Options: Support for boolean flags, string values, numeric values, and lists
- Native CatGt Flags: Uses CatGt's underscore-based option names such as
prb_fld - Path Handling: Automatically converts relative paths to absolute paths
- Command Generation: Generate command strings for direct use or subprocess execution
API Reference
CatGt Class
CatGt(basepath, run=None, gate=None, trigger=None, catgt_path="CatGt", **options)
Parameters:
basepath(str): Base directory path containing the SpikeGLX datarun(str, optional): Run name (e.g., "g0", "g0_t0"). If omitted, it is inferred frombasepathgate(int, optional): Gate indextrigger(int, optional): Trigger indexcatgt_path(str, optional): Path to the CatGt executable. Defaults toCatGt**options: Additional CatGt options as keyword arguments
Methods:
build_command(catgt_path="CatGt"): Build the complete command line stringget_command_args(catgt_path="CatGt"): Get command and arguments as a list for subprocess
Testing
Run tests using unittest:
python -m unittest discover tests
Or with pytest (if installed):
pytest tests/
Releasing to PyPI
This package is automatically published to PyPI when a new GitHub release is created. To create a new release:
-
Update the version number in:
purrito/__init__.py
-
Create a new GitHub release:
- Go to the repository's Releases page
- Click "Draft a new release"
- Create a new tag (e.g.,
v0.1.1) - Fill in the release title and description
- Click "Publish release"
-
The GitHub Actions workflow will automatically:
- Build the package
- Run quality checks
- Publish to PyPI
PyPI Setup (One-time)
Before the first release, you need to configure PyPI trusted publishing:
- Go to PyPI and create an account if you don't have one
- Create the
purrito-catgt-wrapperproject on PyPI (or wait for the first upload) - Go to your project's settings on PyPI
- Under "Publishing", add a new "trusted publisher"
- Configure it with:
- Owner:
eliezyer - Repository:
purrito - Workflow:
publish-to-pypi.yml - Environment: (leave empty)
- Owner:
This allows GitHub Actions to publish directly to PyPI without needing API tokens.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Developed in Rajasethupathy Lab
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file purrito_catgt_wrapper-0.1.0.tar.gz.
File metadata
- Download URL: purrito_catgt_wrapper-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89a4154968621644b92df31f2e4fc777d6c08bb1306b18334bc643a1f272dd9c
|
|
| MD5 |
9703d890e85f055419efd822bc16c1bc
|
|
| BLAKE2b-256 |
5d5f2590b2b20ee5a9b0c7489038be2c4413f0e9d65829a6895fa060d7252a3f
|
Provenance
The following attestation bundles were made for purrito_catgt_wrapper-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on eliezyer/purrito
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purrito_catgt_wrapper-0.1.0.tar.gz -
Subject digest:
89a4154968621644b92df31f2e4fc777d6c08bb1306b18334bc643a1f272dd9c - Sigstore transparency entry: 1098216174
- Sigstore integration time:
-
Permalink:
eliezyer/purrito@3fb35c28581bf1ea1b43f9d033834df3ab2fed5b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eliezyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3fb35c28581bf1ea1b43f9d033834df3ab2fed5b -
Trigger Event:
release
-
Statement type:
File details
Details for the file purrito_catgt_wrapper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: purrito_catgt_wrapper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae5cb1783ce5a38a1ff80d806cee4b7e1e15a1b711226e46ca028122a0fd10c9
|
|
| MD5 |
2c8750fb4a2f36984cad47df91f77339
|
|
| BLAKE2b-256 |
df1d90e865aa4ddb93e9116dcc24ddcfc41ebf3294f1e6557a05eec91347e787
|
Provenance
The following attestation bundles were made for purrito_catgt_wrapper-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on eliezyer/purrito
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purrito_catgt_wrapper-0.1.0-py3-none-any.whl -
Subject digest:
ae5cb1783ce5a38a1ff80d806cee4b7e1e15a1b711226e46ca028122a0fd10c9 - Sigstore transparency entry: 1098216175
- Sigstore integration time:
-
Permalink:
eliezyer/purrito@3fb35c28581bf1ea1b43f9d033834df3ab2fed5b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eliezyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3fb35c28581bf1ea1b43f9d033834df3ab2fed5b -
Trigger Event:
release
-
Statement type: