Skip to content

Commit

Permalink
Add pre-commit config to standardize files (#42)
Browse files Browse the repository at this point in the history
* Add pre-commit config

* add formatted file

* Adapt pre-commit config

* Move PR template

* update ignore list for isort

* Ignore third_party for yapf

* Add yapfignore

* add yapf exclude rules

* update

* update pre commit

* Update pre commit config

* Standardize files with current pre-commit config
  • Loading branch information
stes authored Jul 12, 2023
1 parent d37e7f9 commit f3c4f0a
Show file tree
Hide file tree
Showing 56 changed files with 395 additions and 365 deletions.
File renamed without changes.
15 changes: 7 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build docs
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main
- public
- dev

Expand All @@ -25,7 +25,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Checkout cebra figures
- name: Checkout cebra figures
uses: actions/checkout@v3
with:
repository: AdaptiveMotorControlLab/cebra-figures
Expand All @@ -44,7 +44,7 @@ jobs:
cp -r assets/* .
rm -r assets
- name: Checkout cebra demos
- name: Checkout cebra demos
uses: actions/checkout@v3
with:
repository: AdaptiveMotorControlLab/cebra-demos
Expand All @@ -70,12 +70,12 @@ jobs:
export SPHINXOPTS="-W --keep-going -n"
make docs
# NOTE(stes): To avoid issues as observed in
# NOTE(stes): To avoid issues as observed in
# https://github.com/AdaptiveMotorControlLab/CEBRA/pull/20, we modified
# this workflow to not rely on PATs. All repos except for the website
# repo are public and only read access is required, so we simply removed
# the tokens from the checkout actions.
#
#
# For pushing the docs, I temporarily disabled the staging repo, which
# does not add anything informative to the contributor anyways, as it just
# tests whether or not docs can be pushed (the staging branch is not deployed).
Expand Down Expand Up @@ -108,5 +108,4 @@ jobs:
destination-repository-name: 'cebra-ai'
user-name: stes
user-email: [email protected]
target-branch: main

target-branch: main
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-toml
- repo: https://github.com/google/yapf
rev: v0.33.0
hooks:
- id: yapf
additional_dependencies:
- pyproject.toml
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
additional_dependencies:
- pyproject.toml
1 change: 1 addition & 0 deletions .yapfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
third_party/
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

When contributing a PR, please add the title, link and a short 1-2 line description of the
When contributing a PR, please add the title, link and a short 1-2 line description of the
PR to this document. If you are an external contributor, please also add your github handle.
You can use markdown formatting in this document.

Expand All @@ -19,8 +19,8 @@ in this file to the released code version using the name of the github tag (e.g.
Add ``ensemble_embeddings`` that aligns multiple embeddings and combine them into an averaged one.

- **Move `max_validation_iterations` from `cebra.CEBRA` to `cebra.metrics.infonce_loss` [#527](https://github.com/AdaptiveMotorControlLab/CEBRA-dev/pull/527)**:
Move `max_validation_iterations` from `cebra.CEBRA` to `cebra.metrics.infonce_loss` and
rename the variable to `num_batches`.
Move `max_validation_iterations` from `cebra.CEBRA` to `cebra.metrics.infonce_loss` and
rename the variable to `num_batches`.

- **Add `plot_consistency` and demo notebook [#502](https://github.com/AdaptiveMotorControlLab/CEBRA-dev/pull/502)**:
Add `plot_consistency` helper function and complete the corresponding notebook.
Expand Down Expand Up @@ -50,7 +50,7 @@ It is the official first release distributed along with the publication of the C
- **Add cebra.plot package [#385](https://github.com/stes/neural_cl/pull/385)**:
Simplify post-hoc analysis of model performance and embeddings by collecting plotting functions for the most common usecases.
- **Multisession API integration [#333](https://github.com/stes/neural_cl/pull/333)**:
Add multisession implementation compatibility to the sklearn API.
Add multisession implementation compatibility to the sklearn API.
- v0.0.2rc1
- **Implementation for general dataloading [#305](https://github.com/stes/neural_cl/pull/305)**:
Implement `load`, a general function to convert any supported data file types to ``numpy.array``.
Expand All @@ -59,7 +59,7 @@ It is the official first release distributed along with the publication of the C
- **Add quick testing option [#318](https://github.com/stes/neural_cl/pull/318)**:
Add slow marker for longer tests and a quick testing option for pytest and in github workflow.
- **Add CITATION.cff file [#339](https://github.com/stes/neural_cl/pull/339)**:
Add CITATION.cff file for easy-to-use citation of the pre-print paper.
Add CITATION.cff file for easy-to-use citation of the pre-print paper.
- **Update sklearn dependency [#317](https://github.com/stes/neural_cl/pull/317)**:
The sklearn dependency was updated to `scikit-learn` as discussed
[in the scikit-learn docs](https://github.com/scikit-learn/sklearn-pypi-package)
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ preferred-citation:
month: 05
doi: 10.1038/s41586-023-06031-6
issn: 1476-4687
url: https://doi.org/10.1038/s41586-023-06031-6
url: https://doi.org/10.1038/s41586-023-06031-6
2 changes: 1 addition & 1 deletion CLA.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For reference, or for printing and emailing or mailing the form it is reproduced

CLA Version as of March 17th, 2023.

Thank you for your interest in software from The Mathis Laboratory of
Thank you for your interest in software from The Mathis Laboratory of
Adaptive Motor Control, UPMWMATHIS ("Lab").
In order to clarify the intellectual property license
granted with Contributions from any person or entity, the Lab
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected] or [email protected].
reported by contacting the project team at [email protected] or [email protected].
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
36 changes: 18 additions & 18 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,60 @@ Steffen Schneider, Jin H Lee, Mackenzie W Mathis. 2023.
**Introduction**

- This license agreement sets forth the terms and conditions under which ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE ( EPFL),
CH-1015 Lausanne, Switzerland and Prof. Mackenzie W. Mathis and code authors (hereafter "LICENSOR") will grant you
CH-1015 Lausanne, Switzerland and Prof. Mackenzie W. Mathis and code authors (hereafter "LICENSOR") will grant you
(hereafter "LICENSEE") a fully-paid, non-exclusive, and non-transferable license for academic, non-commercial purposes only
(hereafter “LICENSE”) to use the "CEBRA" computer software program (hereafter "PROGRAM").

- LICENSEE acknowledges that the PROGRAM is a research tool that is being supplied "as is", without any related services,
improvements or warranties from LICENSOR and that this license is entered into in order to enable others to utilize the
PROGRAM in their academic activities.
PROGRAM in their academic activities.

- The ideas covered in this work is also patent pending (as of Jan 2023): US 63/302,670 “DIMENSIONALITY REDUCTION OF TIME-SERIES DATA,
- The ideas covered in this work is also patent pending (as of Jan 2023): US 63/302,670 “DIMENSIONALITY REDUCTION OF TIME-SERIES DATA,
AND SYSTEMS AND DEVICES THAT USE THE RESULTANT EMBEDDINGS”

- If this license is not appropriate for your application, please contact Prof. Mackenzie W. Mathis ([email protected])
and/or the TTO office at EPFL ([email protected]) for a commercial use license.

**Terms and Conditions of the LICENSE**
1. LICENSOR grants to LICENSEE a fully-paid up, non-exclusive, and non-transferable license to use the PROGRAM for academic,
non-commercial purposes, upon the terms and conditions hereinafter set out and until termination of this license as set
non-commercial purposes, upon the terms and conditions hereinafter set out and until termination of this license as set
forth below.

2. LICENSEE acknowledges the PROGRAM is provided "as is", without any related services or improvements from LICENSOR and
2. LICENSEE acknowledges the PROGRAM is provided "as is", without any related services or improvements from LICENSOR and
that the LICENSE is entered into in order to enable others to utilize the PROGRAM in their academic activities.

3. LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY REPRESENTATIONS OR
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR PARTICULAR PURPOSE OR THAT THE USE OF THE PROGRAM WILL NOT INFRINGE ANY
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR PARTICULAR PURPOSE OR THAT THE USE OF THE PROGRAM WILL NOT INFRINGE ANY
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. LICENSOR shall not be liable for any direct, indirect or consequential
damages with respect to any claim by LICENSEE or any third party arising from this Agreement or use of the PROGRAM.
4. LICENSEE agrees that it will use the PROGRAM, and any modifications, improvements, or derivatives to PROGRAM that
LICENSEE may create (collectively, "IMPROVEMENTS") solely for academic, non-commercial purposes and shall not

4. LICENSEE agrees that it will use the PROGRAM, and any modifications, improvements, or derivatives to PROGRAM that
LICENSEE may create (collectively, "IMPROVEMENTS") solely for academic, non-commercial purposes and shall not
distribute or transfer the PROGRAM or any IMPROVEMENTS to any person without prior written permission from LICENSOR.
Any IMPROVEMENTS must remain open source with a copy of this license. The terms "academic, non-commercial", as used
in this Agreement, mean academic or other scholarly research which (a) is not undertaken for profit, or (b) is not
in this Agreement, mean academic or other scholarly research which (a) is not undertaken for profit, or (b) is not
intended to produce works, services, or data for commercial use, or (c) is neither conducted, nor funded, by a person
or an entity engaged in the commercial use, application or exploitation of works similar to the PROGRAM.

5. LICENSEE agrees that they shall credit the use of CEBRA with an appropriate citation:
Steffen Schneider, Jin H. Lee, Mackenzie Weygandt Mathis. Learnable latent embeddings for joint behavioral
5. LICENSEE agrees that they shall credit the use of CEBRA with an appropriate citation:
Steffen Schneider, Jin H. Lee, Mackenzie Weygandt Mathis. Learnable latent embeddings for joint behavioral
and neural analysis. Nature 2023 doi: https://doi.org/10.1038/s41586-023-06031-6.

6. Ownership of all rights, including copyright in the PROGRAM and in any material associated therewith, shall at all times
remain with LICENSOR and LICENSEE agrees to preserve the same. LICENSEE agrees not to use any portion of the PROGRAM or
of any IMPROVEMENTS in any machine-readable form outside the PROGRAM, nor to make any copies except for its internal use,
remain with LICENSOR and LICENSEE agrees to preserve the same. LICENSEE agrees not to use any portion of the PROGRAM or
of any IMPROVEMENTS in any machine-readable form outside the PROGRAM, nor to make any copies except for its internal use,
without prior written consent of LICENSOR. LICENSEE agrees to maintain this license file with the source code and place the
following copyright notice on any such copies:
following copyright notice on any such copies:

© All rights reserved. ECOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE, Switzerland, Laboratory of Prof. Mackenzie W. Mathis
(UPMWMATHIS) and original authors: Steffen Schneider, Jin H Lee, Mackenzie W Mathis. 2023.

7. The LICENSE shall not be construed to confer any rights upon LICENSEE by implication or otherwise except as specifically
set forth herein.

8. This Agreement shall be governed by the material laws of Switzerland and any dispute arising out of this Agreement or
use of the PROGRAM shall be brought before the courts of Lausanne, Switzerland.
8. This Agreement shall be governed by the material laws of Switzerland and any dispute arising out of this Agreement or
use of the PROGRAM shall be brought before the courts of Lausanne, Switzerland.

9. This Agreement and the LICENSE shall remain effective until expiration of the copyrights of the PROGRAM except that,
9. This Agreement and the LICENSE shall remain effective until expiration of the copyrights of the PROGRAM except that,
upon any breach of this Agreement by LICENSEE, LICENSOR shall have the right to terminate the LICENSE immediately upon
notice to LICENSEE.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ build: dist

archlinux:
mkdir -p dist/arch
cp PKGBUILD dist/arch
cp dist/cebra-0.2.0.tar.gz dist/arch
cp PKGBUILD dist/arch
cp dist/cebra-0.2.0.tar.gz dist/arch
(cd dist/arch; makepkg --skipchecksums -f)

# NOTE(stes): Ensure that no old tempfiles are present. Ideally, move this into
Expand Down Expand Up @@ -83,7 +83,7 @@ format:
# https://github.com/PyCQA/docformatter/issues/119
# is resolved.
# docformatter --config pyproject.toml -i cebra
# docformatter --config pyproject.toml -i tests
# docformatter --config pyproject.toml -i tests
isort cebra/
isort tests/

Expand All @@ -99,4 +99,3 @@ report: check_docker format .coverage .pylint
coverage report

.PHONY: dist build archlinux clean_test test doctest test_parallel test_parallel_debug test_all test_fast test_debug test_benchmark interrogate docs docs-touch docs-strict serve_docs serve_page format codespell check_for_binary

7 changes: 3 additions & 4 deletions NOTICE.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This notice file contains license headers for all code files
# in the repository (currently all *.py files).
#
#
# When updating headers, lower entries take precedence over higher
# entries. For each header, include/exclude statements can be used
# to define files to apply them to.
#
# When adding code from an external repo, make sure to cover the
# When adding code from an external repo, make sure to cover the
# added code files with the correct license header.

# Main repository license
Expand All @@ -22,7 +22,6 @@
include:
- 'cebra/**/*.py'
- 'tests/**/*.py'
- 'tests/**/*.py'
- 'docs/**/*.py'
- 'conda/**/*.yml'

2 changes: 1 addition & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build() {

package() {
cd $srcdir/${_pkgname}-${pkgver}
pip install --ignore-installed --no-deps --root="${pkgdir}" dist/${_pkgname}-${pkgver}-py2.py3-none-any.whl
pip install --ignore-installed --no-deps --root="${pkgdir}" dist/${_pkgname}-${pkgver}-py2.py3-none-any.whl
find ${pkgdir} -iname __pycache__ -exec rm -r {} \; 2>/dev/null || echo
install -Dm 644 LICENSE.md $pkgdir/usr/share/licenses/${pkgname}/LICENSE
}
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">


<p align="center">
<img src="https://images.squarespace-cdn.com/content/v1/57f6d51c9f74566f55ecf271/6f3943a1-b76d-4674-9df9-87aebd33e517/cebralogo.png?format=2500w" width="95%">
Expand All @@ -11,7 +11,7 @@
[🛠️ Installation](https://cebra.ai/docs/installation.html) |
[🌎 Home Page](https://www.cebra.ai) |
[🚨 News](https://cebra.ai/docs/index.html) |
[🪲 Reporting Issues](https://github.com/AdaptiveMotorControlLab/CEBRA)
[🪲 Reporting Issues](https://github.com/AdaptiveMotorControlLab/CEBRA)


[![Downloads](https://static.pepy.tech/badge/cebra)](https://pepy.tech/project/cebra)
Expand All @@ -30,19 +30,19 @@

To receive updates on code releases, please 👀 watch or ⭐️ star this repository!

``cebra`` is a self-supervised method for non-linear clustering that allows for label-informed time series analysis.
``cebra`` is a self-supervised method for non-linear clustering that allows for label-informed time series analysis.
It can jointly use behavioral and neural data in a hypothesis- or discovery-driven manner to produce consistent, high-performance latent spaces. While it is not specific to neural and behavioral data, this is the first domain we used the tool in. This application case is to obtain a consistent representation of latent variables driving activity and behavior, improving decoding accuracy of behavioral variables over standard supervised learning, and obtaining embeddings which are robust to domain shifts.


# Reference
# Reference

- 📄 **Publication May 2023**:
[Learnable latent embeddings for joint behavioural and neural analysis.](https://doi.org/10.1038/s41586-023-06031-6)
Steffen Schneider*, Jin Hwa Lee* and Mackenzie Weygandt Mathis. Nature 2023.

- 📄 **Preprint April 2022**:
[Learnable latent embeddings for joint behavioral and neural analysis.](https://arxiv.org/abs/2204.00673)
Steffen Schneider*, Jin Hwa Lee* and Mackenzie Weygandt Mathis

# License
- CEBRA is released for academic use only (please read the license file). If this license is not appropriate for your application, please contact Prof. Mackenzie W. Mathis ([email protected]) for a commercial use license.
2 changes: 1 addition & 1 deletion cebra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/LICENSE.md
#
"""CEBRA is a library for estimating Consistent Embeddings of high-dimensional Recordings
"""CEBRA is a library for estimating Consistent Embeddings of high-dimensional Recordings
using Auxiliary variables. It contains self-supervised learning algorithms implemented in
PyTorch, and has support for a variety of different datasets common in biology and neuroscience.
"""
Expand Down
2 changes: 1 addition & 1 deletion cebra/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
It is non-specific to a particular dataset (see :py:mod:`cebra.datasets` for actual dataset
implementations). However, the base classes for all datasets are defined here, as well as helper
functions to interact with datasets.
CEBRA supports different dataset types out-of-the box:
- :py:class:`cebra.data.single_session.SingleSessionDataset` is the abstract base class for a single session dataset. Single session datasets
Expand Down
Loading

0 comments on commit f3c4f0a

Please sign in to comment.