xarray-behave 0.35.1__tar.gz → 0.35.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.35.1 → xarray-behave-0.35.3}/.github/workflows/publish.yaml +2 -1
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/PKG-INFO +1 -1
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/conda/xarray-behave/meta.yaml +2 -1
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/__init__.py +2 -1
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/annot.py +9 -7
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/event_utils.py +7 -3
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/app.py +5 -17
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/das.py +9 -2
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/formbuilder.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/audio.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/balltracks.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/movieparams.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/poses.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/loaders.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/metrics.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/xarray_behave.py +1 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/.gitignore +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/LICENSE +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/README.md +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/build_env.yml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/conda/xarray-behave/bld.bat +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/conda/xarray-behave/build.sh +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/conda/xarray-behave/conda_build_config.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/condarc.yml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/doc/demo.ipynb +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/doc/demo_behavioral_features.ipynb +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/doc/demo_behavioral_features_large_group.ipynb +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/doc/ncb.mplstyle +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/pyproject.toml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/setup.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/__init__.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/audio_player.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/das_make.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/das_predict.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/das_train.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/envelope_computation.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/export_for_das.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/from_dir.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/from_file.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/from_zarr.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/spec_freq.yaml +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/icon.png +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/table.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/utils.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/view_dialog.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/views.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/widgets.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/__init__.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/annotations.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/annotations_manual.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/timestamps.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/io/tracks.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/tests/test_annot.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/tests/test_assemble.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/tests/test_assemble_metrics.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/tests/test_imports.py +0 -0
- {xarray-behave-0.35.1 → xarray-behave-0.35.3}/tests/test_io.py +0 -0
|
@@ -19,8 +19,9 @@ jobs:
|
|
|
19
19
|
strategy:
|
|
20
20
|
fail-fast: False
|
|
21
21
|
matrix:
|
|
22
|
-
python-version: [3.9 , '3.10'
|
|
22
|
+
python-version: [3.9 , '3.10', '3.11']
|
|
23
23
|
os: [ubuntu-latest, windows-latest, macOS-13, macOS-14]
|
|
24
|
+
# os: [macOS-13, macOS-14]
|
|
24
25
|
# python-version: ['3.11']
|
|
25
26
|
# os: [ubuntu-latest]
|
|
26
27
|
defaults: # https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
|
|
@@ -35,7 +35,8 @@ requirements:
|
|
|
35
35
|
- xarray
|
|
36
36
|
- dask
|
|
37
37
|
#- py
|
|
38
|
-
- conda-forge::pyside6 # [
|
|
38
|
+
- conda-forge::pyside6 # [linux]
|
|
39
|
+
- conda-forge::pyside2 # [osx or arm64]
|
|
39
40
|
- pyside6 # [win and py==310]
|
|
40
41
|
- pyside2 # [win and py>310]
|
|
41
42
|
- pyside2 # [win and py==39]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TODO: From/to traces
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import numpy as np
|
|
6
7
|
import xarray as xr
|
|
7
8
|
import pandas as pd
|
|
@@ -132,19 +133,20 @@ class Events(UserDict):
|
|
|
132
133
|
names = []
|
|
133
134
|
start_seconds = []
|
|
134
135
|
stop_seconds = []
|
|
135
|
-
|
|
136
136
|
if len(dct.values()):
|
|
137
|
-
if
|
|
137
|
+
# check if there are annotations and if so, if they comes with channel information
|
|
138
|
+
if list(dct.values())[0].ndim > 1 and list(dct.values())[0].shape[1] > 2:
|
|
138
139
|
channels = []
|
|
139
140
|
else:
|
|
140
141
|
channels = None
|
|
141
142
|
|
|
142
143
|
for k, v in dct.items():
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
channels
|
|
144
|
+
if len(v): # check if there are annotations
|
|
145
|
+
names.extend([k] * v.shape[0])
|
|
146
|
+
start_seconds.extend(v[:, 0])
|
|
147
|
+
stop_seconds.extend(v[:, 1])
|
|
148
|
+
if channels is not None:
|
|
149
|
+
channels.extend(v[:, 2])
|
|
148
150
|
out = cls.from_lists(names, start_seconds, stop_seconds, channels=channels)
|
|
149
151
|
return out
|
|
150
152
|
|
|
@@ -2,6 +2,7 @@ import logging
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
import xarray as xr
|
|
4
4
|
import pandas as pd
|
|
5
|
+
import scipy
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
logger = logging.getLogger(__name__)
|
|
@@ -182,14 +183,14 @@ def eventtimes_to_traces(ds, event_times):
|
|
|
182
183
|
return ds
|
|
183
184
|
|
|
184
185
|
|
|
185
|
-
def traces_to_eventtimes(traces, event_names, event_categories):
|
|
186
|
+
def traces_to_eventtimes(traces, event_names, event_categories, events_are_binary: bool = True):
|
|
186
187
|
"""[summary]
|
|
187
188
|
|
|
188
189
|
Args:
|
|
189
190
|
traces ([type]): list of numpy arrays with the binary traces for each event/segment
|
|
190
191
|
event_names ([type]): [description]
|
|
191
192
|
event_categories ([type]): [description]
|
|
192
|
-
|
|
193
|
+
events_are_binary (bool, True): detect events indices where value is 1.0. Otherwise use scipy.signal.find_peaks.
|
|
193
194
|
Returns:
|
|
194
195
|
[type]: [description]
|
|
195
196
|
"""
|
|
@@ -202,7 +203,10 @@ def traces_to_eventtimes(traces, event_names, event_categories):
|
|
|
202
203
|
for event_idx, (event_name, event_category) in enumerate(zip(event_names, event_categories)):
|
|
203
204
|
logger.info(f" {event_name}")
|
|
204
205
|
if event_category == "event":
|
|
205
|
-
|
|
206
|
+
if events_are_binary:
|
|
207
|
+
event_times[event_name] = np.where(traces[event_idx] == 1)[0]
|
|
208
|
+
else:
|
|
209
|
+
event_times[event_name], _ = scipy.signal.find_peaks(traces[event_idx])
|
|
206
210
|
elif event_category == "segment":
|
|
207
211
|
tmp = (traces[event_idx] == 1).astype(float) # makes this more robust
|
|
208
212
|
onsets = np.where(np.diff(tmp) == 1)[0]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`python -m xarray_behave.ui datename root`
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import os
|
|
6
7
|
import sys
|
|
7
8
|
import logging
|
|
@@ -2302,14 +2303,6 @@ class PSV(MainWindow):
|
|
|
2302
2303
|
f" Moved {event_name_to_move} from t=[{region.bounds[0]:1.4f}:{region.bounds[1]:1.4f}] to [{new_region[0]:1.4f}:{new_region[1]:1.4f}] seconds."
|
|
2303
2304
|
)
|
|
2304
2305
|
|
|
2305
|
-
mp = self.annot_view.mousePoint.y()
|
|
2306
|
-
if mp > 0 and mp < 1:
|
|
2307
|
-
new_event_idx = int(mp * self.nb_eventtypes)
|
|
2308
|
-
new_event_name = self.event_times.names[new_event_idx]
|
|
2309
|
-
_, old_name, new_name = self.event_times.change_name(new_region[0], new_event_name)
|
|
2310
|
-
if old_name is not None:
|
|
2311
|
-
logger.info(f" Changed from {old_name} to {new_name}.")
|
|
2312
|
-
|
|
2313
2306
|
self.update_xy()
|
|
2314
2307
|
|
|
2315
2308
|
def on_position_change_finished(self, position):
|
|
@@ -2324,15 +2317,6 @@ class PSV(MainWindow):
|
|
|
2324
2317
|
self.event_times.move_time(event_name_to_move, position.position, new_position)
|
|
2325
2318
|
logger.info(f" Moved {event_name_to_move} from t={position.position:1.4f} to {new_position:1.4f} seconds.")
|
|
2326
2319
|
|
|
2327
|
-
mp = self.annot_view.mousePoint.y()
|
|
2328
|
-
if mp > 0 and mp < 1:
|
|
2329
|
-
new_event_idx = int(mp * self.nb_eventtypes)
|
|
2330
|
-
new_event_name = self.event_times.names[new_event_idx]
|
|
2331
|
-
print(new_event_name)
|
|
2332
|
-
_, old_name, new_name = self.event_times.change_name(new_position, new_event_name, tol=1)
|
|
2333
|
-
if old_name is not None:
|
|
2334
|
-
logger.info(f" Changed from {old_name} to {new_name}.")
|
|
2335
|
-
|
|
2336
2320
|
self.update_xy()
|
|
2337
2321
|
|
|
2338
2322
|
def on_position_dragged(self, fly, pos, offset):
|
|
@@ -2807,3 +2791,7 @@ def cli():
|
|
|
2807
2791
|
logger.getLogger().setLevel(logging.INFO)
|
|
2808
2792
|
|
|
2809
2793
|
defopt.run(main, show_defaults=False)
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
if __name__ == "__main__":
|
|
2797
|
+
main_das()
|
|
@@ -8,6 +8,7 @@ import zarr
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
import pandas as pd
|
|
10
10
|
import librosa
|
|
11
|
+
import scipy
|
|
11
12
|
import h5py
|
|
12
13
|
|
|
13
14
|
import das.make_dataset as dsm
|
|
@@ -408,8 +409,14 @@ def make(
|
|
|
408
409
|
names = store.attrs["class_names"][1:] # [1:] ignore the noise class
|
|
409
410
|
types = store.attrs["class_types"][1:]
|
|
410
411
|
for key in store.keys():
|
|
411
|
-
ann = event_utils.traces_to_eventtimes(store[key]["y"][:, 1:].T, names, types)
|
|
412
|
-
|
|
412
|
+
ann = event_utils.traces_to_eventtimes(store[key]["y"][:, 1:].T, names, types, events_are_binary=False)
|
|
413
|
+
for k, v in ann.items():
|
|
414
|
+
if (
|
|
415
|
+
v.ndim == 1
|
|
416
|
+
): # add start/stop seconds for events - traces_to_eventtimes only returns event start times but annot expects both start and end
|
|
417
|
+
v = np.stack((v, v)).T
|
|
418
|
+
v = v / fs # convert indices to seconds
|
|
419
|
+
ann[k] = v
|
|
413
420
|
ev = annot.Events.from_dict(ann)
|
|
414
421
|
ev.to_df().to_csv(os.path.join(store.attrs["store_folder"], key, "x_annotations.csv"))
|
|
415
422
|
logger.info("The dataset has been made.")
|
|
@@ -26,6 +26,7 @@ is :py:method:`FormBuilderLayout.add_item()`. Look there if you want to know
|
|
|
26
26
|
what's supported in the YAML file, what exactly each field type does, or if you
|
|
27
27
|
want to add a new type of supported form field.
|
|
28
28
|
"""
|
|
29
|
+
|
|
29
30
|
# modified from https://sleap.ai/_modules/sleap/gui/formbuilder.html
|
|
30
31
|
import yaml
|
|
31
32
|
from typing import Any, Dict, List, Optional, Union, Text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xarray-behave-0.35.1 → xarray-behave-0.35.3}/doc/demo_behavioral_features_large_group.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/envelope_computation.yaml
RENAMED
|
File without changes
|
{xarray-behave-0.35.1 → xarray-behave-0.35.3}/src/xarray_behave/gui/forms/export_for_das.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|