Skip to content

Commit 55b9e0e

Browse files
- updated instruction to install from pip
- added GitHub actions - updated licence in pyproject.toml
1 parent debb2eb commit 55b9e0e

File tree

3 files changed

+81
-9
lines changed

3 files changed

+81
-9
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Build release distributions
30+
run: |
31+
# NOTE: put your own distribution build steps here.
32+
python -m pip install build
33+
python -m build
34+
35+
- name: Upload distributions
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: release-dists
39+
path: dist/
40+
41+
pypi-publish:
42+
runs-on: ubuntu-latest
43+
needs:
44+
- release-build
45+
permissions:
46+
# IMPORTANT: this permission is mandatory for trusted publishing
47+
id-token: write
48+
49+
# Dedicated environments with protections for publishing are strongly recommended.
50+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
51+
environment:
52+
name: pypi
53+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
54+
url: https://pypi.org/project/features-from-dlc/
55+
#
56+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
57+
# ALTERNATIVE: exactly, uncomment the following line instead:
58+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
59+
60+
steps:
61+
- name: Retrieve release distributions
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: release-dists
65+
path: dist/
66+
67+
- name: Publish release distributions to PyPI
68+
uses: pypa/gh-action-pypi-publish@release/v1
69+
with:
70+
packages-dir: dist/

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# features_from_dlc
2+
3+
[![Python Version](https://img.shields.io/pypi/pyversions/features-from-dlc.svg)](https://pypi.org/project/features-from-dlc)
4+
[![PyPI](https://img.shields.io/pypi/v/features-from-dlc.svg)](https://pypi.org/project/features-from-dlc/)
5+
26
This repository contains a package called `features_from_dlc` that is used to compute and plot behavioral metrics from DeepLabCut tracking files.
37

48
You'll also find some utility scripts in the scripts folder, as well as separate notebooks (.ipynb files) in the notebooks directory.
59

610
Jump to :
711
- [Install instruction](#quick-start)
812
- [The `features_from_dlc` package](#the-features_from_dlc-package)
13+
- [Usage](#usage)
914

1015
## Installation
1116
To use the scripts and notebooks, you first need to install some things. If conda is already installed, ignore steps 1-2.
@@ -14,11 +19,6 @@ For more detailed instructions on how to install `conda`, see [this page](https:
1419

1520
1. Install [Miniforge](https://conda-forge.org/download/) (choose the latest version for your system) as user, add conda to PATH and make it the default interpreter.
1621
1. Open a terminal (PowerShell in Windows) and run `conda init`. Restart the terminal.
17-
1. Download the Source code zip (from Releases on the right), unzip and put it in a relevant location (eg. `~/programs` or whatever).
18-
1. Browse to this location from the terminal :
19-
```bash
20-
cd /path/to/the/smart/location/features-from-dlc
21-
```
2222
1. Create a virtual environment named "ffd" :
2323
```bash
2424
conda create -n ffd python=3.12
@@ -29,11 +29,13 @@ For more detailed instructions on how to install `conda`, see [this page](https:
2929
```
3030
1. Install the package and its dependencies :
3131
```bash
32-
pip install .
32+
pip install features-from-dlc
3333
```
3434

3535
You should be ready to use the scripts and notebooks ! To update, download the new release and perform steps 6 and 7.
3636

37+
To use the scripts, see the [Usage](#usage) section.
38+
3739
To use the notebooks, two options :
3840
- Use an IDE with Jupyter notebooks support such as [Visual Studio Code](https://code.visualstudio.com/download). Install the Python and Jupyter extensions (the squared pieces on the left panel). Open the notebook with vscode, on the top right you should be able to select a kernel : choose "ffd".
3941
- Use Jupyter directly in its web browser interface : from the terminal, activate the conda environment : `conda activate ffd`, then launch Jupyter : `jupyter lab /path/to/the/notebooks/notebook.ipynb`
@@ -43,7 +45,7 @@ To use the notebooks, two options :
4345
### Introduction
4446
This package is meant to be used to compute and display features from DeepLabCut (DLC) tracking files.
4547

46-
It will process a bunch of h5 or csv files created by DLC, computing so called "features" that are arbitrarily defined by the user and displaying them in nice graphs : time series with averages and errors, corresponding bar plots that quantifies a change during a specified epoch (typically, an optogenetic stimulation).
48+
It will process a bunch of h5 or csv files created by DLC, computing so called "features" that are arbitrarily defined by the user and displaying them in nice graphs : time series with averages and errors, corresponding bar plots that quantifies a change during a specified epoch (typically, an optogenetic stimulation), response delays and response rate.
4749
It is intended to be modular : the main module (`features_from_dlc.py`) merely loads DLC files, computes features, averages them per condition and plots them. So-called configuration files are plugged into it and specifies _how_ the features are computed from the bodyparts tracked in DLC.
4850
Anyone can write its own configuration file to compute any required features (such as speed, body angle, jaw opening, you name it), as long as the original syntax is respected.
4951

@@ -70,7 +72,7 @@ Note that after installation, the `features_from_dlc` package is installed insid
7072
It's easier to use as conda is nicely integrated and it is made easy to switch between environments.
7173
1. Install [vscode](https://code.visualstudio.com/download) (it does not require admin rights).
7274
1. Install Python extension (squared pieces in the left panel).
73-
1. Open the `scripts/ffd_quantify.py` script. In the bottom right corner, you should see a "conda" entry : click on it and select the ffd conda environment. To run the script, click on the Play item on the top right.
75+
1. Open the `scripts/ffd_quantify.py` script. In the bottom right corner, you should see a "conda" entry : click on it and select the ffd conda environment. To run the script, click on the Play icon on the top right.
7476

7577
#### Requirements
7678
You need to have tracked your video clips with DeepLabCut and saved the output files (either .h5 or .csv files). One file corresponds to one and only one trial, so you might need to split your original videos into several short clips around the stimulation onsets and offsets beforehand. This can be done with [`videocutter` program](https://github.com/TeamNCMC/videocutter). All files analyzed together must :

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description = "Behavioral quantification from DeepLabCut tracking"
66
readme = "README.md"
77
requires-python = ">=3.12"
88

9-
license = { text = "GPLv3" }
9+
license = { text = "MIT" }
1010

1111
classifiers = ["Programming Language :: Python :: 3.12"]
1212

0 commit comments

Comments
 (0)