xarray-behave 0.32.1__tar.gz → 0.32.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/.github/workflows/publish.yaml +16 -16
- xarray_behave-0.32.3/PKG-INFO +6 -0
- xarray_behave-0.32.3/README.md +11 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave/meta.yaml +4 -32
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-osxarm/build.sh +2 -5
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-osxarm/meta.yaml +13 -38
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/pyproject.toml +9 -7
- xarray_behave-0.32.3/setup.py +25 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/__init__.py +4 -1
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/annot.py +1 -1
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/app.py +22 -19
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/das.py +2 -3
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/das_make.yaml +2 -5
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/views.py +4 -4
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/xarray_behave.py +11 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/tests/test_assemble.py +13 -8
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/tests/test_assemble_metrics.py +14 -7
- xarray-behave-0.32.1/PKG-INFO +0 -57
- xarray-behave-0.32.1/README.md +0 -23
- xarray-behave-0.32.1/conda/Dockerfile +0 -21
- xarray-behave-0.32.1/conda/README.md +0 -8
- xarray-behave-0.32.1/conda/build.bat +0 -6
- xarray-behave-0.32.1/conda/build.sh +0 -6
- xarray-behave-0.32.1/conda/xarray-behave/bld.bat +0 -9
- xarray-behave-0.32.1/demo.ipynb +0 -567
- xarray-behave-0.32.1/demo_behavioral_features.ipynb +0 -713
- xarray-behave-0.32.1/env/xb.yml +0 -31
- xarray-behave-0.32.1/env/xb_gui.yml +0 -36
- xarray-behave-0.32.1/env/xb_gui_osxarm.yml +0 -39
- xarray-behave-0.32.1/setup.py +0 -49
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/.gitignore +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/LICENSE +0 -0
- {xarray-behave-0.32.1/conda/xarray-behave-osxarm → xarray_behave-0.32.3/conda/xarray-behave}/bld.bat +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave/build.sh +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave/conda_build_config.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-nogui/bld.bat +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-nogui/build.sh +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-nogui/conda_build_config.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-nogui/meta.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/conda/xarray-behave-osxarm/conda_build_config.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/event_utils.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/__init__.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/formbuilder.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/das_predict.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/das_train.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/envelope_computation.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/export_for_das.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/from_dir.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/from_file.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/from_zarr.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/forms/spec_freq.yaml +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/icon.png +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/table.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/gui/utils.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/__init__.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/annotations.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/annotations_manual.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/audio.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/balltracks.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/movieparams.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/poses.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/io/tracks.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/loaders.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/src/xarray_behave/metrics.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/tests/test_annot.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/tests/test_imports.py +0 -0
- {xarray-behave-0.32.1 → xarray_behave-0.32.3}/tests/test_io.py +0 -0
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
# runs-on: ${{ matrix.os }}
|
|
20
20
|
# strategy:
|
|
21
21
|
# matrix:
|
|
22
|
-
# python-version: [3.
|
|
22
|
+
# python-version: [3.8, 3.9, '3.10']
|
|
23
23
|
# os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
24
24
|
|
|
25
25
|
# steps:
|
|
@@ -88,7 +88,7 @@ jobs:
|
|
|
88
88
|
strategy:
|
|
89
89
|
fail-fast: False
|
|
90
90
|
matrix:
|
|
91
|
-
python-version: [3.
|
|
91
|
+
python-version: [3.8, 3.9, '3.10']
|
|
92
92
|
# python-version: [3.7]
|
|
93
93
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
94
94
|
# os: [ubuntu-latest, macOS-latest]
|
|
@@ -128,13 +128,13 @@ jobs:
|
|
|
128
128
|
conda config --set anaconda_upload yes
|
|
129
129
|
conda config --set always_yes yes --set changeps1 no
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
# - name: Build nogui and upload to anaconda (win)
|
|
132
|
+
# if: runner.os == 'Windows'
|
|
133
|
+
# shell: cmd /C CALL {0}
|
|
134
|
+
# run: |
|
|
135
|
+
# conda build conda/xarray-behave-nogui -c conda-forge -c ncb -c anaconda --python ${{ matrix.python-version }} --user ncb --token %ANACONDA_TOKEN%
|
|
136
|
+
# env:
|
|
137
|
+
# ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
|
|
138
138
|
|
|
139
139
|
- name: Build gui and upload to anaconda (win)
|
|
140
140
|
if: runner.os == 'Windows'
|
|
@@ -144,13 +144,13 @@ jobs:
|
|
|
144
144
|
env:
|
|
145
145
|
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
# - name: Build nogui and upload to anaconda (*x)
|
|
148
|
+
# if: runner.os != 'Windows'
|
|
149
|
+
# shell: bash -l {0}
|
|
150
|
+
# run: |
|
|
151
|
+
# conda mambabuild conda/xarray-behave-nogui -c conda-forge -c ncb -c anaconda --python ${{ matrix.python-version }} --user ncb --token $ANACONDA_TOKEN
|
|
152
|
+
# env:
|
|
153
|
+
# ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
|
|
154
154
|
|
|
155
155
|
- name: Build gui and upload to anaconda (*x)
|
|
156
156
|
if: runner.os != 'Windows'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# xarray-behave
|
|
2
|
+
|
|
3
|
+
Install a working conda installation (see [here](https://docs.conda.io/en/latest/miniconda.html)).
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
conda create -c ncb -c conda-forge -n xb python=3.8 xarray-behave
|
|
7
|
+
```
|
|
8
|
+
The GUI can be started by activating the new environment `conda activate xb` and then typing `xb` in a terminal. See `xb --help` for usage/arguments/keys.
|
|
9
|
+
GUI usage is documented [here](https://janclemenslab.org/das/tutorials_gui/tutorials_gui.html).
|
|
10
|
+
|
|
11
|
+
See `demo.ipynb` for usage examples.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{% set data = load_setup_py_data(setup_file='../../setup.py', from_recipe_dir=True) %}
|
|
2
|
-
{% set name =
|
|
2
|
+
{% set name = data.get('name') %}
|
|
3
3
|
{% set version = data.get('version') %}
|
|
4
|
-
# {% set version = "0.27.5" %}
|
|
5
4
|
|
|
6
5
|
package:
|
|
7
|
-
name:
|
|
6
|
+
name: "{{ name }}"
|
|
8
7
|
version: "{{ version }}"
|
|
9
8
|
|
|
10
9
|
source:
|
|
@@ -15,34 +14,10 @@ build:
|
|
|
15
14
|
|
|
16
15
|
requirements:
|
|
17
16
|
host:
|
|
18
|
-
-
|
|
19
|
-
- flammkuchen
|
|
20
|
-
- h5py
|
|
21
|
-
- librosa
|
|
22
|
-
- matplotlib
|
|
23
|
-
- matplotlib-scalebar
|
|
24
|
-
- pandas
|
|
25
|
-
- peakutils
|
|
17
|
+
- python {{ python }}
|
|
26
18
|
- pip
|
|
27
|
-
- python
|
|
28
|
-
- pyyaml
|
|
29
|
-
#- scipy
|
|
30
|
-
- scikit-learn
|
|
31
|
-
- zarr
|
|
32
|
-
- xarray
|
|
33
|
-
- dask
|
|
34
|
-
- pyside2
|
|
35
|
-
- pyqtgraph>0.12.2
|
|
36
|
-
- qtpy
|
|
37
|
-
- colorcet
|
|
38
|
-
- python-sounddevice
|
|
39
|
-
- scikit-image
|
|
40
|
-
- pyyaml
|
|
41
|
-
- pyvideoreader
|
|
42
|
-
- samplestamps
|
|
43
|
-
- numpy>1.19
|
|
44
|
-
|
|
45
19
|
run:
|
|
20
|
+
- python {{ python }}
|
|
46
21
|
- defopt
|
|
47
22
|
- flammkuchen
|
|
48
23
|
- h5py
|
|
@@ -51,9 +26,7 @@ requirements:
|
|
|
51
26
|
- matplotlib-scalebar
|
|
52
27
|
- pandas
|
|
53
28
|
- peakutils
|
|
54
|
-
- python
|
|
55
29
|
- pyyaml
|
|
56
|
-
#- scipy
|
|
57
30
|
- scikit-learn
|
|
58
31
|
- zarr
|
|
59
32
|
- xarray
|
|
@@ -66,7 +39,6 @@ requirements:
|
|
|
66
39
|
- scikit-image
|
|
67
40
|
- pyvideoreader
|
|
68
41
|
- samplestamps
|
|
69
|
-
- numpy>1.19
|
|
70
42
|
|
|
71
43
|
test:
|
|
72
44
|
imports:
|
|
@@ -4,9 +4,6 @@ export PIP_NO_INDEX=False
|
|
|
4
4
|
export PIP_NO_DEPENDENCIES=False
|
|
5
5
|
export PIP_IGNORE_INSTALLED=False
|
|
6
6
|
|
|
7
|
-
$PYTHON -m pip install pysoundfile -vv
|
|
8
|
-
# $PYTHON -m pip install pyside6
|
|
9
|
-
$PYTHON -m pip install pyside6 -vv
|
|
10
|
-
$PYTHON -m pip install opencv-python-headless -vv
|
|
11
|
-
# $PYTHON -m pip install pyvideoreader -vv --no-dependencies
|
|
7
|
+
# $PYTHON -m pip install pysoundfile -vv
|
|
8
|
+
# $PYTHON -m pip install pyside6 -vv
|
|
12
9
|
$PYTHON -m pip install xarray-behave[gui] -vv --no-dependencies
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{% set data = load_setup_py_data(setup_file='../../setup.py', from_recipe_dir=True) %}
|
|
2
2
|
{% set name = "xarray-behave" %}
|
|
3
|
-
{% set version = data.get('version') %}
|
|
3
|
+
# {% set version = data.get('version') %}
|
|
4
|
+
{% set version = '0.32.1' %}
|
|
4
5
|
|
|
5
6
|
package:
|
|
6
7
|
name: xarray-behave
|
|
@@ -9,43 +10,18 @@ package:
|
|
|
9
10
|
source:
|
|
10
11
|
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
|
|
11
12
|
|
|
13
|
+
|
|
12
14
|
build:
|
|
13
15
|
number: 0
|
|
14
16
|
|
|
15
17
|
requirements:
|
|
16
18
|
host:
|
|
17
|
-
- python
|
|
18
|
-
- zarr
|
|
19
|
-
- python-sounddevice
|
|
19
|
+
- python {{ python }}
|
|
20
20
|
- pip
|
|
21
|
-
- git
|
|
22
|
-
- colorcet
|
|
23
|
-
- pyyaml
|
|
24
|
-
- peakutils
|
|
25
|
-
- defopt
|
|
26
|
-
- pandas
|
|
27
|
-
- xarray
|
|
28
|
-
- h5py
|
|
29
|
-
- zarr
|
|
30
|
-
- dask
|
|
31
|
-
- flammkuchen
|
|
32
|
-
- toolz
|
|
33
|
-
- scikit-image
|
|
34
|
-
- samplestamps
|
|
35
|
-
- librosa
|
|
36
|
-
# test:
|
|
37
|
-
- pyqtgraph
|
|
38
|
-
- qtpy
|
|
39
|
-
# - pyside6
|
|
40
|
-
# - opencv-python-headless
|
|
41
|
-
# - pysoundfile
|
|
42
|
-
|
|
43
21
|
run:
|
|
44
|
-
- python
|
|
22
|
+
- python {{ python }}
|
|
45
23
|
- zarr
|
|
46
24
|
- python-sounddevice
|
|
47
|
-
- pip
|
|
48
|
-
- git
|
|
49
25
|
- colorcet
|
|
50
26
|
- pyyaml
|
|
51
27
|
- peakutils
|
|
@@ -59,20 +35,19 @@ requirements:
|
|
|
59
35
|
- toolz
|
|
60
36
|
- scikit-image
|
|
61
37
|
- samplestamps
|
|
62
|
-
-
|
|
63
|
-
|
|
38
|
+
- tqdm
|
|
39
|
+
- librosa>0.8
|
|
64
40
|
- pyqtgraph
|
|
65
|
-
- qtpy
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
41
|
+
- qtpy>2.0
|
|
42
|
+
- pyvideoreader
|
|
43
|
+
- pyqt
|
|
44
|
+
- pysoundfile
|
|
70
45
|
|
|
71
46
|
test:
|
|
72
47
|
imports:
|
|
73
48
|
- xarray_behave
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
commands:
|
|
50
|
+
- xb --help
|
|
76
51
|
|
|
77
52
|
about:
|
|
78
53
|
home: "http://github.com/janclemenslab/xarray-behave"
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["flit_core >=3"]
|
|
2
|
+
requires = ["flit_core >=3.2"]
|
|
3
3
|
build-backend = "flit_core.buildapi"
|
|
4
4
|
|
|
5
|
-
[
|
|
5
|
+
[project]
|
|
6
|
+
name = "xarray_behave"
|
|
6
7
|
dist-name = "xarray-behave"
|
|
7
8
|
module = "xarray_behave"
|
|
8
9
|
author = "Jan Clemens"
|
|
9
10
|
author-email = "clemensjan@googlemail.com"
|
|
10
11
|
home-page = "https://github.com/janclemenslab/xarray-behave"
|
|
11
12
|
classifiers = ["License :: OSI Approved :: MIT License"]
|
|
12
|
-
|
|
13
|
+
dynamic = ["version", "description"]
|
|
14
|
+
requires-python = ">3.6"
|
|
13
15
|
requires = ['numpy', 'scipy', 'xarray', 'h5py', 'zarr', 'flammkuchen',
|
|
14
16
|
'dask', 'toolz', 'samplestamps', 'pysoundfile', 'opencv-python-headless']
|
|
15
|
-
description-file = "README.md"
|
|
17
|
+
# description-file = "README.md"
|
|
16
18
|
|
|
17
|
-
[
|
|
18
|
-
gui = ['
|
|
19
|
+
[project.requires-extra]
|
|
20
|
+
gui = ['pyside6', 'pyqtgraph>0.12.2', 'pyvideoreader', 'qtpy',
|
|
19
21
|
'sounddevice', 'scikit-image', 'pyyaml', 'defopt', 'colorcet',
|
|
20
22
|
'peakutils']
|
|
21
23
|
|
|
22
|
-
[
|
|
24
|
+
[project.scripts]
|
|
23
25
|
xb = "xarray_behave.gui.app:cli"
|
|
24
26
|
|
|
25
27
|
[tool.pytest.ini_options]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
import codecs
|
|
3
|
+
import re
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def read(*parts):
|
|
10
|
+
with codecs.open(os.path.join(here, *parts), 'r') as fp:
|
|
11
|
+
return fp.read()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def find_version(*file_paths):
|
|
15
|
+
version_file = read(*file_paths)
|
|
16
|
+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
|
|
17
|
+
if version_match:
|
|
18
|
+
return version_match.group(1)
|
|
19
|
+
raise RuntimeError("Unable to find version string.")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
setup(
|
|
23
|
+
name='xarray-behave',
|
|
24
|
+
version=find_version("src/xarray_behave/__init__.py"),
|
|
25
|
+
)
|
|
@@ -460,7 +460,7 @@ class Events(UserDict):
|
|
|
460
460
|
"""
|
|
461
461
|
indices = self.select_range(name, t0, t1, strict)
|
|
462
462
|
self[name] = np.delete(self[name], indices, axis=0)
|
|
463
|
-
return
|
|
463
|
+
return indices
|
|
464
464
|
|
|
465
465
|
def find_next(self, t: float, names: Optional[List[str]] = None):
|
|
466
466
|
"""Find event starting after `t` of type in names.
|
|
@@ -40,11 +40,11 @@ from . import (utils,
|
|
|
40
40
|
try:
|
|
41
41
|
import numba
|
|
42
42
|
pg.setConfigOption('useNumba', True)
|
|
43
|
-
except:
|
|
43
|
+
except ImportError:
|
|
44
44
|
pass
|
|
45
45
|
|
|
46
46
|
try:
|
|
47
|
-
from . import das
|
|
47
|
+
from . import das # TODO lazy import
|
|
48
48
|
except Exception as e:
|
|
49
49
|
logging.exception(e)
|
|
50
50
|
logging.warning(f'Failed to import the das module.\nIgnore if you do not want to use das.\nOtherwise follow these instructions to install:\nhttps://janclemenslab.org/das/install.html')
|
|
@@ -1686,16 +1686,29 @@ class PSV(MainWindow):
|
|
|
1686
1686
|
|
|
1687
1687
|
def delete_current_events(self, qt_keycode):
|
|
1688
1688
|
if self.current_event_index is not None:
|
|
1689
|
-
deleted_events =
|
|
1690
|
-
deleted_events += self.event_times.delete_range(self.current_event_name,
|
|
1689
|
+
deleted_events = self.event_times.delete_range(self.current_event_name,
|
|
1691
1690
|
self.time0 / self.fs_song,
|
|
1692
1691
|
self.time1 / self.fs_song)
|
|
1693
|
-
|
|
1694
|
-
if
|
|
1695
|
-
|
|
1692
|
+
nb_deleted_events = len(deleted_events)
|
|
1693
|
+
if nb_deleted_events:
|
|
1694
|
+
logging.info(f' Deleted {nb_deleted_events} annotation(s) of type {self.current_event_name}.')
|
|
1695
|
+
if self.STOP:
|
|
1696
|
+
self.update_xy()
|
|
1696
1697
|
else:
|
|
1697
1698
|
logging.info(f' No event type selected. Not deleting anything.')
|
|
1698
1699
|
|
|
1700
|
+
def delete_all_events(self, qt_keycode):
|
|
1701
|
+
for event_name in self.event_times.names:
|
|
1702
|
+
deleted_events = self.event_times.delete_range(event_name,
|
|
1703
|
+
self.time0 / self.fs_song,
|
|
1704
|
+
self.time1 / self.fs_song)
|
|
1705
|
+
nb_deleted_events = len(deleted_events)
|
|
1706
|
+
if nb_deleted_events:
|
|
1707
|
+
logging.info(f' Deleted {nb_deleted_events} annotation(s) of type {event_name}.')
|
|
1708
|
+
|
|
1709
|
+
if self.STOP:
|
|
1710
|
+
self.update_xy()
|
|
1711
|
+
|
|
1699
1712
|
def threshold(self, qt_keycode):
|
|
1700
1713
|
if self.STOP and self.current_event_name is not None:
|
|
1701
1714
|
if self.event_times.categories[self.current_event_name] == 'event':
|
|
@@ -1738,16 +1751,6 @@ class PSV(MainWindow):
|
|
|
1738
1751
|
env = np.sqrt(np.convolve(self.y.astype(np.float)**2, win, mode='same'))
|
|
1739
1752
|
return env
|
|
1740
1753
|
|
|
1741
|
-
def delete_all_events(self, qt_keycode):
|
|
1742
|
-
deleted_events = 0
|
|
1743
|
-
for event_name in self.event_times.names:
|
|
1744
|
-
deleted_events += self.event_times.delete_range(event_name,
|
|
1745
|
-
self.time0 / self.fs_song,
|
|
1746
|
-
self.time1 / self.fs_song)
|
|
1747
|
-
logging.info(f' Deleted all {deleted_events} events in view.')
|
|
1748
|
-
if self.STOP:
|
|
1749
|
-
self.update_xy()
|
|
1750
|
-
|
|
1751
1754
|
def set_prev_channel(self, qt_keycode):
|
|
1752
1755
|
idx = self.cb2.currentIndex()
|
|
1753
1756
|
idx -= 1
|
|
@@ -2140,8 +2143,8 @@ class PSV(MainWindow):
|
|
|
2140
2143
|
|
|
2141
2144
|
deleted_name, deleted_time = self.event_times.delete_time(time=mouseT, name=current_event_name,
|
|
2142
2145
|
tol=0.05,
|
|
2143
|
-
min_time=
|
|
2144
|
-
max_time=
|
|
2146
|
+
min_time=self.time0 / self.fs_song,
|
|
2147
|
+
max_time=self.time1 / self.fs_song)
|
|
2145
2148
|
if len(deleted_time):
|
|
2146
2149
|
logging.info(f' Deleted {deleted_name} at t={deleted_time[0]:1.4f}:{deleted_time[1]:1.4f} seconds.')
|
|
2147
2150
|
self.update_xy()
|
|
@@ -164,9 +164,8 @@ def make(data_folder: str, store_folder: str,
|
|
|
164
164
|
file_split_dict = collections.defaultdict(lambda: None)
|
|
165
165
|
# parts = ['train', 'val', 'test']
|
|
166
166
|
|
|
167
|
-
|
|
168
167
|
if len(file_splits):
|
|
169
|
-
logger.info("Splitting data by files: {file_splits}.")
|
|
168
|
+
logger.info(f"Splitting data by files: {file_splits}.")
|
|
170
169
|
if sum(file_splits.values()) > 1.0:
|
|
171
170
|
raise ValueError('Sum of file splits > 1.0!')
|
|
172
171
|
|
|
@@ -177,7 +176,7 @@ def make(data_folder: str, store_folder: str,
|
|
|
177
176
|
file_splits['remainder'] = max(0, 1 - sum(file_splits.values()))
|
|
178
177
|
|
|
179
178
|
if block_stratify:
|
|
180
|
-
logger.info(" Block
|
|
179
|
+
logger.info(" Block stratification.")
|
|
181
180
|
annotation_files = [file_base + '_annotations.csv' for file_base in file_bases]
|
|
182
181
|
block_stats_map = das.block_stratify.blockstats_from_files(annotation_files)
|
|
183
182
|
block_stats = block_stats_map.values()
|
|
@@ -113,12 +113,9 @@ main:
|
|
|
113
113
|
"Block stratify":
|
|
114
114
|
- type: text
|
|
115
115
|
text: 'Stratification splits the data into blocks and distributes the blocks across the train/val/test sets such that
|
|
116
|
-
the class distribution is the same the train/val/test sets.<br />
|
|
116
|
+
the class distribution is the same in the train/val/test sets.<br />
|
|
117
117
|
Particularly important if the different song types are unevenly distributed in your data,
|
|
118
|
-
for instance syllable "YIP" only occurs in the first minute and syllable "YAP" in the second minute of audio.
|
|
119
|
-
<br />
|
|
120
|
-
NOTE: This currently only works if you split by samples, not by files.
|
|
121
|
-
'
|
|
118
|
+
for instance, if syllable "YIP" only occurs in the first minute and syllable "YAP" in the second minute of audio.'
|
|
122
119
|
- name: block_size
|
|
123
120
|
label: Block size (seconds)
|
|
124
121
|
type: double
|
|
@@ -521,9 +521,9 @@ class MovieView(utils.FastImageWidget):
|
|
|
521
521
|
if self.m.crop:
|
|
522
522
|
x_range, y_range = self.crop_frame(frame)
|
|
523
523
|
else:
|
|
524
|
-
x_range, y_range = [0, self.m.vr.
|
|
524
|
+
x_range, y_range = [0, self.m.vr.frame_height], [0, self.m.vr.frame_width]
|
|
525
525
|
else:
|
|
526
|
-
x_range, y_range = [0, self.m.vr.
|
|
526
|
+
x_range, y_range = [0, self.m.vr.frame_height], [0, self.m.vr.frame_width]
|
|
527
527
|
|
|
528
528
|
self.setImage(frame, auto_scale=True)
|
|
529
529
|
self.viewBox.setRange(xRange=y_range, yRange=x_range)
|
|
@@ -573,8 +573,8 @@ class MovieView(utils.FastImageWidget):
|
|
|
573
573
|
fly_pos = self.m.ds.body_positions.data[self.m.index_other, self.m.focal_fly, self.m.track_center_index]
|
|
574
574
|
fly_pos = np.array(fly_pos).astype(np.uintp) # in case this is a dask.array
|
|
575
575
|
# makes sure crop does not exceed frame bounds
|
|
576
|
-
fly_pos[0] = np.clip(fly_pos[0], self.m.box_size, self.m.vr.
|
|
577
|
-
fly_pos[1] = np.clip(fly_pos[1], self.m.box_size, self.m.vr.
|
|
576
|
+
fly_pos[0] = np.clip(fly_pos[0], self.m.box_size, self.m.vr.frame_height - 1 - self.m.box_size)
|
|
577
|
+
fly_pos[1] = np.clip(fly_pos[1], self.m.box_size, self.m.vr.frame_width - 1 - self.m.box_size)
|
|
578
578
|
x_range = (int(fly_pos[0] - self.m.box_size), int(fly_pos[0] + self.m.box_size))
|
|
579
579
|
y_range = (int(fly_pos[1] - self.m.box_size), int(fly_pos[1] + self.m.box_size))
|
|
580
580
|
# frame = frame[slice(*x_range), slice(*y_range), :] # now crop frame around the focal fly
|
|
@@ -84,10 +84,13 @@ def assemble(datename: Optional[str] = '', root: str = '', dat_path: str = 'dat'
|
|
|
84
84
|
if filepath_timestamps is None:
|
|
85
85
|
filepath_timestamps = Path(root, dat_path, datename, f'{datename}_timestamps.h5')
|
|
86
86
|
|
|
87
|
+
# Create samplestamps object
|
|
88
|
+
ss = None
|
|
87
89
|
if os.path.exists(filepath_daq) and os.path.exists(filepath_timestamps):
|
|
88
90
|
ss, last_sample_number, sampling_rate = ld.load_times(filepath_timestamps, filepath_daq)
|
|
89
91
|
if sampling_rate is None:
|
|
90
92
|
sampling_rate = audio_sampling_rate
|
|
93
|
+
path_tried = (filepath_daq, filepath_timestamps)
|
|
91
94
|
elif os.path.exists(filepath_video): # Video (+tracks) only
|
|
92
95
|
# if there is only the video, generate fake timestamps for video and samples from fps
|
|
93
96
|
from videoreader import VideoReader
|
|
@@ -101,6 +104,7 @@ def assemble(datename: Optional[str] = '', root: str = '', dat_path: str = 'dat'
|
|
|
101
104
|
sample_times = np.arange(0, vr.number_of_frames, 1 / sampling_rate) / vr.frame_rate
|
|
102
105
|
last_sample_number = len(sample_times)
|
|
103
106
|
ss = SampStamp(sample_times, frame_times)
|
|
107
|
+
path_tried = (filepath_video)
|
|
104
108
|
elif os.path.exists(filepath_daq) and not os.path.exists(filepath_timestamps): # Audio (+ annotations) only
|
|
105
109
|
# if there is no video and no timestamps - generate fake from samplerate and number of samples
|
|
106
110
|
# THIS SHOULD BE THE FIRST THING WE DO:
|
|
@@ -136,6 +140,13 @@ def assemble(datename: Optional[str] = '', root: str = '', dat_path: str = 'dat'
|
|
|
136
140
|
sample_numbers=sample_numbers, frame_numbers=frame_numbers)
|
|
137
141
|
except:
|
|
138
142
|
raise ValueError(f'Loading {audio_loader.path} using {audio_loader.NAME} failed.')
|
|
143
|
+
path_tried = (filepath_daq)
|
|
144
|
+
else:
|
|
145
|
+
raise ValueError(f'Nothing found at {(filepath_daq, filepath_video, filepath_timestamps)}.')
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if ss is None:
|
|
149
|
+
raise ValueError(f'No data found at {path_tried}.')
|
|
139
150
|
|
|
140
151
|
if filepath_timestamps_ball is None:
|
|
141
152
|
filepath_timestamps_ball = Path(root, dat_path, datename, f'{datename}_ball_timestamps.h5')
|
|
@@ -6,10 +6,17 @@ logging.getLogger().setLevel(logging.INFO)
|
|
|
6
6
|
recs = {
|
|
7
7
|
'rpi9-20210409_093149': {
|
|
8
8
|
'target_sampling_rate': 100, # from default of 1_000 to speed things up
|
|
9
|
+
'root': 'tests/data',
|
|
10
|
+
},
|
|
11
|
+
'localhost-20210617_113024': {
|
|
12
|
+
'root': 'tests/data',
|
|
13
|
+
},
|
|
14
|
+
'localhost-20181120_144618': {
|
|
15
|
+
'root': 'tests/data',
|
|
16
|
+
},
|
|
17
|
+
'localhost-20210624_104612': {
|
|
18
|
+
'root': 'tests/data',
|
|
9
19
|
},
|
|
10
|
-
'localhost-20210617_113024': {},
|
|
11
|
-
'localhost-20181120_144618': {},
|
|
12
|
-
'localhost-20210624_104612': {},
|
|
13
20
|
'localhost-20210628_145223': {
|
|
14
21
|
'dat_path': 'dat',
|
|
15
22
|
'res_path': 'res',
|
|
@@ -23,16 +30,14 @@ recs = {
|
|
|
23
30
|
'Dmel_male': {
|
|
24
31
|
'dat_path': 'dat',
|
|
25
32
|
'res_path': 'dat',
|
|
26
|
-
'
|
|
27
|
-
'filepath_daq': 'dat/Dmel_male.wav',
|
|
33
|
+
'filepath_daq': 'tests/data/dat/Dmel_male.wav',
|
|
28
34
|
'filepath_annotations': 'dat/Dmel_male_annotations.csv'
|
|
29
35
|
},
|
|
30
36
|
'Dmel_male2': {
|
|
31
37
|
'dat_path': 'dat',
|
|
32
38
|
'res_path': 'dat',
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'filepath_annotations': 'dat/Dmel_male_annotations.csv'
|
|
39
|
+
'filepath_daq': 'tests/data/dat/Dmel_male.npz',
|
|
40
|
+
'filepath_annotations': 'tests/data/dat/Dmel_male_annotations.csv'
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -4,12 +4,19 @@ import logging
|
|
|
4
4
|
logging.getLogger().setLevel(logging.INFO)
|
|
5
5
|
|
|
6
6
|
recs = {
|
|
7
|
-
'rpi9-20210409_093149': {
|
|
8
|
-
|
|
7
|
+
'rpi9-20210409_093149': {
|
|
8
|
+
'root': 'tests/data',
|
|
9
|
+
},
|
|
10
|
+
'localhost-20210617_113024': {
|
|
11
|
+
'root': 'tests/data',
|
|
12
|
+
},
|
|
9
13
|
'localhost-20181120_144618': {
|
|
10
14
|
'target_sampling_rate': 100, # from default of 1_000 to speed things up
|
|
15
|
+
'root': 'tests/data',
|
|
16
|
+
},
|
|
17
|
+
'localhost-20210624_104612': {
|
|
18
|
+
'root': 'tests/data',
|
|
11
19
|
},
|
|
12
|
-
'localhost-20210624_104612': {},
|
|
13
20
|
'localhost-20210628_145223': {
|
|
14
21
|
'dat_path': 'dat',
|
|
15
22
|
'res_path': 'res',
|
|
@@ -24,15 +31,15 @@ recs = {
|
|
|
24
31
|
'dat_path': 'dat',
|
|
25
32
|
'res_path': 'dat',
|
|
26
33
|
'root': 'tests/data',
|
|
27
|
-
'filepath_daq': 'dat/Dmel_male.wav',
|
|
28
|
-
'filepath_annotations': 'dat/Dmel_male_annotations.csv'
|
|
34
|
+
'filepath_daq': 'tests/data/dat/Dmel_male.wav',
|
|
35
|
+
'filepath_annotations': 'tests/data/dat/Dmel_male_annotations.csv'
|
|
29
36
|
},
|
|
30
37
|
'Dmel_male2': {
|
|
31
38
|
'dat_path': 'dat',
|
|
32
39
|
'res_path': 'dat',
|
|
33
40
|
'root': 'tests/data',
|
|
34
|
-
'filepath_daq': 'dat/Dmel_male.npz',
|
|
35
|
-
'filepath_annotations': 'dat/Dmel_male_annotations.csv'
|
|
41
|
+
'filepath_daq': 'tests/data/dat/Dmel_male.npz',
|
|
42
|
+
'filepath_annotations': 'tests/data/dat/Dmel_male_annotations.csv'
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
|
xarray-behave-0.32.1/PKG-INFO
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xarray-behave
|
|
3
|
-
Version: 0.32.1
|
|
4
|
-
Summary: xarray tools for behavioral data.
|
|
5
|
-
Home-page: https://github.com/janclemenslab/xarray-behave
|
|
6
|
-
Author: Jan Clemens
|
|
7
|
-
Author-email: clemensjan@googlemail.com
|
|
8
|
-
Requires-Python: >=3.6
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Requires-Dist: numpy
|
|
12
|
-
Requires-Dist: scipy
|
|
13
|
-
Requires-Dist: xarray
|
|
14
|
-
Requires-Dist: h5py
|
|
15
|
-
Requires-Dist: zarr
|
|
16
|
-
Requires-Dist: flammkuchen
|
|
17
|
-
Requires-Dist: dask
|
|
18
|
-
Requires-Dist: toolz
|
|
19
|
-
Requires-Dist: samplestamps
|
|
20
|
-
Requires-Dist: pysoundfile
|
|
21
|
-
Requires-Dist: opencv-python-headless
|
|
22
|
-
Requires-Dist: pyside2 ; extra == "gui"
|
|
23
|
-
Requires-Dist: pyqtgraph>0.12.2 ; extra == "gui"
|
|
24
|
-
Requires-Dist: pyvideoreader ; extra == "gui"
|
|
25
|
-
Requires-Dist: qtpy ; extra == "gui"
|
|
26
|
-
Requires-Dist: sounddevice ; extra == "gui"
|
|
27
|
-
Requires-Dist: scikit-image ; extra == "gui"
|
|
28
|
-
Requires-Dist: pyyaml ; extra == "gui"
|
|
29
|
-
Requires-Dist: defopt ; extra == "gui"
|
|
30
|
-
Requires-Dist: colorcet ; extra == "gui"
|
|
31
|
-
Requires-Dist: peakutils ; extra == "gui"
|
|
32
|
-
Provides-Extra: gui
|
|
33
|
-
|
|
34
|
-
# xarray-behave
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
37
|
-
Install a working conda installation with python 3.7 (see [here](https://docs.conda.io/en/latest/miniconda.html)). If you have conda already installed, make sure you have conda v4.8.4+, You can update conda from an older version with `conda update conda`.
|
|
38
|
-
|
|
39
|
-
If you want to use xb with DAS, follow the [installation instructions for DAS](https://janclemenslab.org/das/install.html).
|
|
40
|
-
The [DAS docs](https://janclemenslab.org/das) also contain instructions on annotating audio recordings using the GUI.
|
|
41
|
-
|
|
42
|
-
### GUI
|
|
43
|
-
For using with the GUI:
|
|
44
|
-
```shell
|
|
45
|
-
conda create -c ncb -c conda-forge -n xb python=3.8 xarray-behave
|
|
46
|
-
```
|
|
47
|
-
The GUI can be started by activating the new environment `conda activate xb` and then typing `xb` in a terminal. See `xb --help` for usage/arguments/keys.
|
|
48
|
-
GUI usage is documented [here](https://janclemenslab.org/das/tutorials_gui/tutorials_gui.html).
|
|
49
|
-
|
|
50
|
-
### Non-GUI
|
|
51
|
-
If you do not want to use the GUI, e.g. if just want to create, load, save datasets:
|
|
52
|
-
```shell
|
|
53
|
-
conda create -c ncb -c conda-forge -n xb python=3.8 xarray-behave-nogui
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
See `demo.ipynb` for usage examples.
|
|
57
|
-
|