Skip to content

Commit

Permalink
Fix tips and add jupyter lab to the environment (#75)
Browse files Browse the repository at this point in the history
* lint

* fix test for tips to return expected values

* clean README

* update codecov-action version

* bump release version

* add codecov token
  • Loading branch information
eberrigan authored Apr 12, 2024
1 parent 2f43876 commit f8baa7b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ jobs:
pytest --cov=sleap_roots --cov-report=xml tests/
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.python == 3.9 }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: false
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,16 @@ convex_hull = sr.convhull.get_convhull(pts)
Jupyter notebooks are located in this repo at `sleap-roots/notebooks`.

To use them, activate your conda environment which includes JupyterLab (recommended):

```
conda activate sleap-roots
```

Clone this repository if you haven't already:

```
git clone https://github.com/talmolab/sleap-roots.git && cd sleap-roots
```

Then you can change directories to the location of the notebooks, and open Jupyter Lab:

```
cd notebooks
jupyter lab
Expand Down
2 changes: 1 addition & 1 deletion sleap_roots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@

# Define package version.
# This is read dynamically by setuptools in pyproject.toml to determine the release version.
__version__ = "0.0.7"
__version__ = "0.0.8"
1 change: 0 additions & 1 deletion sleap_roots/tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ def get_tip_ys(tip_pts: np.ndarray) -> np.ndarray:
return tip_ys[0]

return tip_ys

11 changes: 8 additions & 3 deletions tests/test_tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,16 @@ def test_get_tip_ys_standard(pts_standard):

# test get_tip_ys with no tips
def test_get_tip_ys_no_tip(pts_no_tips):
# `pts_no_tips` is a 2x2x2 array with the second point in each frame being `np.nan`
# Get the tips from the no tips points
# `tips` should be [[np.nan, np.nan], [np.nan, np.nan]]
tips = get_tips(pts_no_tips)
assert tips.shape == (2, 2)
np.testing.assert_array_equal(tips, [[np.nan, np.nan], [np.nan, np.nan]])
# Get the tip y-coordinates
# `tip_ys` should be [np.nan, np.nan]
tip_ys = get_tip_ys(tips)
assert tip_ys.shape[0] == 2
np.testing.assert_almost_equal(tip_ys[1], np.nan, decimal=3)
assert type(tip_ys) == np.ndarray

tip_ys = get_tip_ys(tips[[0]])
np.testing.assert_almost_equal(tip_ys[0], np.nan, decimal=3)
assert type(tip_ys) == np.ndarray

0 comments on commit f8baa7b

Please sign in to comment.