xarray-behave 0.37.1__tar.gz → 0.37.2__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.37.1 → xarray_behave-0.37.2}/PKG-INFO +1 -1
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/__init__.py +1 -1
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/app.py +44 -137
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/.github/workflows/publish.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/.gitignore +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/LICENSE +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/README.md +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/build_env.yml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/conda/xarray-behave/bld.bat +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/conda/xarray-behave/build.sh +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/conda/xarray-behave/meta.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/condarc.yml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/doc/demo.ipynb +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/doc/demo_behavioral_features.ipynb +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/doc/demo_behavioral_features_large_group.ipynb +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/doc/ncb.mplstyle +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/pyproject.toml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/setup.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/annot.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/event_utils.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/__init__.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/audio_player.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/das.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/formbuilder.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/das_make.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/das_predict.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/das_train.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/envelope_computation.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/export_for_das.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/from_dir.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/from_file.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/from_zarr.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/spec_freq.yaml +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/icon.png +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/table.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/utils.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/view_dialog.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/views.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/widgets.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/__init__.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/annotations.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/annotations_manual.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/audio.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/balltracks.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/movieparams.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/poses.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/samplestamps/__init__.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/samplestamps/samplestamps.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/samplestamps/utils.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/timestamps.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/tracks.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/loaders.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/metrics.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/xarray_behave.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_annot.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_assemble.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_assemble_metrics.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_imports.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_io.py +0 -0
- {xarray_behave-0.37.1 → xarray_behave-0.37.2}/tests/test_sampstamps.py +0 -0
|
@@ -45,11 +45,7 @@ except ImportError:
|
|
|
45
45
|
try:
|
|
46
46
|
from . import das
|
|
47
47
|
except Exception:
|
|
48
|
-
logger.warning(
|
|
49
|
-
"Failed to import the das module.\nIgnore if you do not want to use das.\n"
|
|
50
|
-
"Otherwise follow these instructions to install:\n"
|
|
51
|
-
"https://janclemenslab.org/das/install.html"
|
|
52
|
-
)
|
|
48
|
+
logger.warning("Failed to import the das module.\nIgnore if you do not want to use das.\n" "Otherwise follow these instructions to install:\n" "https://janclemenslab.org/das/install.html")
|
|
53
49
|
|
|
54
50
|
sys.setrecursionlimit(10**6) # increase recursion limit to avoid errors when keeping key pressed for a long time
|
|
55
51
|
package_dir: str = xarray_behave.__path__[0]
|
|
@@ -158,9 +154,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
158
154
|
|
|
159
155
|
def save_swaps(self, qt_keycode=None):
|
|
160
156
|
savefilename = self._get_filename_from_ds(suffix="_idswaps.txt")
|
|
161
|
-
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
162
|
-
self, "Save swaps to", str(savefilename), filter="txt files (*.txt);;all files (*)"
|
|
163
|
-
)
|
|
157
|
+
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save swaps to", str(savefilename), filter="txt files (*.txt);;all files (*)")
|
|
164
158
|
if len(savefilename):
|
|
165
159
|
logger.info(f" Saving list of swap indices to {savefilename}.")
|
|
166
160
|
os.makedirs(os.path.dirname(savefilename), exist_ok=True)
|
|
@@ -169,9 +163,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
169
163
|
|
|
170
164
|
def save_definitions(self, qt_keycode=None):
|
|
171
165
|
savefilename = self._get_filename_from_ds(suffix="_definitions.csv")
|
|
172
|
-
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
173
|
-
self, caption="Save definitions to", dir=str(savefilename), filter="CSV files (*_definitions.csv);;all files (*)"
|
|
174
|
-
)
|
|
166
|
+
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(self, caption="Save definitions to", dir=str(savefilename), filter="CSV files (*_definitions.csv);;all files (*)")
|
|
175
167
|
if len(savefilename):
|
|
176
168
|
# get defs from annot and save them to csv
|
|
177
169
|
logger.info(f" Saving definitions to {savefilename}.")
|
|
@@ -411,9 +403,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
411
403
|
self.export_to_h5(savefilename_trunk + ".h5", start_seconds, end_seconds) # , form_data["scale_audio"])
|
|
412
404
|
|
|
413
405
|
logger.info(f" annotations to CSV: {savefilename_trunk + '.csv'}.")
|
|
414
|
-
self.export_to_csv(
|
|
415
|
-
savefilename_trunk + "_annotations.csv", start_seconds, end_seconds, which_events, match_to_samples=True
|
|
416
|
-
)
|
|
406
|
+
self.export_to_csv(savefilename_trunk + "_annotations.csv", start_seconds, end_seconds, which_events, match_to_samples=True)
|
|
417
407
|
logger.info("Done.")
|
|
418
408
|
|
|
419
409
|
def das_make(self, qt_keycode=None):
|
|
@@ -514,9 +504,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
514
504
|
return form_data
|
|
515
505
|
|
|
516
506
|
def save(arg):
|
|
517
|
-
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
518
|
-
self, "Save configuration to", "", filter="yaml files (*.yaml);;all files (*)"
|
|
519
|
-
)
|
|
507
|
+
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save configuration to", "", filter="yaml files (*.yaml);;all files (*)")
|
|
520
508
|
if len(savefilename):
|
|
521
509
|
data = dialog.form.get_form_data()
|
|
522
510
|
logger.info(f" Saving form fields to {savefilename}.")
|
|
@@ -527,9 +515,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
527
515
|
def make_cli(arg):
|
|
528
516
|
script_ext = "cmd" if os.name == "nt" else "sh"
|
|
529
517
|
savefilename = "train." + script_ext
|
|
530
|
-
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
531
|
-
self, "Script name", savefilename, filter=f"script (*.{script_ext};;all files (*)"
|
|
532
|
-
)
|
|
518
|
+
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Script name", savefilename, filter=f"script (*.{script_ext};;all files (*)")
|
|
533
519
|
if len(savefilename):
|
|
534
520
|
form_data = dialog.form.get_form_data()
|
|
535
521
|
form_data = _filter_form_data(form_data, is_cli=True)
|
|
@@ -718,19 +704,13 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
718
704
|
|
|
719
705
|
params = das.utils.load_params(model_path)
|
|
720
706
|
if audio.shape[0] < params["nb_hist"]:
|
|
721
|
-
logger.warning(
|
|
722
|
-
f" Aborting. Audio has fewer samples ({audio.shape[0]}) shorter"
|
|
723
|
-
f" than network chunk size ({params['nb_hist']})."
|
|
724
|
-
" Fix by select longer audio."
|
|
725
|
-
)
|
|
707
|
+
logger.warning(f" Aborting. Audio has fewer samples ({audio.shape[0]}) shorter" f" than network chunk size ({params['nb_hist']})." " Fix by select longer audio.")
|
|
726
708
|
return
|
|
727
709
|
|
|
728
710
|
# select batch size so that at least 10 batches are run
|
|
729
711
|
# minimizes loss of annotations from batch size "quantization" errors
|
|
730
712
|
batch_size = 32
|
|
731
|
-
nb_batches = int(
|
|
732
|
-
np.floor((audio.shape[0] - ((batch_size - 1) + params["nb_hist"])) / (params["stride"] * (batch_size)))
|
|
733
|
-
)
|
|
713
|
+
nb_batches = int(np.floor((audio.shape[0] - ((batch_size - 1) + params["nb_hist"])) / (params["stride"] * (batch_size))))
|
|
734
714
|
while nb_batches < 10 and batch_size > 1:
|
|
735
715
|
batch_size -= 1
|
|
736
716
|
|
|
@@ -800,11 +780,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
800
780
|
# segments['sequence'] = [s for s in segments['sequence'] if s is not None]
|
|
801
781
|
detected_segment_names = np.unique(segments["sequence"])
|
|
802
782
|
# if these are indices, get corresponding names
|
|
803
|
-
if (
|
|
804
|
-
len(detected_segment_names)
|
|
805
|
-
and type(detected_segment_names[0]) is not str
|
|
806
|
-
and type(detected_segment_names[0]) is not np.str_
|
|
807
|
-
):
|
|
783
|
+
if len(detected_segment_names) and type(detected_segment_names[0]) is not str and type(detected_segment_names[0]) is not np.str_:
|
|
808
784
|
detected_segment_names = [segments["names"][ii] for ii in detected_segment_names]
|
|
809
785
|
|
|
810
786
|
if len(detected_segment_names) > 0: # and detected_segment_names[0] is not None:
|
|
@@ -820,9 +796,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
820
796
|
|
|
821
797
|
onsets_seconds = self.ds.sampletime[onsets_samples]
|
|
822
798
|
offsets_seconds = self.ds.sampletime[offsets_samples]
|
|
823
|
-
for name_or_index, onset_seconds, offset_seconds in zip(
|
|
824
|
-
segments["sequence"], onsets_seconds, offsets_seconds
|
|
825
|
-
):
|
|
799
|
+
for name_or_index, onset_seconds, offset_seconds in zip(segments["sequence"], onsets_seconds, offsets_seconds):
|
|
826
800
|
if type(name_or_index) is not str and type(detected_segment_names[0]) is not np.str_:
|
|
827
801
|
segment_name = segments["names"][name_or_index]
|
|
828
802
|
else:
|
|
@@ -871,16 +845,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
871
845
|
except KeyError:
|
|
872
846
|
pass
|
|
873
847
|
except KeyError:
|
|
874
|
-
logger.info(
|
|
875
|
-
|
|
876
|
-
f"Need to save 'samplerate' variable with the audio data. Defaulting to {samplerate}"
|
|
877
|
-
)
|
|
878
|
-
elif (
|
|
879
|
-
filename.endswith(".h5")
|
|
880
|
-
or filename.endswith(".hdfs")
|
|
881
|
-
or filename.endswith(".hdf5")
|
|
882
|
-
or filename.endswith(".mat")
|
|
883
|
-
):
|
|
848
|
+
logger.info(f"{filename} no sample rate info in NPZ file." f"Need to save 'samplerate' variable with the audio data. Defaulting to {samplerate}")
|
|
849
|
+
elif filename.endswith(".h5") or filename.endswith(".hdfs") or filename.endswith(".hdf5") or filename.endswith(".mat"):
|
|
884
850
|
# infer data set (for hdf5) and populate form
|
|
885
851
|
try:
|
|
886
852
|
# list all data sets in file and add to list
|
|
@@ -984,9 +950,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
984
950
|
if not dirname:
|
|
985
951
|
dirname = QtWidgets.QFileDialog.getExistingDirectory(parent=None, caption="Select data directory")
|
|
986
952
|
if dirname:
|
|
987
|
-
dialog = YamlDialog(
|
|
988
|
-
yaml_file=package_dir + "/gui/forms/from_dir.yaml", title=f"Dataset from data directory {dirname}"
|
|
989
|
-
)
|
|
953
|
+
dialog = YamlDialog(yaml_file=package_dir + "/gui/forms/from_dir.yaml", title=f"Dataset from data directory {dirname}")
|
|
990
954
|
|
|
991
955
|
# initialize form data with cli args
|
|
992
956
|
dialog.form["pixel_size_mm"] = pixel_size_mm # and un-disable
|
|
@@ -1061,9 +1025,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1061
1025
|
|
|
1062
1026
|
# add event categories if they are missing in the dataset
|
|
1063
1027
|
if "song_events" in ds and "event_categories" not in ds:
|
|
1064
|
-
event_categories = [
|
|
1065
|
-
"segment" if "sine" in evt or "syllable" in evt else "event" for evt in ds.event_types.values
|
|
1066
|
-
]
|
|
1028
|
+
event_categories = ["segment" if "sine" in evt or "syllable" in evt else "event" for evt in ds.event_types.values]
|
|
1067
1029
|
ds = ds.assign_coords({"event_categories": (("event_types"), event_categories)})
|
|
1068
1030
|
|
|
1069
1031
|
# add missing song types
|
|
@@ -1121,9 +1083,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1121
1083
|
if not filename:
|
|
1122
1084
|
filename, _ = QtWidgets.QFileDialog.getOpenFileName(parent=None, caption="Select dataset")
|
|
1123
1085
|
if filename:
|
|
1124
|
-
dialog = YamlDialog(
|
|
1125
|
-
yaml_file=package_dir + "/gui/forms/from_zarr.yaml", title=f"Load dataset from zarr file {filename}"
|
|
1126
|
-
)
|
|
1086
|
+
dialog = YamlDialog(yaml_file=package_dir + "/gui/forms/from_zarr.yaml", title=f"Load dataset from zarr file {filename}")
|
|
1127
1087
|
|
|
1128
1088
|
# initialize form data with cli args
|
|
1129
1089
|
if spec_freq_min is not None:
|
|
@@ -1161,9 +1121,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1161
1121
|
|
|
1162
1122
|
# add event categories if they are missing in the dataset
|
|
1163
1123
|
if "song_events" in ds and "event_categories" not in ds:
|
|
1164
|
-
event_categories = [
|
|
1165
|
-
"segment" if "sine" in evt or "syllable" in evt else "event" for evt in ds.event_types.values
|
|
1166
|
-
]
|
|
1124
|
+
event_categories = ["segment" if "sine" in evt or "syllable" in evt else "event" for evt in ds.event_types.values]
|
|
1167
1125
|
ds = ds.assign_coords({"event_categories": (("event_types"), event_categories)})
|
|
1168
1126
|
logger.info(ds)
|
|
1169
1127
|
vr = None
|
|
@@ -1208,15 +1166,11 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1208
1166
|
|
|
1209
1167
|
def save_dataset(self, qt_keycode=None):
|
|
1210
1168
|
try:
|
|
1211
|
-
savefilename = Path(
|
|
1212
|
-
self.ds.attrs["root"], self.ds.attrs["dat_path"], self.ds.attrs["datename"], f"{self.ds.attrs['datename']}.zarr"
|
|
1213
|
-
)
|
|
1169
|
+
savefilename = Path(self.ds.attrs["root"], self.ds.attrs["dat_path"], self.ds.attrs["datename"], f"{self.ds.attrs['datename']}.zarr")
|
|
1214
1170
|
except KeyError:
|
|
1215
1171
|
savefilename = ""
|
|
1216
1172
|
|
|
1217
|
-
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
1218
|
-
self, "Save dataset to", str(savefilename), filter="zarr files (*.zarr);;all files (*)"
|
|
1219
|
-
)
|
|
1173
|
+
savefilename, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save dataset to", str(savefilename), filter="zarr files (*.zarr);;all files (*)")
|
|
1220
1174
|
|
|
1221
1175
|
if len(savefilename):
|
|
1222
1176
|
file_exists = os.path.exists(savefilename)
|
|
@@ -1468,16 +1422,10 @@ class PSV(MainWindow):
|
|
|
1468
1422
|
self._add_keyed_menuitem(view_video, "Change other fly", self.change_other_fly, "Z")
|
|
1469
1423
|
self._add_keyed_menuitem(view_video, "Swap flies", self.swap_flies, "X")
|
|
1470
1424
|
view_video.addSeparator()
|
|
1471
|
-
self._add_keyed_menuitem(
|
|
1472
|
-
view_video, "Move poses", partial(self.toggle, "move_poses"), "B", checkable=True, checked=self.move_poses
|
|
1473
|
-
)
|
|
1425
|
+
self._add_keyed_menuitem(view_video, "Move poses", partial(self.toggle, "move_poses"), "B", checkable=True, checked=self.move_poses)
|
|
1474
1426
|
view_video.addSeparator()
|
|
1475
|
-
self._add_keyed_menuitem(
|
|
1476
|
-
|
|
1477
|
-
)
|
|
1478
|
-
self._add_keyed_menuitem(
|
|
1479
|
-
view_video, "Show poses", partial(self.toggle, "show_poses"), "P", checkable=True, checked=self.show_poses
|
|
1480
|
-
)
|
|
1427
|
+
self._add_keyed_menuitem(view_video, "Show fly position", partial(self.toggle, "show_dot"), "O", checkable=True, checked=self.show_dot)
|
|
1428
|
+
self._add_keyed_menuitem(view_video, "Show poses", partial(self.toggle, "show_poses"), "P", checkable=True, checked=self.show_poses)
|
|
1481
1429
|
|
|
1482
1430
|
view_audio = self.bar.addMenu("Audio")
|
|
1483
1431
|
self._add_keyed_menuitem(view_audio, "Play waveform through speakers", self.play_audio, "E")
|
|
@@ -1501,9 +1449,7 @@ class PSV(MainWindow):
|
|
|
1501
1449
|
self._add_keyed_menuitem(view_audio, "Select previous channel", self.set_next_channel, "Up")
|
|
1502
1450
|
self._add_keyed_menuitem(view_audio, "Select next channel", self.set_prev_channel, "Down")
|
|
1503
1451
|
view_audio.addSeparator()
|
|
1504
|
-
self._add_keyed_menuitem(
|
|
1505
|
-
view_audio, "Show spectrogram", partial(self.toggle, "show_spec"), None, checkable=True, checked=self.show_spec
|
|
1506
|
-
)
|
|
1452
|
+
self._add_keyed_menuitem(view_audio, "Show spectrogram", partial(self.toggle, "show_spec"), None, checkable=True, checked=self.show_spec)
|
|
1507
1453
|
self._add_keyed_menuitem(view_audio, "Increase frequency resolution", self.inc_freq_res, "R")
|
|
1508
1454
|
self._add_keyed_menuitem(view_audio, "Increase temporal resolution", self.dec_freq_res, "T")
|
|
1509
1455
|
view_audio.addSeparator()
|
|
@@ -1557,34 +1503,20 @@ class PSV(MainWindow):
|
|
|
1557
1503
|
self._add_keyed_menuitem(view_annotations, "Generate proposal by envelope thresholding", self.threshold, "I")
|
|
1558
1504
|
self._add_keyed_menuitem(view_annotations, "Adjust thresholding mode", self.set_envelope_computation)
|
|
1559
1505
|
view_annotations.addSeparator()
|
|
1560
|
-
self._add_keyed_menuitem(
|
|
1561
|
-
|
|
1562
|
-
)
|
|
1563
|
-
self._add_keyed_menuitem(
|
|
1564
|
-
view_annotations, "Approve proposals for all song types in view", self.approve_all_proposals, "H"
|
|
1565
|
-
)
|
|
1506
|
+
self._add_keyed_menuitem(view_annotations, "Approve proposals for active song type in view", self.approve_active_proposals, "G")
|
|
1507
|
+
self._add_keyed_menuitem(view_annotations, "Approve proposals for all song types in view", self.approve_all_proposals, "H")
|
|
1566
1508
|
|
|
1567
1509
|
view_view = self.bar.addMenu("View")
|
|
1568
1510
|
self._add_keyed_menuitem(view_view, "Video, waveform, and spectrogram display parameters", self.set_spec_freq)
|
|
1569
1511
|
view_view.addSeparator()
|
|
1570
1512
|
# TODO? only show these if tracks and/or video
|
|
1571
|
-
self._add_keyed_menuitem(
|
|
1572
|
-
|
|
1573
|
-
)
|
|
1574
|
-
self._add_keyed_menuitem(
|
|
1575
|
-
view_view, "Show waveform", partial(self.toggle, "show_trace"), None, checkable=True, checked=self.show_trace
|
|
1576
|
-
)
|
|
1577
|
-
self._add_keyed_menuitem(
|
|
1578
|
-
view_view, "Show ethogram", partial(self.toggle, "show_annot"), None, checkable=True, checked=self.show_annot
|
|
1579
|
-
)
|
|
1513
|
+
self._add_keyed_menuitem(view_view, "Show spectrogram", partial(self.toggle, "show_spec"), None, checkable=True, checked=self.show_spec)
|
|
1514
|
+
self._add_keyed_menuitem(view_view, "Show waveform", partial(self.toggle, "show_trace"), None, checkable=True, checked=self.show_trace)
|
|
1515
|
+
self._add_keyed_menuitem(view_view, "Show ethogram", partial(self.toggle, "show_annot"), None, checkable=True, checked=self.show_annot)
|
|
1580
1516
|
if "pose_positions_allo" in self.ds:
|
|
1581
|
-
self._add_keyed_menuitem(
|
|
1582
|
-
view_view, "Show tracks", partial(self.toggle, "show_tracks"), None, checkable=True, checked=self.show_tracks
|
|
1583
|
-
)
|
|
1517
|
+
self._add_keyed_menuitem(view_view, "Show tracks", partial(self.toggle, "show_tracks"), None, checkable=True, checked=self.show_tracks)
|
|
1584
1518
|
if self.vr is not None:
|
|
1585
|
-
self._add_keyed_menuitem(
|
|
1586
|
-
view_view, "Show movie", partial(self.toggle, "show_movie"), None, checkable=True, checked=self.show_movie
|
|
1587
|
-
)
|
|
1519
|
+
self._add_keyed_menuitem(view_view, "Show movie", partial(self.toggle, "show_movie"), None, checkable=True, checked=self.show_movie)
|
|
1588
1520
|
|
|
1589
1521
|
self.hl = QtWidgets.QHBoxLayout()
|
|
1590
1522
|
|
|
@@ -1955,9 +1887,7 @@ class PSV(MainWindow):
|
|
|
1955
1887
|
|
|
1956
1888
|
def delete_current_events(self, qt_keycode):
|
|
1957
1889
|
if self.current_event_index is not None:
|
|
1958
|
-
deleted_events = self.event_times.delete_range(
|
|
1959
|
-
self.current_event_name, self.time0 / self.fs_song, self.time1 / self.fs_song
|
|
1960
|
-
)
|
|
1890
|
+
deleted_events = self.event_times.delete_range(self.current_event_name, self.time0 / self.fs_song, self.time1 / self.fs_song)
|
|
1961
1891
|
nb_deleted_events = len(deleted_events)
|
|
1962
1892
|
if nb_deleted_events:
|
|
1963
1893
|
logger.info(f" Deleted {nb_deleted_events} annotation(s) of type {self.current_event_name}.")
|
|
@@ -1979,9 +1909,7 @@ class PSV(MainWindow):
|
|
|
1979
1909
|
def threshold(self, qt_keycode):
|
|
1980
1910
|
if self.STOP and self.current_event_name is not None:
|
|
1981
1911
|
if self.event_times.categories[self.current_event_name] == "event":
|
|
1982
|
-
indexes = peakutils.indexes(
|
|
1983
|
-
self.envelope, thres=self.slice_view.threshold, min_dist=self.thres_min_dist * self.fs_song, thres_abs=True
|
|
1984
|
-
)
|
|
1912
|
+
indexes = peakutils.indexes(self.envelope, thres=self.slice_view.threshold, min_dist=self.thres_min_dist * self.fs_song, thres_abs=True)
|
|
1985
1913
|
# add events to current song type
|
|
1986
1914
|
for t in self.x[indexes]:
|
|
1987
1915
|
self.event_times.add_time(self.current_event_name, t)
|
|
@@ -2133,9 +2061,7 @@ class PSV(MainWindow):
|
|
|
2133
2061
|
dialog.exec_()
|
|
2134
2062
|
|
|
2135
2063
|
def set_envelope_computation(self, qt_keycode):
|
|
2136
|
-
dialog = YamlDialog(
|
|
2137
|
-
yaml_file=package_dir + "/gui/forms/envelope_computation.yaml", title="Set options for envelope computation"
|
|
2138
|
-
)
|
|
2064
|
+
dialog = YamlDialog(yaml_file=package_dir + "/gui/forms/envelope_computation.yaml", title="Set options for envelope computation")
|
|
2139
2065
|
|
|
2140
2066
|
dialog.form["thres_min_dist"] = self.thres_min_dist
|
|
2141
2067
|
dialog.form["thres_env_std"] = self.thres_env_std
|
|
@@ -2213,9 +2139,7 @@ class PSV(MainWindow):
|
|
|
2213
2139
|
i1 = int(self.time1 / self.fs_ratio)
|
|
2214
2140
|
|
|
2215
2141
|
self.x_tracks = self.ds.time.data[i0:i1]
|
|
2216
|
-
self.y_tracks = self.ds.pose_positions_allo.data[
|
|
2217
|
-
i0:i1, self.focal_fly, self.track_sel_names, self.track_sel_coords
|
|
2218
|
-
]
|
|
2142
|
+
self.y_tracks = self.ds.pose_positions_allo.data[i0:i1, self.focal_fly, self.track_sel_names, self.track_sel_coords]
|
|
2219
2143
|
self.tracks_view.update_trace()
|
|
2220
2144
|
self.tracks_view.show()
|
|
2221
2145
|
else:
|
|
@@ -2262,13 +2186,9 @@ class PSV(MainWindow):
|
|
|
2262
2186
|
if self.event_times.categories[event_name] == "segment":
|
|
2263
2187
|
for onset, offset in zip(events_in_view[:, 0], events_in_view[:, 1]):
|
|
2264
2188
|
if self.show_trace:
|
|
2265
|
-
self.slice_view.add_segment(
|
|
2266
|
-
onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text
|
|
2267
|
-
)
|
|
2189
|
+
self.slice_view.add_segment(onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text)
|
|
2268
2190
|
if self.show_tracks:
|
|
2269
|
-
self.tracks_view.add_segment(
|
|
2270
|
-
onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text
|
|
2271
|
-
)
|
|
2191
|
+
self.tracks_view.add_segment(onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text)
|
|
2272
2192
|
if self.show_annot:
|
|
2273
2193
|
self.annot_view.add_segment(
|
|
2274
2194
|
onset,
|
|
@@ -2280,9 +2200,7 @@ class PSV(MainWindow):
|
|
|
2280
2200
|
text=segment_text,
|
|
2281
2201
|
)
|
|
2282
2202
|
if self.show_spec:
|
|
2283
|
-
self.spec_view.add_segment(
|
|
2284
|
-
onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text
|
|
2285
|
-
)
|
|
2203
|
+
self.spec_view.add_segment(onset, offset, event_index, brush=event_brush, pen=event_pen, movable=movable, text=segment_text)
|
|
2286
2204
|
elif self.event_times.categories[event_name] == "event":
|
|
2287
2205
|
if self.show_trace:
|
|
2288
2206
|
self.slice_view.add_event(events_in_view[:, 0], event_index, event_pen, movable=movable, text=segment_text)
|
|
@@ -2315,9 +2233,7 @@ class PSV(MainWindow):
|
|
|
2315
2233
|
|
|
2316
2234
|
new_region = region.getRegion()
|
|
2317
2235
|
self.event_times.move_time(event_name_to_move, region.bounds, new_region)
|
|
2318
|
-
logger.info(
|
|
2319
|
-
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."
|
|
2320
|
-
)
|
|
2236
|
+
logger.info(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.")
|
|
2321
2237
|
|
|
2322
2238
|
# FIXME for moving annotations in ethogram - fails in pyside6
|
|
2323
2239
|
if self.annot_view.mousePoint is not None:
|
|
@@ -2389,10 +2305,7 @@ class PSV(MainWindow):
|
|
|
2389
2305
|
fly_pos = self.ds.pose_positions_allo.data[self.index_other, :, self.pose_center_index, :]
|
|
2390
2306
|
fly_pos = np.array(fly_pos) # in case this is a dask.array
|
|
2391
2307
|
if self.crop: # transform fly pos to coordinates of the cropped box
|
|
2392
|
-
box_center =
|
|
2393
|
-
self.ds.pose_positions_allo.data[self.index_other, self.focal_fly, self.pose_center_index]
|
|
2394
|
-
+ self.box_size / 2
|
|
2395
|
-
)
|
|
2308
|
+
box_center = self.ds.pose_positions_allo.data[self.index_other, self.focal_fly, self.pose_center_index] + self.box_size / 2
|
|
2396
2309
|
box_center = np.array(box_center) # in case this is a dask.array
|
|
2397
2310
|
fly_pos = fly_pos - box_center
|
|
2398
2311
|
fly_dist = np.sum((fly_pos - np.array([mouseY, mouseX])) ** 2, axis=-1)
|
|
@@ -2413,7 +2326,7 @@ class PSV(MainWindow):
|
|
|
2413
2326
|
|
|
2414
2327
|
modifiers = QtWidgets.QApplication.keyboardModifiers()
|
|
2415
2328
|
|
|
2416
|
-
if mouseButton ==
|
|
2329
|
+
if mouseButton == QtCore.Qt.MouseButton.LeftButton and modifiers == QtCore.Qt.ControlModifier: # change event type
|
|
2417
2330
|
self.sinet0 = None
|
|
2418
2331
|
|
|
2419
2332
|
if not self.edit_only_current_events:
|
|
@@ -2432,11 +2345,9 @@ class PSV(MainWindow):
|
|
|
2432
2345
|
if self.event_times.categories[self.current_event_name] == "event":
|
|
2433
2346
|
logger.info(f" Changed event at {changed_time[0]:1.4f} from {old_name} to {new_name}.")
|
|
2434
2347
|
else:
|
|
2435
|
-
logger.info(
|
|
2436
|
-
f" Changed segment at {changed_time[0]:1.4f}:{changed_time[1]:1.4f} from {old_name} to {new_name}."
|
|
2437
|
-
)
|
|
2348
|
+
logger.info(f" Changed segment at {changed_time[0]:1.4f}:{changed_time[1]:1.4f} from {old_name} to {new_name}.")
|
|
2438
2349
|
self.update_xy()
|
|
2439
|
-
elif mouseButton ==
|
|
2350
|
+
elif mouseButton == QtCore.Qt.MouseButton.LeftButton: # add event
|
|
2440
2351
|
if self.current_event_index is not None:
|
|
2441
2352
|
if self.event_times.categories[self.current_event_name] == "segment":
|
|
2442
2353
|
if self.sinet0 is None:
|
|
@@ -2454,20 +2365,16 @@ class PSV(MainWindow):
|
|
|
2454
2365
|
stop_seconds=mouseT,
|
|
2455
2366
|
channel=self.current_channel_index,
|
|
2456
2367
|
)
|
|
2457
|
-
logger.info(
|
|
2458
|
-
f" Added {self.current_event_name} on channel {self.current_channel_index} at t=[{self.sinet0:1.4f}:{mouseT:1.4f}] seconds."
|
|
2459
|
-
)
|
|
2368
|
+
logger.info(f" Added {self.current_event_name} on channel {self.current_channel_index} at t=[{self.sinet0:1.4f}:{mouseT:1.4f}] seconds.")
|
|
2460
2369
|
self.sinet0 = None
|
|
2461
2370
|
if self.event_times.categories[self.current_event_name] == "event":
|
|
2462
2371
|
self.sinet0 = None
|
|
2463
2372
|
self.event_times.add_time(self.current_event_name, start_seconds=mouseT, channel=self.current_channel_index)
|
|
2464
|
-
logger.info(
|
|
2465
|
-
f" Added {self.current_event_name} on channel {self.current_channel_index} at t={mouseT:1.4f} seconds."
|
|
2466
|
-
)
|
|
2373
|
+
logger.info(f" Added {self.current_event_name} on channel {self.current_channel_index} at t={mouseT:1.4f} seconds.")
|
|
2467
2374
|
self.update_xy()
|
|
2468
2375
|
else:
|
|
2469
2376
|
self.sinet0 = None
|
|
2470
|
-
elif mouseButton ==
|
|
2377
|
+
elif mouseButton == QtCore.Qt.MouseButton.RightButton: # delete nearest event
|
|
2471
2378
|
self.spec_view.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
2472
2379
|
self.slice_view.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
2473
2380
|
self.annot_view.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
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
|
{xarray_behave-0.37.1 → xarray_behave-0.37.2}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/gui/forms/envelope_computation.yaml
RENAMED
|
File without changes
|
{xarray_behave-0.37.1 → xarray_behave-0.37.2}/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
|
{xarray_behave-0.37.1 → xarray_behave-0.37.2}/src/xarray_behave/io/samplestamps/samplestamps.py
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
|